Question

I have a production environment for a Drupal 7 site.

This environment is replicated to a staging environment, which we use for testing updates to modules and drupal core (same major version).

We would like to sync this environment with the production one everytime we want to test an update, and then replicate the changes.

The way I envision the process is the following:

  1. rsync everything from production to staging, getting the updated content from production and crushing any staging changes, deleting any files from staging that do not exist in production

  2. replicate database from production to staging, so we can test pages and functionalities on production content replica

  3. perform updates on the staging environment

  4. rsync from staging to production, not deleting in production content that might not exist in staging

Question #1: Do updates make changes to the database? Or are these file only changes? Will rsync be enough to get the production in sync with staging after the updates?

Question #2: Is there a better, more robust way to achieve this?

Question #3: Should I set the site into maintenance mode while doing #4? Can this be done by setting maintenance mode programatically in a config file, rsync that file and everything else, then reset the maintenance mode and rsync that file? (I am looking to build a script to automate this)

Was it helpful?

Solution

Question #1: Do updates make changes to the database? Or are these file only changes? Will rsync be enough to get the production in sync with staging after the updates?

Updates will most likely do changes to the database. That's where most of the fun comes in when doing updates :D

Question #2: Is there a better, more robust way to achieve this?

Syncing production to the staging system every now and then is a good idea, I'm not sure if you need it everytime you want to test something. I'm assuming your deployments go through that staging system as well, so your content there will already be something you can test with. As far as I know there is no way to be 100% sure you're not going to kill your production environment. That's why you back up the database and the code and everything, before doing any change to production.

Question #3: Should I set the site into maintenance mode while doing #4? Can this be done by setting maintenance mode programatically in a config file, rsync that file and everything else, then reset the maintenance mode and rsync that file? (I am looking to build a script to automate this)

You can set the maintenance mode using drush. https://drupal.stackexchange.com/a/32/47426 To disable maintenance mode, run the same command with 0/FALSE instead of 1/TRUE. And don't forget about the cache clear.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top