Andrew Taylor, Former Developer Programs Engineer Reading estimate: 2 minutes
Clone Your Site with a New Terminus Plugin
Have you ever needed to quickly clone a site? With our 1.0 release of our Terminus Site Clone Plugin, copying the code/database/files from one Pantheon site to another is just a single Terminus command away. To get started, you can find the plugin on GitHub at pantheon-systems/terminus-site-clone-plugin. If you want to know the backstory and some use cases, read on.
Background
Recently, Pantheon’s developer relations team has been working on Pantheon for Trainers. As part of my new role as Developer Programs Engineer, which is more code-focused, I was asked to support this initiative by developing a script to allow us to quickly and easily create free Pantheon sandbox sites in bulk for trainers to use for their students. Site creation is simple with Terminus, our command line interface.
However, we wanted to give trainers a way to set up a demo site that could be cloned in its entirety for students. This way, students start with example content, properly configured settings, etc. rather than a fresh CMS installation.
Since there wasn't an existing, automated way to clone from one site to another—as you can do from environment to environment within a site—I decided to write a Terminus plugin to accomplish this. For those who don’t know, Terminus plugins allow you to easily extend Terminus’ functionality to accomplish more advanced use cases, such as site cloning!
Why Not Custom Upstreams?
Pantheon's Custom Upstream product is great for managing shared code between multiple sites, but isn't a great fit for a one-time starting point you can hack on. For example, if you use a hackable starter theme, such as Underscores for WordPress, in a custom upstream, there will be merge conflicts when the theme changes on the child sites. Custom upstreams are great for the shared, maintained code use case, but not for starter sites.
Starter Sites: The Killer Use Case
There are a lot of use cases for the functionality of copying code, database, and/or files from one Pantheon site to another. The one that sticks out most to me is a ‘starter site’. When I was doing agency work, we would often create some example content, have placeholder images, and set up configuration for new projects over and over.
For example, with the Terminus site clone plugin, you can keep a starter site with a hackable starter theme, demo content, media files, and default settings. Then, whenever you need to start a new project, you can simply clone the starter site to a newly created Pantheon site and begin from there.
Another great way to use starter sites is for demos. I often demo Pantheon, and now I can simply clone a demo site and make customizations, such as adding a client's logo, without affecting the original. After I give the demo I can just throw away the cloned fork.
What will you use the Terminus site clone plugin for? Let us know in the comments. If you have feedback or issues using the plugin, please post them in the project GitHub issue queue.
Topics
Discover More
America’s Underground Lab: a Research Website Creation Story
Yulia Popova
Reading estimate: 3 minutes
Pantheon and Tag1 to Provide Free Long-Term Support for Drupal 7 Websites
Chris Yates
Reading estimate: 2 minutes
Election Year Dynamics: What They Mean for Government Web Development
Yulia Popova
Reading estimate: 4 minutes