Introduction to Pantheon

Pantheon Logo

What is Pantheon?

Let’s say we are a software development, web solutions and/or digital marketing agency and we are experts in two of the most popular CMS in the world, Drupal and Wordpress. We need a hosting provider fast, reliable, secure and simple to maximize the value of our websites and therefore our business. That is exactly what Pantheon is.

Pantheon is a specialized Hosting and WebOps platform designed to host websites developed with Drupal and Wordpress CMS. It is designed for both private and business use, so it offers us a very reliable level of security, a scalable infrastructure and a very fast content delivery network. Likewise, it provides the operator of the system with an agile and simple workflow to carry out all the WebOps tasks in the installation, deployment and maintenance of the websites, as we will see below.

Key features and workflow

Pantheon's features and functionalities are numerous, thanks to the versatility and flexibility of the platform. Here we will see Pantheon's workflow and the main features.

Sites and environments

Pantheon is structured in sites and environments, that is, each account (particular or organization) has certain websites that are hosted under a single management interface. Also, each website has three environments, where the website is installed but in its different versions:

  • DEV: is the environment where developments are uploaded and has a unique Github repository. This environment would correspond to the continuous integration environment in the classic development ecosystem.
  • TEST: is the environment intended to be a copy of the production environment, where developments and changes are tested. It would correspond to the pre-production environment.
  • LIVE: is the open and accessible environment for any user, or in other words, the production environment.

There is also the Multidev mode, which allows to create different development environments independently, including database and files, so that later the code changes in the master are merged.

Development workflow

We can summarize the development workflow in two parts: deployment of code developments and cloning environments.

Deployment of code developments

Each Pantheon website has a unique Github repository. This repository is connected to the DEV environment and we can clone it to work on developments, so that when we develop, we can upload changes to it which will be seen in the DEV environment.

Once the changes are applied in the DEV environment they will be available to be applied in the TEST environment. In the same way, when they are in TEST they will be available to be applied in LIVE, thus completing the development workflow.

There is also the 'custom upstream', which consists of synchronization with an external Github repository connected to one or more sites in the organization, so that when we upload a change to it, that change will be available to be included in the websites' DEV environment.

Pantheon also allows us to upload changes through SFTP, as well as to connect through this protocol to the different environments of each site.

Pantheon Interface

Cloning environments

With a single click, Pantheon allows you to clone both the database and the multimedia files between environments. This operation is mainly intended to update the contents in the direction LIVE -> TEST -> DEV to have all the environments synchronized and to be able to work on the developments with the most updated information possible.

Pantheon - Cloning environments

We can summarize the development workflow through the following infographic:

Pantheon - Summary infographic


Pantheon has a backup management system through which we can make backups of each environment of the different sites, either manually or through a programmed task.

Pantheon Backups


Based on my experience of working with Pantheon, I found it convenient to dedicate a section exclusively to Terminus.

Terminus is a command line tool provided by Pantheon, which serves to perform practically all the operations that can be performed on websites and their different environments in Pantheon. Among the main characteristics are:

  • Create a new site
  • Create and delete Multidev environments
  • Clone one environment to another
  • Check for and apply upstream updates
  • Deploy code from one environment to another
  • Run Drush and WP-CLI commands

Its installation is very simple with Composer:

composer require pantheon-systems/terminus

AunqueAlso there are several methods to install it on the systems it supports, that is macOS, Linux and Windows, and that we can find in the installation docs.

To mention a couple of practical examples of its use, if I want to clean the Drupal cache of a specific environment of a website, it would be enough to write in a terminal:

terminus remote:drush <site>.<env> -- cr

Or if we want to automate a process that involves many operations on the website, you could create a bash script full of Terminus commands that perform them, as we will see in the next section.

Automation in Pantheon

Another of Pantheon's outstanding features is its power to automate tasks. Although at Pantheon we can do almost everything from the management interface of the platform, the automation of tasks allows many necessary operations in the workflow to be performed more quickly and easily, while minimizing the propensity for errors that comes with performing them manually.

To highlight some of the mechanisms that Pantheon has for this purpose, we have the following:

Pantheon and Quicksilver YML configuration files

These types of files, which are versioned in our repository and may be different for each environment, allow you to configure static options, such as the version of PHP, and dynamic actions, through integration with Quicksilver Platform Hooks, as actions to be performed when running a particular workflow.

For example, configuring the file pantheon.upstream.yml like this:

php_version: 7.3

     - type: webphp
       description: Install drupal with the Drupalera profile after installation
       script: web/private/scripts/site_install.php

In this case when we install a site for the first time, it will be created with PHP version 7.3. Also, as we have used the hook of Quicksilver 'deploy_product', after the installation will run the file site_install.php with the code that we have previously defined in it.

Terminus and bash scripting

Another way to automate tasks in Pantheon and make a workflow easier and more efficient is the implementation of scripts in bash with Terminus commands, especially if they are repetitive tasks or always do the same job.

Let's see it with an example; if we want to make a backup for all the sites in our organization, we can implement the following script, which will do it automatically and easily:


# Exit on error
set -e

# Stash org UUID

# Stash list of all Pantheon sites in the org
PANTHEON_SITES="$(terminus org:site:list -n ${ORG_UUID} --format=list --field=Name)"

# Loop through each site in the list
while read -r PANTHEON_SITE_NAME; do
    # Check if the site is frozen
    IS_FROZEN="$(terminus site:info $PANTHEON_SITE_NAME --field=frozen)"

    # If the site is frozen
    if [[ "1" == "${IS_FROZEN}" ]]
        # Then skip it
        echo -e "Skipping a backup of the site '$PANTHEON_SITE_NAME' because it is frozen...\n"
        # Otherwise create a backup of the live environment of the site
        echo -e "Creating a backup of the live environment for the site '$PANTHEON_SITE_NAME'...\n"
        terminus backup:create $
done <<< "$PANTHEON_SITES"

La Drupalera and Pantheon

From La Drupalera we can bring the experience of having worked with a large agency for the migration to Drupal on Pantheon of multiple brand sites, with very positive results in all respects, both at the level of infrastructure, as process flow and performance of the sites in general.

In La Drupalera, Pantheon's features and functionalities have given us support for the automation of processes, both in the continuous work of development, as in the processes of deployment between environments and their subsequent maintenance. Through the development of our own scripts and Pantheon's own management ecosystem, we have managed to automate these processes, which has resulted in the minimization of errors and to be able to have totally controlled and updated the multiple sites that we have developed and maintain in parallel, in an orderly, simple and effective way.