Provisioning and install script for a speedy Drupal workflow

I made this script and the database backup, dump, and SVN commit script because I was determined to spend as little time as possible doing sysadmin while setting up dev and staging sites, so that I could spend as much time as possible developing (e.g., the fun stuff). With one command the script can:

  • 'svn up' a version controlled database, and upload it to your database
  • Run queries against database to set preferred site defaults
  • 'svn up' site docroot
  • Copy over fresh "files" directory from another site (e.g., production). Note, not a good option if you have your "files" directory version controlled.
  • Set owner:group file permissions on all site files

How to
The script should go in non-public, secure directory, which is somewhere below the site doc root. I haven't tried running it with permissions less than sudo, though it may be possible. Invoke by doing:

sh path/to/provision_and_install.sh

Download
provision_and_install.sh.zip

28 March, 2009

Comments

Nice script, i just wanted to mention that instead of:

find $docroot -type d -print0 | xargs -0 chown $chmod_owner

you could also do this:

find $docroot -type d -exec chown $chmod_owner {} \;

besides what osvaldo mentioned, you could have a cleaner script using 'tee'

instead of
echo " svn up'ed "$docroot
echo " svn up'ed "$docroot >> $logfile

just
echo " svn up'ed "$docroot | tee -a $logfile

and
find $docroot -type d -print0 | xargs -0 chown $chmod_owner
find $docroot -type f -print0 | xargs -0 chown $chmod_owner

to
chown -R $chmod_owner $docroot

same for $docroot_files_dir