Changing site keys after provision and deploy

Hi there,

I have a question regarding changing the config in group_vars after provisioning and deploying my server:

In my current situation, I only have one wordpress site defined in my project with a certain key name, the default site path and SSL disabled. I already provisioned my local VM and staging server and deployed the site to the staging server successfully.

Now I would like to add a second site to the same Trellis project and change the site key of the existing site to a more appropriate name (suffix it with domain extension), change the site path of the existing site and enable SSL for both sites.

I was wundering if I re-provision my local VM, if I would need to export the database and find and replace http to https and the local path name from old to new site key and import the database again of this existing site, since the key name has changed?

Also, would the vagrant folder with the old key name, still be present on the VM and would I have to manually delete this?

Same goes for my staging server, should I backup the uploads folder within the old key name folder and reupload it again after re-provisioning the staging server to the new key name folder?


Surprisingly I’ve never done this that I remember. I can’t really say for sure what will happen but the golden rule is: if you aren’t sure then backup first.

If you rename a site Trellis will treat it as a new site. Almost everything is based on that name, so it will create a new one. That includes creating a brand new database unless you override the db_name. If you do that, it should just work and not overwrite it.

Yes, the existing folders under the old name will still exist. You’d have to do vagrant reload to get rid of it and then delete the rest of the old, unused site paths on the server.

1 Like

Thanks, gonna try it now! Gonna report back here.
Luckily I always define my db_name for import/export functionality, so it shouldn’t be too difficult.

Hmm, didn’t go as smooth as I hoped…
First on the first vagrant up I got this error:

NFS is reporting that your exports file is invalid. Vagrant does
this check before making any changes to the file. Please correct
the issues below and execute "vagrant reload":

exports:5: path contains non-directory or non-existent components: ~/path/to/old/sitekey/site
exports:5: no usable directories in export entry
exports:5: using fallback (marked offline): /

Running a vagrant reload didn’t fix it, so I ssh’d into the VM and removed the old folder in /srv/www/. But running vagrant up --provision still gave me this error.

Editing the Vagrant export path in /etc/export as described here fixed that for me: Vagrant Up export file invalid

But even after a vagrant destroy and vagrant up it’s still not working. It hangs on the ssh authentication:

==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address:
    default: SSH username: vagrant
    default: SSH auth method: private key

I currently have these versions installed:

MacOS 10.12.1
Vagrant 1.8.5
VirtualBox 5.0.28

Any ideas what else I need to do for a fresh box?

1 Like

Might just be a bad coincidence since I’m not sure how this would be related to changing a site. You can try removing the .vagrant directory in your Trellis dir.

Thanks, I tried that amongst a whole other variety of things, such as:

  • Manually ssh’ing into box
  • Turn Virtualbox GUI on and try logging in there
  • Upgrading Virtualbox
  • Generating new SSH key
  • Copy vagrant private key from other (still running) trellis box
  • Change Vagrant IP address
  • Add public DNS servers to my wifi connection
  • Clone fresh trellis repo

I think eventually, the thing that fixed it for me was checking the box Cable connected in the Network tab in my Virtualbox settings of the trellis box which I read somewhere on a forum:

It works now, super weird!

1 Like