xforty / drush-deploy

Drupal deploy tool based on Capistrano and Drush
https://github.com/xforty/drush-deploy/wiki
Other
35 stars 4 forks source link

Not all environments have database users with CREATE DATABASE privs #12

Open pearcec opened 11 years ago

pearcec commented 11 years ago

We have run into the situation where we are in a control panel hosted environment. As a result we can't readily create a database. I wonder if we can disable this? I looked and saw version_database. We tried adding

set :version_database, false

to our Capfile, but that didn't do anything.

Alternatively can we simply name a versioned database for backup and rollback? Like

test_xforty_com_1 test_xforty_com_2

These databases would be created ahead of time and rotated through. IDK -- Just checking out thoughts.

pearcec commented 11 years ago

I should note it does appear to still deploy the code.

dkingofpa commented 11 years ago

Dreamhost would be one example of a shared hosting environment with limited CREATE DATABASE permissions.

http://wiki.dreamhost.com/MySQL

CREATE DATABASE only works from the shell if you previously created a database with the specified same name using your Dreamhost Panel and then dropped it at some point (in other words you can (and should) use --drop-database with mysqldump when backing up a database)

dkingofpa commented 11 years ago

And here are what the errors might look like in one of those shared hosting environments:

    servers: ["example.com"]
 ** sftp upload #<StringIO:0x00000001ba8e60> -> /tmp/tmp.hkSuqGUYKS
    [example.com] /tmp/tmp.hkSuqGUYKS
    [example.com] done
  * sftp upload complete
  * executing "cd '/home/user/example.com/releases/20121219210257' && drush sql-cli --db-url='mysqli://dbuser:password@host:/database' < '/tmp/tmp.hkSuqGUYKS' && rm -f '/tmp/tmp.hkSuqGUYKS'"
    servers: ["example.com"]
    [user@example.com] executing command
*** [err :: user@example.com] ERROR
*** [err :: user@example.com] 1044 (42000)
*** [err :: user@example.com] at line 1
*** [err :: user@example.com] : Access denied for user 'dbuser'@'xx.xxx.128.0/255.255.128.0' to database 'database_20121217171354'
    command finished in 362ms
  * executing "mktemp"
    servers: ["example.com"]
    [user@example.com] executing command
    command finished in 201ms
    servers: ["example.com"]
 ** sftp upload #<StringIO:0x000000017e5ee0> -> /tmp/tmp.EsxXRMblry
    [example.com] /tmp/tmp.EsxXRMblry
    [example.com] done
  * sftp upload complete
  * executing "cd '/home/user/example.com/releases/20121219210257' && drush sql-cli --db-url='mysqli://user:password@host:/database' < '/tmp/tmp.EsxXRMblry' && rm -f '/tmp/tmp.EsxXRMblry'"
    servers: ["example.com"]
    [user@example.com] executing command
*** [err :: user@example.com] ERROR 1142 (42000) at line 1: CREATE command denied to user 'dbuser'@'ps46110.example.com' for table 'access'
    command finished in 357ms
pearcec commented 11 years ago

I confirmed if version_database is set to false it won't attempt to version the database. But I don't know how to set that form the Capfile. If we can get the variable set that should close on this issue. We can open a new issue for version 2 that handles pre-versioned databases. This sounds like a lot of work, plus it would require a fair amount of effort on the end user to setup those databases.

pearcec commented 11 years ago

I tried added version-database and version_database to the drush alias file as @medlefsen recommended but it doesn't work.