Using Pantheon

The first ever Midwest Developer Summit is going to be held July 26 and 27, and I have been trying to help get it organized. We needed a web site, and I agreed to build it and Pantheon offered to host it for us. I've toyed around with Pantheon a bit since they first launched, but hadn't tried to build a real site and take it live. And I thought it would be interesting to use this as an opportunity to put Pantheon through its paces.

The Pantheon team has put a lot of thought into their product and I was very impressed. So impressed that once I got the Developer Summit site up I turned around and launched another personal site on Pantheon, taking screen shots as I went so I could share the experience in this article.

Get a Pantheon Account

Step one is to set up a Pantheon account. This part is free. In fact you don't have to pay anything until you get to the point of adding in a custom domain. So you can spin up a site just to see how things work, or import an existing site to see how the process differs from whatever you do now.

Once you have an account you will see that you have a dashboard that lets you see how many sites you are able to manage. The ones you already created will show up with a screenshot of the home page, and the unused ones will have a link you can use to add a new site.















Pantheon Control Panel-2.jpg

Notice that there is a link that will download a Drush alias file for all your sites. Drop that file in the same place you have installed Drush and site aliases for all your Pantheon sites are available. With that you can remotely manage your Pantheon account from a local installation using Drush commands. A really nice benefit!

Create a New Site

When you click on the link to create a new site, you are prompted to give it a name, then wait while it is prepared.















Spin Up a Site | Pantheon Control Panel-2.jpg

Next you see a place to indicate what to use as the source of the site. You have an option to create a new Drupal site, use a Drupal Distribution, or import an existing site.















Create or Import a Site | Pantheon Control Panel-6.jpg

The available choices to create a brand new site are Drupal 6, Drupal 7, or even Drupal 8 (for those core developers who might be working on Drupal 8). If you want to build a site from a distribution, you can. The distributions available currently include things like OpenPublic by Phase2 Technology and Open Enterprise by LevelTen Interactive.

If you want to import an existing site, you can provide links to zip files that contain the code, files, and a database dump of the existing site.















Create or Import a Site | Pantheon Control Panel-10.jpg

I had some questions about exactly how to prepare those files for Pantheon. The database dump is self-explanatory. If you are using the Backup and Migrate module, a backup created by that works just fine.

The code includes everything in your Drupal folder except your files directory. So I made a copy of my root Drupal folder, copied the file directory (site/default/files) out of that to a separate file, and then compressed the code (without the files), and the files, each to their own zip file.

I also was unclear what to do about the settings.php file. It contains database credentials which are not going to be correct in the new environment anyway. This file is going to end up in the git repository, so I removed the database credentials and left the rest of settings.php alone. And that worked fine.

You need to put these files in a web-accessible location, and I used my Dropbox account. You have an opportunity to upload all three of these files at once, but only the codebase is required. After problems loading several large files at once, I changed my methods and started loading only the codebase in the first step. You can upload the files and database later, after the site is created. And I felt like that reduced the chances of problems.

Dashboard

Once you have uploaded your code you will get a dashboard for your new site. You can see a number of interesting things about this dashboard.















Midwest Developer Summit Dashboard | Pantheon Control Panel_0.jpg

First, you can see that you get not one, but three sites, a 'development', a 'test', and a 'live' site. Your initial code goes into the 'development' site. The system is designed to allow you to make changes in 'development', move the code to 'test' to confirm that things are working right, and then ultimately move it to 'live', i.e. the standard workflow for a Drupal site.

You can see buttons on the right that let you populate the database either by uploading a tarball or by synching from either the 'test' or 'live' site. This is where you can now upload the database if it wasn't done in the initial import. Later you can use that to sync the live database back into the 'development' site so you can test your new code against the latest content.

Similarly you have a button that allows you to populate the files directory, either by upload or by synching from 'test' or 'live'.

Other things you can do are control whether your site is public or private (hidden unless someone provides a specified username and password).

You can also clear the Varnish cache, check error logs, and make backups from the dashboard. And the button labeled "On Server Development" allows you to manage your site using sftp instead of git.

Another nice feature is a list showing the most recent git commits, with tags that indicate which environments they have been pulled into. Git commits initially show up in 'development'. After you add new code into 'development', you will see a button on 'test' and 'live' to pull that code into those environments.

Finally, you have a place where you can identify a custom domain name for the site instead of 'dev.MYSITENAME.gotpantheon.com'. As noted earlier, this step requires payment. Everything else seems to be available without payment.















Midwest Developer Summit Dashboard | Pantheon Control Panel-1_0.jpg

If you want to export the site you created, use the dashboard to export the code, database, and files. If you make a mistake while trying to create a new site, or just want to get rid of a site you were playing around with, click the 'Configure' tab on the dashboard, where you will see an option to delete your site. The 'Configure' section also provides a place where you can give other Pantheon users access to this site by adding them as 'Team' members.















Midwest Developer Summit Dashboard | Pantheon Control Panel-1.jpg

Search, Performance, and Advanced Configuration

A really nice thing about Pantheon is that it includes lots of tools that make Drupal run better. Varnish, Redis (an alternative to Memcache), and Apachesolr are all available. Hosts not optimized for Drupal won't have these, and it's nice not to have to set it all up manually. Pantheon provides documentation about how to tweak these tools (see links at the bottom of this article).

Performance has been great. That personal site I moved to Pantheon had gotten ridiculously slow in its former location and I didn't really have time to figure out what needed to be done to make it perform better. I moved it to Pantheon and it is serving up pages significantly faster than before, and that was without doing anything at all to tweak any of Pantheon's settings. I just imported the site as-is and saw an immediate improvement.

One thing you don't get with Pantheon is direct SSH access to the server. But between the dashboard tools they provide and the ability to use Drush locally to manipulate my code, database, and files using the Drush aliases, I didn't have any need for more.

Conclusion

Overall, my conclusion is that Pantheon is a very slick solution for people who want a fair bit of control over their Drupal code and site, but are happy to let someone else make sure the server is set up correctly and optimized to run Drupal.

More Information

Some helpful articles from the Pantheon site include:

Get in touch with us

Tell us about your project or drop us a line. We'd love to hear from you!