---
title: "Performing a production deployment"
date: "2024-02-14T06:18:38+00:00"
summary: "Learn how to deploy code to production websites in Acquia Site Factory. Follow step-by-step instructions for preparing, executing, and cleaning up after a successful deployment, ensuring a smooth transition for your web projects."
image:
type: "page"
url: "/site-factory/performing-production-deployment"
id: "0a05d629-20d7-4706-9415-cabd3036dc5b"
---

After you have finished [testing the release branch](/site-factory/workflow/staging) 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.

1.  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]
    
2.  Merge the release branch back into the master branch.
    1.  Create a `RELEASE.txt` file in the `sites/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
        
    2.  Commit the changes to the `RELEASE.txt` file, replacing `[version]` with version-specific information:
        
            git commit -m "Updated RELEASE.txt for [version]"
        
    3.  Switch to the master branch.
        
            git checkout master git pull origin master
        
    4.  Merge the release branch into the master branch, replacing `[RC]` with the name of your branch:
        
            git merge --no-ff [RC]
        
3.  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 and `20190210` 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:

1.  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**
        1.  [Sign in to the Cloud Platform user interface](https://cloud.acquia.com).
        2.  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](../../manage/users/admin/release-engineer.html) role.
            
    *   **Site Factory**
        1.  [Sign in](/site-factory/login) to your _Prod_ environment’s Site Factory Management Console using an account with the [release engineer](/site-factory/manage/users/admin/release-engineer) role.
        2.  In the admin menu, click **Administration**, and then click the **Update code** link.
2.  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](http://us1.php.net/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
3.  In the **Stack** section, select the Site Factory stack to update.
4.  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](#acsf-prepare-deployment) section.
5.  After you select your tag, select the same option you selected during the [staging deployment process](/site-factory/workflow/staging#acsf-copy-data-nonprod).
6.  Select whether you want sites to remain in maintenance mode in the event of a failure.
7.  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](/site-factory/workflow/deployments/hotfix).

For more information about resolving update errors reported on the **Site update status** page, see [Resolving codebase update errors](/site-factory/workflow/deployments/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](#acsf-caches-release)
*   [Removing unneeded branches from version control](#acsf-remove-branches)

### 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](https://docs.acquia.com/site-factory/site-factory-api#operation/post_Sites_clearCaches).

### 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]