Hi all,

I was thinking that should be interesting to tune the drush's quickstart-create command to allow the creation of sites using PostgreSQL database.

Greetings,

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MichaelCole’s picture

Hi Davfigue,

This is an interesting idea, but I don't have time to devote to it. Would you be interested in submitting a patch?

-- Mike

MichaelCole’s picture

Status: Active » Postponed
MichaelCole’s picture

Status: Postponed » Closed (won't fix)

Hi, I won't get around to this, but would accept a patch if it was submitted.

laceysanderson’s picture

Component: Miscellaneous » Image Build
Status: Closed (won't fix) » Needs review
FileSize
13.2 KB

Since I needed this functionality (the ability to create drupal sites with PostgreSQL backends for debugging purposes), I thought I might as well create a patch back to this project as requested. This is my first patch so hopefully it works!

I've tried my best to stay with the style of the quickstart module and have added to the drush quickstart-create and drush quickstart-destroy commands. I also added to the drush help to document a new option db-backend with can be either "pgsql" or "mysql" but defaults to "mysql". Thus if the --db-backend option is not supplied, the default behaviour is exactly what it was before these changes were made making them backward compatible.

This works when the "all" argument is supplied to either drush command as well as the "database" argument.

One small gotcha is that on site-install drush asks for the password of the newly created pgsql user in order to drop/re-create the database. This is because psql (the postgresql command-line utility) does not allow supplying a password automatically. I've added a drush_print that explains this to the user and supplies the password of the pgsql user so that they can just copy/paste in order to hopefully alleviate any confusion...

Anyway, just let me know if there are any problems or any other functionality I should have included and I'll see what I can do :)
~Lacey

laceysanderson’s picture

Oh, and I documented how I set up postgresql 8.4 on the quickstart VM. Here are the step-by-step instructions:
1) First I installed postgresql:
sudo apt-get install postgresql libpq-dev
2) Then I set the postgres user to have a password of quickstart

  sudo su postgres
  psql
  ALTER USER postgres WITH PASSWORD 'quickstart';
  CREATE USER quickstart WITH PASSWORD 'quickstart';
  ALTER USER quickstart WITH CREATEDB CREATEUSER;

3) Set PostgreSQL to allow connections from apache by editing /etc/postgresql/8.4/main/pg_hba.conf
a) Comment out the following line by prefixing a #:
local all all ident
b) Add the following lines:

  local  all        quickstart                       ident
  host	 all        postgres    127.0.0.1/32	       password

4) Restart postgresql so that the above changes can take place
sudo service postgresql restart

And that's it!

NOTE: The quickstart pgsql user is the one used by the drush commands and by setting the access permissions to ident it ensures that only the ubuntu quickstart user can login to psql using it and also that the quickstart user doesn't need to supply a password. This is what allows the create/destroy database commands to happen without a password prompt.

laceysanderson’s picture

Component: Image Build » Drush

Moving this over to drush since that's the main functionality added by the patch.