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:
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
replicate database from production to staging, so we can test pages and functionalities on production content replica
perform updates on the staging environment
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)