After you have finished testing the release branch across a representative group of websites in your staging environment, you can deploy the completed features to your production websites.
Preparing for the code deployment
Use the commands in the following steps to prepare to deploy your code to your production websites.
Ensure you’re using the release branch you tested with your staged websites, replacing
[RC]
with the name of your release branch:git checkout [RC]
- Merge the release branch back into the master branch.
Create a
RELEASE.txt
file in thesites/all
folder (or edit the file if it already exists) and note the feature branches you’ve merged into the release branch.If you have not yet created the
RELEASE.txt
file, use the following command to do so:git add docroot/sites/all/RELEASE.txt
Commit the changes to the
RELEASE.txt
file, replacing[version]
with version-specific information:git commit -m "Updated RELEASE.txt for [version]"
Switch to the master branch.
git checkout master git pull origin master
Merge the release branch into the master branch, replacing
[RC]
with the name of your branch:git merge --no-ff [RC]
Create a tag on the master branch referencing the release branch merge (replacing
[version]
with your version number, and[message]
with an explanatory message), and then push the changes to the code repository.git tag -a [version] -m [message] git push origin master git push origin --tags
Important
Always deploy a tag—not
master
or a different branch. Code changes made to a deployed branch deploy to production within minutes. Acquia discourages using a deployed branch as a method to push code commits into production while bypassing the deployment process, as errors with code check-ins will immediately impact production, potentially causing downtime or data loss for your production websites.When creating tags, use version numbers to describe the contents of the release branch, its release date, or both. For example, the following naming scheme uses
2.71
for the Site Factory version and20190210
for the date of release:2.71.20190210.distro
Deploying your code
After you create a new tag in your master branch, update your production websites to use the tag by using the following steps:
- Visit the Site update page on your Prod environment’s Factory server. Complete the following steps based on your current signed-in location:
- Cloud Platform
- Sign in to the Cloud Platform user interface.
Select your application and the Prod environment, and then click the Update code link.
If you’re not already signed in to your Site Factory Prod environment, Cloud Platform will redirect you to a sign-in page. Sign in using an account with the release engineer role.
- Site Factory
- Sign in to your Prod environment’s Site Factory Management Console using an account with the release engineer role.
- In the admin menu, click Administration, and then click the Update code link.
- Cloud Platform
- In the Start time section, select from the following options to control when Site Factory will start the code update process:
- Immediately: Starts the code update process when you click Update.
- At a specific time: Starts the code update process at a specific time, based on the GMT time zone. In the Time field that displays, enter a time using the strtotime format, which can include specific or relative values like the following examples:
- Date and time:
Mon Feb 24 13:28:38 2018
- 13:28:38 GMT on February 24, 2018 - Unix timestamp:
@1519478918
- 13:28:38 GMT on February 24, 2018 - Relative time:
5 hours
- Five hours from the current time
- Date and time:
- In the Stack section, select the Site Factory stack to update.
- In the Site update action section, in the Choose a path to deploy list, click the tag you created in the Preparing for the code deployment section.
- After you select your tag, select the same option you selected during the staging deployment process.
- Select whether you want sites to remain in maintenance mode in the event of a failure.
- After you select the appropriate checkbox to confirm you’re aware that you’re updating your production environment, click Update.
Site Factory begins the update process, and updates all production websites with the code from the specified tag.
You can track the status of the update on the At a glance section on the Site update status page.
If you determine your code update contains an error affecting your websites, you can pause the code update process and upload revised code to help resolve the issue. For more information, see Hotfixing an Site Factory deployment.
For more information about resolving update errors reported on the Site update status page, see Resolving codebase update errors.
Cleaning up your environment
After you complete a release, you must perform the following cleanup tasks on your environment:
Clearing caches after a release
A final step of the deployment process must include clearing caches, by using the Site Factory API instead of Drush commands or the Cloud Platform interface—the Site Factory API provides fail-safe logic to prevent concurrent execution of cache-rebuilding tasks. For information about the cache clearing process, see the documentation for the cache-clear
Site Factory API endpoint.
Removing unneeded branches from version control
After a release, remove unneeded branches to reduce the size of your code repository. To remove a branch, run the following command for each feature branch you want to delete, replacing [feature_branch]
with the name of the branch:
git branch -d [feature_branch]
Run the following command to remove the now unneeded release branch, replacing [release_branch]
with the name of your release branch.
git branch -d [release_branch]