Below is a "brief" guide that introduces you to Pantheon.
I encourage your developer to read the Pantheon Documentation, as it's rather comprehensive. Pantheon is not a traditional shared web hosting service, so there is a bit of a learning curve.
- Pantheon Documentation
- Quick Start
- Get Started
- Develop
- Go Live
- Explore Platform Architecture
- Automate & Integrate
- Quick Guides List
In order to access the hosting environment for the website, you will need an account for your develper on our hosting platform: Pantheon.
- We will need to create a developer account for you in order to access the hosting database. If your developer doesn't have one yet, please contact us. We will send an invite.
- You will need to create a SSH Key if you haven't done so already and add it to your Pantheon account profile in order to connect to the website via Git or SFTP.
Once your account is created, you will have full adminstrative control of the website.
Pantheon is unlike a traditional web host in that it isn't a shared hosting platform. It's more akin to what you'd find on Github. Each Pantheon website consists of a Development
, Test
, and Live
branch of the website. Each of these branches has an entirely isolated filesystem and database. So don't think of them as being connected, but rather clones of each other.
The Pantheon workflow is also rather unique, as you are unable to write to new or existing files on the Test
or Live
branches of the website. This means that you can't upload plugins or make changes to template or theme files directly on the Live
site. You'll notice this is reflected in the Wordpress Dashboard, as certain options are removed, such as the Theme Editor
, or the Add New Plugin
button. However, once you switch to the Dev
branch, you'll notice all of these options are back in place where you'd expect them. Wordpress websites on Pantheon have custom plugins running in the background that help accomplish features like this.
Most of the time, people will be working on the Live
branch of the website. This is the branch of the website that external users visit, and it is also the branch that all the developer/staff/users log in to in order to add and edit new content. The Test
and Dev
branches are used only for your developer. Here are the URLs for the dashboard and branches:
- Pantheon Dashboard
- Dev Branch Exmaple:
dev-websitename.pantheonsite.io
- Test Branch Exmaple:
test-websitename.pantheonsite.io
- Live Branch Exmaple:
www.websitename.com
websitename
will be replaced with the name of your website, and is used as a placeholder in this documentation.
The first and most important thing to understand about Pantheon is that each branch is using its own isolated database and file system. That means that every time you're about to add new plugins or upgrade Wordpress in Dev
, you need to clone a fresh copy of the database from the Live
branch of the website to overwrite the existing Dev
database and files. This is because as users are adding new content or interacting with the Live
site, the Dev
database stays frozen in time and falls further and further behind.
In order to do this, make sure you're on the Dev
tab in the dashboard:
- Click the
Database / Files
tab on the left hand side. - The
From This Environment
dropdown needs to be set toLive
. - Always leave
Clone Database
andClone Files
checked. In this case,Files
refers to the media library of Wordpress, not theme or plugin files. - The
From
tab needs to be set towww.websitename.com
and notwebsitename.com
orlive-websitename.pantheonsite.io
. It is important to include thatwww.
prefix. This is the most crucial and important step of the entire process. This is because Wordpress has hardcoded URLs in the database, and since you're copying from theLive
site, those URLs are written aswww.website.com
instead ofdev-websitename.pantheonsite.io
. Essentially this operation scans the entire database for instances ofwww.websitename.com
and rewrites them intodev-websitename.pantheonsite.io
. - The
To
tab can still be left alone as it only has one option. - The
Convert URLs Protocol to
dropdown should be left as-is (no conversion). - Once all the options are set, click
Clone the Database and the Files from Live into the Development Environment
.
This may take 30s-1min to work. If you click the Workflows
button near the top right of the screen, you can see progress bars for this operation. Once it is complete, you have the most up-to-date copy of the Live
site cloned to the Dev
branch. The sites should look and operate identically if this was done correctly.
At this point, you can upload new plugins to the site via SFTP. Or you can add them directly through the Plugins tab in the Wordpress dashboard. Once you've added or edited new files, they will show up under the Code
tab under the Dev
branch. You will need to make a commit message, and the commit these files.
Or if you prefer, you can clone the site using Git (always run a git pull
before starting new work or adding new files to ensure your local clone has the latest files downloaded). Once you're done, just commit and push the files to master.
Whenever Wordpress has a version update, or Pantheon updates some code for the server (such as the PHP version), these will need to be applied in the Dev
branch.
The site must be in Git mode in order to apply these updates. We recommend following the steps above to clone the latest database and files from the Live
site, committing any plugin/file changes you're working on, and then switching the site to Git
mode and applying those updates. Make sure Auto-resolve conflicts. This attempts to automatically resolve conflicts in favor of the upstream Git repository. If you are not patching core, this is safe to use.
is checked when you do this.
Once all your file edits are complete and committed, you're ready to clone the files and database from Dev
->Test
->Live
.
A crucial concept to understand is that we need to move the database and files from Dev
->Test
->Live
once we're finished committing our changes in the Dev
branch.
This is because some plugin or Wordpress updates modify the database. For example: If you've enabled a plugin in Dev
and then configured it, it stores those configuration changes in the Dev
database. If you were to only push your file changes from Dev
->Test
->Live
, the Live
branch would have the new files, but would still be running on its own isolated version of its database, so none of those configuration changes would be included.
A separate issue is that any content or changes that have been made on the Live
branch while you've been working on Dev
will be overwritten when you clone Dev
->Test
->Live
. This is why we typically add and configure new plugins to the site during off hours late at night or early in the morning when no other users are logged into the site making changes.
Now that you understand these gotchas, you can begin the process of cloning your changes up to Live
:
- First, click the
Test
tab at the top. - If you committed your files correctly in
Dev
, you should see a yellow deploy box available to deploy under theDeploys
tab. This deploy is the culmination of all your individual commits from theDev
branch. - Leave the
Pull files and the database from the Live environment?
box unchecked. - Enter a message summarizing the changes you made under the
Deploy Log Message:
box. - Once you hit
Deploy Code from Development to Test Environment
all of your code changes will be copied fromDev
to theTest
branch. - Now, click on the
Database / Files
tab on the left. From this Environment:
should be set toDevelopment
.- Leave
Clone Database
andClone Files
checked. - All other settings can be left as-is, except you'll want to check
Clear Caches
at the bottom. - Click
Clone the Database & the Files from Development into the Test Environment
.
After following these steps, you've essentially cloned Dev
into Test
perfectly. It now is using all the file changes you made in Dev
, and the database has been copied and converted as well. You can check the Test
website and ensure your changes worked correctly.
Finally, you're ready to do a similar set of steps on the Live
branch:
- First, click the
Live
tab at the top. - If you've deployed your files correctly in
Test
, you should see a yellow deploy box available under theDeploys
tab. - Enter a message summarizing the changes you made under the
Deploy Log Message:
box. - Once you hit
Deploy Code from Test to Live Environment
, all of your code changes will be copied fromTest
to theLive
branch. - Now, click on the
Database / Files
tab on the left. From this Environment:
should be set toDevelopment
. Note that we are not using theTest
database, we just clone fromDev
again.- Leave
Clone Database
andClone Files
checked. - Leave the
From
box as-is. - Make sure to change the
To:
box towww.websitename.com
. This is an extremely important step. If you forget to do this, all the URLs in the database on theLive
site will still bedev-websitename.pantheonsite.io
instead of the correctwww.websitename.com
URLs. It is crucial to include thewww.
prefix. - For the
Convert URLs' Protocol to:
box just leave it as-is (no conversion). - Check
Clear Caches
at the bottom. - Click
Clone the Database & the Files from Development into the Live Environment
. - Finally, a warning box will appear. You'll need to type
CLONE
into it for it to work. This is warning you that any changes that have occurred in the Live database will be overwritten by theDev
database. This all comes down to timing. You want to add your plugins and updates in the evenings or early mornings before users or staff are modifying theLive
website. You don't want to work inDev
for days or even hours at a time. Make your changes, and copy the database quickly so that you aren't overwriting content or edits that have been made by users while you were busy inDev
.