Migrating to Pantheon

Things to ask before you begin

See /wiki/spaces/KALA/pages/627933245 article for things to look out for when migrating websites to Pantheon.

Create the pantheon site (and set proper upstream)

The first step is to create a new site on Pantheon, or to have the client create it if they have an account and want to be the owner from the beginning.

If the client wants to use the standard drop-8 upstream for easy upgrading, you will need to collapse the Acquia file structure down so there is not a nested docroot.

If the client is sticking with a composer build, you can keep the nested docroot, and can create the site without an upstream: Creating a Pantheon website with no defined upstream

If sticking with the nested docroot, you should rename the docroot directory to web, since that is what pantheon expects. Add a symlink from docroot to web to account for any composer config that includes the docroot path.

Do whatever it takes to get the old code in the new repository. (and maybe add more details here)

Set up the pantheon.yml file

We need to add a pantheon.yml file to configure the environment to match what it was at acquia. 

pantheon.yml
# Put overrides to your pantheon.upstream.yml file here.
# For more information, see: https://pantheon.io/docs/pantheon-yml/
api_version: 1
php_version: 7.1
drush_version: 8
web_docroot: true

The api_version line is standard. You can use drush status to get the php and drush versions of the current acquia site. If you are sticking with the nested web root, we need to add the web_docroot line.

Available php versions are at: https://pantheon.io/docs/php-versions/

Available drush versions are at: https://pantheon.io/docs/drush-versions/#configure-drush-version

Sync the files directory

You can use these instructions for Manually transferring drupal files with rsync.

You can ssh into the aquaia server to find the remote files directory, which should be something like: /mnt/gfs/home/SITENAME/ENV/sites/default/files, and rsync all of the files down.

rsync -razv--exclude=css --exclude=*_cache --exclude=js --exclude=googleanalytics --exclude=xmlsitemap --exclude=backup_migrate --exclude=styles SITENAME.ENV@ded-XXXX.ENV.hosting.acquia.com:/mnt/gfs/home/SITENAME/ENV/sites/default/files/ /path/to/local/files/

NOTE: You may need to rsync directly from the prod site. It seems that when you move files between prod and dev in the acquia control panel, it doesn't delete files from dev, leading to a bunch of orphans. Or you could delete the 

Make sure you get both the files directory and the adjacent files-private directory, if anything is in there.

Then you upload the files to the pantheon dev site:

rsync -razv /path/to/local/files/ --ipv4 -e 'ssh -p 2222' dev.XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX@appserver.dev.XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.drush.in:files

NOTE: The rsync process to pantheon is fairly slow and prone to disconnecting, so you can use the --append flag to just upload files that are not already there, so you are not transferring the same ones again and again.

NOTE: The pantheon storage doesn't actually seem to preserve times when rsyncing, so if you are rsyncing against a previously uploaded files directory, you should use use --size-only flag to ignore the dates and see what changes based on file size.

Set up config directory

Since we are using a nested web root, the config directory can be in the root code directory, and not in the pantheon default of sites/default/config. Add the following to settings.php.

settings.php
/**
 * Use config sync directory in the code root.
 */
if (isset($_ENV['PANTHEON_ENVIRONMENT'])) {
  $config_directories = array(
    CONFIG_SYNC_DIRECTORY => $_SERVER['HOME'] .'/code/config/default',
  );
}

APC, redis, and solr

The pantheon_advanced_page_cache module should be installed. There is no configuration, it just starts working when enabled.

Follow the instructions to set up redis at: https://pantheon.io/docs/redis/

Remove Acquia modules

The acquia connector and acquia search modules should be uninstalled after db import. When you are sure that there will be no re-import of the db, you can also remove the two modules from the git repository.

Protect default drupal files

You can add lines to the pantheon.yml files to keep files such as /core/CHANGELOG.txt from being visible.

Set up domain redirects

At a minimum, you will want to redirect any non-https traffic to the https version of the site, so follow the instructions at: https://pantheon.io/docs/redirects/

Before launch, you don't want to redirect the pantheon placeholder domain to the main domain that is at aquia, so add a condition to the live environment if statement:

  if ($_ENV['PANTHEON_ENVIRONMENT'] === 'live' && $_SERVER['HTTP_HOST'] != 'live-SITE-NAME.pantheonsite.io') {

After the site is launched, you can remove that second condition so that the pantheon platform address gets forwarded to the primary domain.

Domains

Look in the acquia site for the domains that are linked to their current site, and recreate any needed ones on the pantheon side.

The https certificates need to be pre-provisioned before the dns cutover to prevent an hour or so of non-secure warning. This involves uploading some verification files to acquia.

Load Testing

Pantheon likes to do load testing on the production environment before the domain switchover, so let them know that they can do that when things are ready.