Site Factory

Deploying code in Site Factory

Code deployments in Site Factory are performed consecutively, instead of concurrently, to minimize the amount of time any single website on your platform is is unavailable to your website visitors. Site Factory manages the deployment process for you, ensuring your code deploys to all your websites as efficiently as possible without intervention by your team. You can track the progress of the process to determine the status of the process.

To protect your websites from inconsistencies being introduced over the course of a deployment, certain website functions are disabled at the beginning of a deployment. These functions are re-enabled only after the entire platform has been safely updated.

During a code deployment, if you discover an error in your updated code, you can pause the deployment while you upload a new revision of the code to provide a hotfix. For more information, see Hotfixing an Site Factory deployment.

How Site Factory deploys code

Site Factory performs the following steps when you deploy code updates to your websites:

Step 1: Preparing for deployment

At the beginning of the deployment process, all of your websites are hosted from your production environment. Before initiating code changes to your platform, Site Factory performs the following administrative tasks to both prepare your platform and protect against overlapping changes:

  1. Record the deployment’s starting time.

  2. Pause any scheduled jobs for this website.

  3. Disable website installation and cloning tasks to prevent data inconsistency. For information about tasks, see Task logs in Site Factory.

  4. Soft-pause any currently-executing tasks, and block new tasks from executing.

  5. Wait for all tasks that are blocking the update to complete.

After Site Factory completes these steps, your websites remain hosted by your production environment, but your environments are protected from changes that could introduce data inconsistencies between environments.

Step 2: Transferring domains to a secondary environment

After the websites on your platform are protected from any changes that could occur during the deployment, Site Factory will perform the following tasks:

  1. Confirm that the deployment does not contain a major version upgrade to Drupal, and that the acsf-init command has been executed to prepare websites for the platform.

  2. Ensure the code deployed on the update environment matches what is currently deployed on the production environment.

  3. Repoint all domain names in use on the production environment to the update environment, freeing up the production environment to be updated while not taking production traffic.

During this step, Site Factory keeps your websites online by shifting your visitor traffic to the update environment, which remains on the previous version control tag. During the time when visitor traffic is temporarily shifted to the update environment, Site Factory updates the now-idle production environment.

Step 3: Updating the production environment while temporarily idle

After Site Factory transfers the domain names for your websites to the update environment, visitor traffic is routed to the update environment, leaving your production environment idle. During the time your normal production environment receives no traffic, Site Factory deploys your new version control tag to it and clears caches.

During this step, your domains remain in your update environment and use the previous version control tag.

Next, Site Factory begins the process of updating individual websites.

Step 4: Updating and redeploying individual websites

At this step of the deployment, your website traffic is served from your update environment, which remains on your previous version control tag. Your production environment has been updated to your new version control tag, but is not yet receiving traffic.

To set the order in which your sites are updated, see Site update priority.

In this step, Site Factory completes the following deployment tasks for each website in your subscription:

  1. Perform a health check to verify that the website can be updated.

  2. Pause any scheduled jobs for this website.

  3. Place the website into maintenance mode, taking it offline.

  4. Perform any needed database updates to the copy of the website on the production environment. For information about modifying these updates with a hook script, see Overriding the Drush updatedb command.

  5. Disable maintenance mode for the website, which returns the website to online status.

  6. Rebuild the website’s caches to improve performance.

    Note

    By default, Site Factory clears Drupal caches using the following commands:

    The above commands clear only Drupal caches and not any other types of caches. To clear other types of caches, such as Varnish or CDNs, you must develop your own custom solutions.

  7. Repoint all domain names for the website from the update environment to the production environment.

  8. Confirm that the domains respond to requests.

After an individual website completes these update steps, the domain names are reattached to the production environment, which contains the new version control tag. All other websites on your Site Factory platform remain in the update environment until they complete the procedures described in this step.

As websites on your platform proceed through this step, they are shifted from your update environment back to your production environment, until all websites are once again live in your production environment. Your update environment, now empty of websites, remains on the old version control tag.

Finally, Site Factory will perform platform cleanup tasks.

Step 5: Cleaning up after updates

After the individual websites have been updated on your production environment, Site Factory will perform the following cleanup tasks for the platform:

  1. Deploy the new version control tag to the now-empty update environment ensuring it matches your production environment.

  2. Resume paused tasks across the platform.

  3. Re-enable website installation and cloning tasks.

  4. Re-enable any scheduled jobs for this website.

  5. Record the deployment’s completion time.

The code deployment process should be complete. If you receive any update error messages on the Site update status page during the deployment, see Resolving codebase update errors for assistance in resolving the errors.

Tracking the progress of a deployment

You can track the status of the deployment on the At a glance section on the Site update status page. To view this page, complete the following steps:

  1. Sign in to the Site Factory environment that you are updating using an account with either the release engineer or developer role.

  2. In the admin menu, click Administration, and then click the Site update status link.

Note

To confirm your platform version number, or to determine if maintenance has completed for your subscription, see Determining your platform version.