Skip to content

Deploy to Production#

Follow this process once a feature is approved and we're ready to deploy to production.

Merge Feature into Develop#

When a feature branch is approved, merge it into develop branch so everyone can pull from the most up to date codebase.

  1. Go to the npl-d8 project in Github: NPLD-8
  2. Verify the pull request is ready to merge (merge pull request button should be green).
  3. Click the “Merge Pull Request” button.
  4. In the box above the “Confirm Merge” button, type the ticket IDs covered with this merge.
  5. Click the “Confirm Merge” button.
  6. Delete the branch in Github.

Merge Develop into Master#

When you are ready to deploy changes to Pantheon, merge develop into master using either the Github GUI or Terminal, then push to Pantheon.

  1. Go to develop branch:
    git checkout develop
  2. Pull to get most up to date develop code:
    git pull origin develop
  3. Checkout master:
    git checkout master
  4. Pull to get most up to date master code:
    git pull origin master
  5. Merge develop into master:
    git merge develop
  6. If you end up in VIM, do esc, colon, write, quit:
    esc button then :wq
  7. Push to Pantheon:
    git push origin master
  8. Go to GitHub Actions, to see the build process run. The build process deploys master to Pantheon dev.

Use the Github GUI (alternate option)#

  1. Go to the npl-d8 project in Github: NPLD-8
  2. Click the Pull Requests tab.
  3. Click the New Pull Request button.
  4. For “comparing changes” options:
    1. Base = master
    2. Compare = develop
  5. Review the commits that are going into this pull request just to be sure it is what you expected.
  6. Click the “Create Pull Request” button.
  7. Type the release number in the title: Build x.x.xx
    1. Check Pantheon dev to see what release number we’re on.
    2. Minor release numbers go to 20 then you start a new major release.
  8. Click the “Create Pull Request” button.
  9. Click the “Merge Pull Request” button.
  10. Go to GitHub Actions, to see the build process run. The build process deploys master to Pantheon dev.

Review on Pantheon#

Once code is on Pantheon, test on dev and test sites before deploying to live.

Make a Backup of Live#

  1. Log in to Pantheon: Pantheon
  2. Click the Live tab.
  3. Click the Backups option from the left menu.
  4. Start a backup. A backup is a good idea before a deploy to live. Start the backup now b/c it may take a while.

Review on Dev#

  1. Log in to Pantheon: Pantheon
  2. Click the Dev tab.
  3. Click the link to visit the dev site.
  4. Verify that the changes from the feature branch are all present and functioning correctly.
  5. If all looks good, click on the Test tab.

Deploy from Dev to Test#

  1. On the Test tab, write a deploy message. Include the build number, like this: "Deploy build x.x.x: Updates to X Y Z."
  2. Make sure all the checkboxes for the deploy are checked: run update.php, clear caches, pull files and database from live.
  3. Click the “deploy code from dev to test” button.
  4. Click the link to visit the test site.
  5. Verify that the changes are all present and behaving correctly.
    1. As you are testing, write down any deploy steps you need to repeat on live.
    2. If all looks good, click on the Live tab.

Deploy from Test to Live#

  1. If all changes look good on test, click the live tab.
  2. Verify that your backup is finished.
  3. Click the “deploy code from test to live” button.
  4. Visit the live site.
  5. Verify the site is up.
  6. Verify that the changes are all present and behaving correctly.
  7. If all looks good, you’re done! If all is NOT good, see “troubleshooting” steps below.

Troubleshooting#

Issues Merging Feature into Develop#

Note, if you run into trouble during the merge, you might have issues with the composer.lock file and the hash in the file. You may not be able to use the Github interface completely because sometimes you have to run “composer update --lock” if there are merge conflicts with composer.

Issues Merging Develop into Master#

Master branch shouldn’t have a build failure, but it is possible.

If the build process fails when you’re on the master branch:

  1. Go to Terminal.
  2. Do pull:
    git pull origin master
  3. Do config import: ddev drush cim OR lando drush cim
  4. Update the lock file: composer update --lock
  5. Make sure hash files are not conflicting.
  6. Fix anything on master that is weird, fix it on master, commit changes, and then push to master.

If you make changes on master, you have to put all changes in develop once everything is fixed:

  1. cd into develop
  2. remerge changes from master into develop: git merge master
  3. Push changes to develop: git push origin develop
  4. Deploy Changes on Pantheon

Config Will Not Import on Pantheon Dev#

When pushing from local to Pantheon Dev, you might run into a scenario where config won't import. This often happens when there are core updates and lines of code are moved around, but not really changed.

  1. Import config.
    1. Try importing config via terminus.
      terminus drush npl-d8.dev -- cim
    2. Try importing config via the UI.
  2. If config changes aren't imported, go to admin/config/development/configuration and click "view differences" next to several of the configurations.
  3. If the left and right side code is the same, but just in different position in the list, re-export config on local and push back up.
    1. Go to local.
    2. On develop, pull code and import config.
      git pull origin develop
      ddev drush cim OR lando drush cim
    3. After import is complete, export config.
      ddev drush cex OR lando drush cex
    4. If there are changes to export, go ahead and commit those.
    5. Push code to origin develop.
      git push origin develop
    6. Check out master and merge deveop.
      git checkout master
      git merge develop
    7. Push code to origin master.
      git push origin master
  4. Go to Pantheon Dev and verify that config is imported on this page: admin/config/development/configuration

Issues Deploying to Live#

"Error: The website encountered an unexpected error. Try again later."

  • This error can happen when configurations aren’t imported.
  • If the site goes unresponsive the only way to interact with it, is using Drush via terminus.

Step-by-Step Fix:

  1. Check if the site schema has been updated as this can cause fatal errors because queries are more or less breaking because it can’t find database tables.
    terminus drush npl-d8.dev -- updb
    terminus drush npl-d8.test -- updb
    terminus drush npl-d8.live -- updb
  2. If that doesn’t work then try reimporting the configuration again.
    terminus drush npl-d8.dev -- cim
    terminus drush npl-d8.test -- cim
    terminus drush npl-d8.live -- cim
  3. After importing you’ll need to clear the cache.
    terminus drush npl-d8.dev -- cr
    terminus drush npl-d8.test -- cr
    terminus drush npl-d8.live -- cr

DDEV will not launch a local development environment#

  1. run docker ps -a
  2. This will list all docker containers.
  3. run docker stop $(docker ps -aq)
  4. This will quit all docker containers.
  5. run docker rm, followed by each listed container number
  6. e.g. docker rm 9c19ae5535ff d05fc97f7731 ec06144d1c03 02ae900eda16 533c286f4556