How to push the changes from DEV environment to Staging or Production for an On-Prem Developer Portal

Please use this process only if your developer portal is not in production. Do not overwrite your DB in production or you will loose your user information and content.

So you have completed all your development on your on-prem Dev environment and are ready to move these changes to Staging. The following steps describe what needs to happen to migrate all your Devportal changes from Dev to Staging.

Ideally the /var/www/html directory should be in version control system.

Every environment will have it's own version of settings.php (/var/www/html/sites/default/) and the Edge connection file .apigee (/var/www/html/sites/default/private) . Make sure you do not overwrite these when moving code across environments.

  • On the Dev Server :
    • zip the /var/www/html directory
    • Take a mysql db dump
    • mysqldump -u<username> -p<password> devportal > /tmp/dev-devportal-dump.sql
  • Copy the above files to the Staging server (html.zip and dev-devportal-dump.sql )
  • On the Staging Server:
    • Backup the html directory (mv /var/www/html /var/www/html_backup)
    • Take a backup of the DB
    • mysqldump -u<username> -p<password> devportal > /tmp/staging-devportal-dump.sql
  • Unzip the html.zip to /var/www directory
  • Restore the settings.php and the .apigee file
    • cp /var/www/html_backup/sites/default/settings.php /var/www/html/sites/default/
    • cp /var/www/html_backup/sites/default/private/.apigee /var/www/html/sites/default/private
  • Import the mysql DB dump.
    • mysql -u<username> -p<password> devportal < /tmp/dev-devportal-dump.sql
  • Run the following commands
    • cd /var/www/html
    • drush updb -y
    • drush cc all
  • This should finish migrating all the changes from DEV to Staging environment on-prem
    Comments
    Not applicable

    Thanks a lot for the above instructions @Gitesh Koli.

    While the above did 95% of the job, we are stuck at one final step. We are seeing a bunch of errors similar to below on every page saying:

    "The specified file temporary://filepi9c4G could not be copied, because no file by that name exists. Please check that you supplied the correct filename."

    Upon further debugging, we found that this could be due to restoration of /var/www/html directory and the user/group owners for that. I have since changed it accordingly as per this link. Restarted the http service, cleared all drupal caches and still no luck. Cant seem to figure out what else I am missing. Any pointers?

    Not applicable

    - I would highly recommend to featurise the database configurations, this makes the deployment and configuration management much more simpler.

    - Files are also part of content, so all your source code management tool should be aware of is code but not files.

    - Try to automate the manual configuration part of deployment, hook_update_N() and features module is of big help.

    - The deployment strategy across the different environments must be same so to avoid any undealt surprises.

    - As a thumb rule, content should be least bothered during code deployment.

    http://dcycleproject.org/blog/46/continuous-deployment-drupal-style

    Version history
    Last update:
    ‎05-19-2016 01:37 PM
    Updated by: