Adding sites to existing Trellis server

I’m wanting to add another site to my existing Trellis setup.

My current setup is:

 - Ansible

I setup and at the same time as Trellis, so I haven’t yet had to add a site to this server.

If I want to add to this setup, is it as simple as reconfiguring my wordpress_sites.yml file and then running vagrant provision on my Trellis setup?

Just wanting to make sure that provision-ing doesn’t erase databases etc.

There shouldn’t be any deleting of databases. vagrant destroy is what would be destructive, as it will delete the actual Vagrant server.

However, if you’re nervous, it’s as easy as vagrant ssh and exporting the databases to files…

You’ll probably need to run vagrant reload as well to get Vagrant set up the new synced folder.

When I run vagrant up with my new bedrock site added an configured (where [] is my new site name), I get:

The bind command bindfs --perms=u=rwX:g=rD:o=rD --user=vagrant --group=www-data / /srv/www/[]/current` failed to run! 

When I run vagrant up --provision or vagrant provision I get:

stderr: Composer could not find a composer.json file in /srv/www/[]/current

Any thoughts on what I’m missing?

@swalkinshaw or @kalenjohnson hoping you can give me some insight into the above comment?

Had same issue adding a site to my Trellis install. Any guidance on best steps to adding a site would be great. A destroy and provision works, but I can’t seem to add a site without getting one of these errors.

So I think I figured it out… You need to run reload before provision. I ran the bindfs command within vagrant shell and got back this response:

Deprecation warning: please use --force-user instead of --user or --owner.
The new option has the same effect. See the man page for details.
Deprecation warning: please use --force-group instead of --group.
The new option has the same effect. See the man page for details.
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option

So when you tried to provision it added the .env file and the web file. I bet we could use the nonempty mount option so people don’t run into this issue, but IDK. Also, noticed the deprecation warnings.

Edit: Forgot to mention the fix that might help you… if you vagrant ssh in and go to your /srv/www/yoursite/current and delete the files in there then run vagrant reload and you should be good.

@swaincreates could you please be a bit more specific with the steps you took? I ssh'ed into the VM and removed the web folder from within current (this was the only file/folder inside current).
What was the binds command you ran?

I’ve also experienced issues with provisioning and reloading vagrant upon adding a new site to an existing trellis server. Haven’t really found out what the process should be like, but the last time I did this I ended up running vagrant reload and vagrant provision as well as vagrant reload --provision multiple times before I finally got it working. Will try @swaincreates’s approach with deleting the files inside /srv/www/yoursite/current before running vagrant reload the next time I add a site.

So this may be the most helpful. Here is a pull request that (hopefully) fixed this problem

If you go to the link and the files changed tab you’ll see that if you add that to your vagrant file it should work. If its the same problem I had, that is…

As far as the steps I took, I can’t remember exactly. I think I made sure that there were no files, dotfiles or directories within /srv/www/yoursite/current. But don’t delete the /current directory…then I ran vagrant reload.

If thats not working, try sshing into vagrant (vagrant ssh) and running the command shown in your error which looks like: bindfs --perms=u=rwX:g=rD:o=rD --user=vagrant --group=www-data / /srv/www/[]/current and let us know what feedback you get. May have to run with sudo, I dont remember.