Using mercurial to deploy Drupal
A work in progress. This documents our inhouse method for maintaining three tiered deployment with revision control # create a backup of the database # initialise an hg repo in your local dev directory, add all content, commit and tag # clone it to our remote repo (first time only) localmachine:source user$ hg clone ./ ssh://repo/laudanum/scanlines # push updates to the repo localmachine:source user$ hg push ssh://repo/laudanum/scanlines # configure (mt) domain and subdomain with ssh access and two databases (production and staging) # ssh to our (mt) server
[root@laudible scanlines.net]# chown laudanum:psaserv subdomains/staging/[root@laudible scanlines.net]# exitexit-bash-3.2$ rm -Rf.bash_history .hgrc .ssh/ bin/ conf/ httpdocs/ lib/ private/ statistics/ web_users/.bash_profile .lesshst anon_ftp/ cgi-bin/ error_docs/ httpsdocs/ pd/ repository/ subdomains/-bash-3.2$ rm -Rf subdomains/staging/httpdocs/-bash-3.2$ ln -s ~/repository/backup/ content/ source/ version/-bash-3.2$ ln -s ~/repository/source/scanlines/ ~/subdomains/staging/httpdocs
# give our remote user control of our our main and staging directory [root@host example.net]# chown [remoteuser]:psaserv ./ ./subdomains/staging/ [root@host example.net]# exit # create our repository structure on our web server -bash-3.2$ mkdir repository -bash-3.2$ cd repository/ -bash-3.2$ mkdir source backup content version # clone from our repo to our source directory # remove the dummy document root from staging and link it to our source directory -bash-3.2$ rm -Rf subdomains/staging/httpdocs/ -bash-3.2$ ln -s ~/repository/source/example/ ~/subdomains/staging/httpdocs
# import the backed up database -bash-3.2$ gzip -d < path/to/backups/database-xxxxxxxx.sql.gz | mysql -u[sql-staging-user] -p[sql-staging-pass] example_staging # fix open_basedir restriction as per this post # actually it looks like only the primary domain vhost.conf file needs doing - but do both anyway # rsync our local files directory to the content directory on our hostlocalmachine:content user$ rsync -avz --progress files [remoteuser]@example.net:~/repository/content