pantheon-systems / terminus-site-clone-plugin

A Terminus plugin that adds the `site:clone` command to facilitate cloning sites on Pantheon
MIT License
21 stars 11 forks source link

Clone successful, but no database #5

Closed mtprell closed 6 years ago

mtprell commented 6 years ago

I've installed the plugin and run the basic script. The site cloned successfully although the source database was not installed. Is there an argument for that, or should I be importing the db manually (my test db was only about 2MB)?

ataylorme commented 6 years ago

Hi @mtprell,

The site cloned successfully although the source database was not installed.

I am not clear on this part. Did your source site not have the CMS installed?

If you want to try a database clone again, without code or media files, you can run terminus site:clone <source.env> <destination.env> --no-code --no-files.

Please also make sure you have the latest source downloaded as we fixed a bug recently.

mtprell commented 6 years ago

Sorry if that wasn't clear. What I meant was that the source site database was not cloned to the destination site.

I downloaded the latest source, and tried the db-only option, but got the following error:

Fatal error: Uncaught Error: Class 'Pantheon\TerminusSiteClone\Commands\TerminusNotFoundException' not found in /Users/prell/.terminus/plugins/terminus-site-clone-plugin/src/Commands/SiteCloneCommand.php:189

I then tried cloning a different site, with the same result: the source db is not copied to the destination.

Looking through the status messages I get from terminus, I see no mention of the db other than the initial backup of the destination code, database and media files, although there are messages for code and media files successfully importing.

ataylorme commented 6 years ago

Can you try these steps to install the plugin.

  1. Make sure you have the most recent version of Terminus
  2. Delete any existing plugin files
  3. Clone this repository into ~/.terminus/plugins. For example git clone https://github.com/pantheon-systems/terminus-site-clone-plugin.git ~/.terminus/plugins/terminus-site-clone-plugin
  4. Change into the plugin directory cd ~/.terminus/plugins/terminus-site-clone-plugin
  5. Install Composer composer install
  6. Confirm plugin installation with terminus site:clone -h
  7. Try the database clone again with terminus site:clone <source.env> <destination.env> --no-code --no-files

If these steps do not work then perhaps we can get on a call sometime to debug.

mtprell commented 6 years ago

That worked! I was able to clone the database, and then I ran the plugin against another source site and it cloned this new site as well.

Thanks so much for developing this plugin. We've been trying figure out a way to do this and this works perfectly for our use case.

ataylorme commented 6 years ago

Awesome! Glad to hear that worked.

We've been trying to figure out a way to do this and this works perfectly for our use case.

Mind expanding on this? I'm interested in hearing what folks are using it for.

mtprell commented 6 years ago

We build many sites that are very similar (university departments), use similar themes, templates, content types, etc., so we like to have starter site that includes all of the above. We can also build new features on the starter site and then have them available to all future sites. Config management didn't quite get us there, so being able to clone or copy our starter site is exactly what we needed.

ataylorme commented 6 years ago

Thanks for the update! I'm actually drafting a blog post announcing this plugin and think the use case you described is a powerful one.

I would encourage you to think about combining the starter site with a custom upstream. That way code updates can be pushed to existing sites as well. The site:clone would come in when making new projects. You can start with the upstream then bring over files and database from your starter site to kick off the project.

mtprell commented 6 years ago

We've considered the upstream, but we decided that we don't want theme code updates pushed to existing sites. We already have a custom upstream for our preferred Drupal modules and base themes. The sites we build are similar, but not the same. Just having a starter site with common theme elements and Drupal configurations is a win for us.

ataylorme commented 6 years ago

The sites we build are similar, but not the same. Just having a starter site with common theme elements and Drupal configurations is a win for us.

Good insight - thanks for sharing!