Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

drupal dev / stage / production setup

hey, i started to develop new site in drupal6 and i wonder what is the best way to set it up for dev/stage/production enviorment... svn? online paid service (i saw serval soultions sites that need to pay to do stuff) bash script for sync? please help

like image 406
amirash Avatar asked Jan 20 '23 14:01

amirash


2 Answers

Here is how we do it: We have 2 servers 1 production and a second that houses dev environments for each developer and a "staging" environment. Code is stored in Git and we keep a master and live branch going at all times.

In a nutshell: "live" database is exported and distributed to developers using drush. Configuration and settings are "saved" using both features, and hook_update() and hook_install(). We use Feeds

After a depolyment We have a very simple shell script that leverages drush to copy the live database from the live server to staging on the dev server, and developers use the same simple shell script to pull the staging db to their own environment.

Configuration and Development that occurs in the database is exported via Features, and/or using install and update hooks. Using these three methods we are able to easily deploy about 99% of all settings, content types and other constructs that generally exist only in the database. The last 1% tends to be things that are easier handled with a deployment setup step rather than writing queries in hook_install and hook_update. 100% deployment is possible, but sometimes it's not really worth the effort.

Finally there are times when content needs to be deployed from stage to live. This is where the Feeds module comes in. using feeds and a simple csv import file we have successfully created and exported large taxonomy sets and even complex nodes and sets of nodes. Using feeds is also useful when you need a standard set of "test" data to populate your development databases.

When it comes time to deploy new features or settings we merge the developer changes in to the master branch, deploy and test on staging, which normally requires running update.php, and then "importing" the changes from the new or updated features. If everything passes tests and QA the changes are merged into the live branch and deployed on the production environment.

The biggest lessons we've learned are:

  • while its possible to get everything into features or update and install, it's usually not worth it.
  • It's easiest to pass around a dev database in development, and then export when the dust settles, rather than trying to export every little change.
  • using the diff module along with features has saved our ass many times.
like image 74
mirzu Avatar answered Jan 23 '23 03:01

mirzu


Check out drush and drush make. Drush is great for syncing stuff and be sure to check out the backup migrate module. Also take a look at the Features project which helps you capture database schemas in code (see also hook_update for that).

Also: Drupal is moving to git in a few weeks. Use git.

Wheeeee!

like image 42
Rimian Avatar answered Jan 23 '23 03:01

Rimian