Skip to main content
Last Reviewed: December 12, 2022

Upgrade the Code


  1. From the local Drupal site's directory, use Terminus to retrieve the existing site's Git URL:

    terminus connection:info $D8_SITE.dev --field=git_url
  2. Add the existing site as a remote repository called existing. Use the URL retrieved in the previous step:

    git remote add existing ssh://[email protected]:2222/~/repository.git
    git fetch existing
  3. Copy over exported configuration from the original site. From your Drupal site, run the following commands:

    This is a common location for the config file; if this isn't where your config file is located, replace 'config' with the full path, such as web/sites/default/config.

    git checkout existing-8/master -- config
    git mv config/* config/
    git commit -m "Add site configuration."
  4. Compare your current pantheon.yml file with the new drupal pantheon.upstream.yml:

    git diff existing-8/master:pantheon.yml pantheon.upstream.yml
  5. If you have customizations in your existing site's pantheon.yml that you want to keep for Drupal (e.g., a Quicksilver script or site-specific protected web paths), copy pantheon.yml over:

    git checkout existing-8/master -- pantheon.yml
    git commit -m "Update pantheon.yml."
  6. Copy over any Quicksilver scripts referenced in pantheon.yml:

    git checkout existing-8/master -- private/scripts
    git commit -m "Add Quicksilver scripts."
  7. List contrib modules and themes on your existing site:

    terminus drush $D8_SITE.dev pm:projectinfo -- --fields=name,version --format=table

    The command pm:projectinfo assumes Drush 8. If you encounter an issue with this command, verify and configure the Drush version before you continue.

  8. Use Composer on your new site to add these there:

    composer require drupal/ctools:^3.4 drupal/redirect:^1.6 drupal/token:^1.7
    git add composer.*
    git commit -m "Add contrib projects."
  9. Copy over any custom modules or themes from your existing site:

    git checkout master modules/custom
    git mv modules/custom web/modules/
    git commit -m "Copy custom modules"
  10. Check settings.php for any customizations to copy over:

    git status # Ensure working tree is clean
    git show master:sites/default/settings.php > web/sites/default/original-settings.php
    diff -Nup --ignore-all-space web/sites/default/settings.php web/sites/default/original-settings.php
    # edit web/sites/default/settings.php and commit as needed
    rm web/sites/default/original-settings.php
  11. Copy your files and database from your existing site to the new site:

    terminus site:clone $D8_SITE.live $DRUPAL_SITE.dev --no-code --no-destination-backup --no-source-backup
    Info:
    Note

    The Site Clone plugin must be installed to use the terminus site:clone command. Visit https://github.com/pantheon-systems/terminus-site-clone-plugin for details on installing the Site Clone plugin.

  12. Push the new codebase from your local machine up to Pantheon:

    terminus connection:set $DRUPAL_SITE.dev git
    git push origin master
  13. Run database updates:

    terminus drush $DRUPAL_SITE.dev -- updatedb