Deploy to existing DigitalOcean server block?

I have a droplet set up with two server blocks. example1.com is hosting a live WordPress site, example2.com has no content yet. I’m hoping to deploy my new Trellis/Bedrock project to example2.com without interfering with example1.com. Is this possible? How would I go about doing it?

The server is running Ubuntu 14.04 but I’m using the latest version of Trellis (Ubuntu 16.04). Would this deploy work at all or does the server need to be running 16.04?

Thanks!

I’m confused what you mean by “server block”.

Are you asking about just Trellis deploys? Or Trellis provisioning too?

Trellis only works on a bare Ubuntu server for provisioning. It won’t work against a server that already has Nginx/whatever already installed and working on it that was not done by Trellis itself.

For deploys only, it can work. It really depends on your setup. There’s a thread or two on this forum about using Trellis for deploys only if that’s what you’re doing.

edit: Trellis actually works on 14.04 or 16.04 now.

@swalkinshaw thanks for your reply. Sorry this is my first Roots project and I’m confused by the process. I’m a designer rather than a developer and most of this server terminology is new to me. I’ll try to explain…

I already have Ubuntu 14.04 running on a DigitalOcean droplet. This droplet is currently serving a WordPress site which is nothing to do with Trellis. I don’t want to do anything that will break that live site.

By “server blocks” I mean I’m attempting to host two separate WordPress websites on a single nginx server. I set these up following a guide like this. The subdirectories and domains are working, and my new Trellis project is complete on my local machine. I’m just trying to figure out how best to get it into the correct directory on my server, without dragging and dropping files via ftp like a caveman.

My current situation is that I’ve committed my project to Github, just like the Roots example project, and I’m stuck wondering what to do next.

My questions at this point are:

  • Since I already have a LEMP server up and running, that means I can skip Trellis’s provisioning step, correct?
  • Will Trellis deploy create a database for my project, or do I need to create on manually?
  • Will Trellis deploy install WordPress on my server or do I need to do that manually?
  • Where do I tell Trellis which directory I want to deploy my project to?

Thanks for your help, it’s much appreciated.

I’ve been in a similar situation (sneaking server blocks into a Trellis setup) and have found success creating one-off configurations in the servers-enabled directory. This survives provisioning and deployment from multiple Trellis playbooks, although I’m sure there’s plenty that can go wrong.

If you go here:
$ cd /etc/nginx/sites-enabled

And make a conf file that doesn’t conflict with existing deployment configs:
$ sudo touch utility.conf

You should be able to work around Trellis. For my use I store port proxies for the server:

server { listen 80; server_name ${sub}.${hostname}.com; location / { proxy_pass ${hostname}:${port}; } }

Although I’d be eager to know if anyone has a better spot for stuff like this on a Trellis setup.

@hustlersquad

  • Since I already have a LEMP server up and running, that means I can skip Trellis’s provisioning step, correct?
  • Will Trellis deploy create a database for my project, or do I need to create on manually?
  • Will Trellis deploy install WordPress on my server or do I need to do that manually?
  • Where do I tell Trellis which directory I want to deploy my project to?
  1. Correct. You can just use the deploy.yml playbook
  2. Nope, that’s part of provisioning so you’ll have to manually do it.
  3. Trellis does’t run the WP installation during deploys. You have to take care of that.
  4. The www_root variable. It would result in /srv/www/<site name> by default.

You can use Trellis for deploys only and it absolutely won’t do anything to existing sites on a server (as long as its document root is in a different directory).

However you’ll need to do some manual things to get deploys working on their own. Most importantly:

  • Make sure a user exists with the proper permissions to create directories.
  • Make sure that user can access your GitHub repo from your remote server.

There’s some existing threads on this forum with loose guides to this. Nothing extensive/official has ever been written up so you’re on your own a little bit.