WP Project setup - Trellis, Valet or Docker?

Hello,
I want to start a new WordPress project with another developer. The decisions we made are:

  • We want to use Bedrock as the WP structure
  • we want to use Sage as the WP theme
  • We put the project in a GIT repository

I now ask myself if we should use Trellis, Valet or Docker. My personal opinion is that Trellis / Docker is a bit too much for a project with two developers working on it. Additionally my experience with Vagrant is not very positive, as it was very slow when I used it. My favorite would be Valet, because it’s so slim. The repository I would use is Beanstalk, from there I would trigger my deployments to my test and live system.

Additionally I am not 100% sure if my server to which I want deploy my project also needs Docker installed - does anybody knows that? And what happens when my server runs on Apache and not Nginx?

Would be great to hear your opinions and get some guidance here.

Thanks!

1 Like

I am unfamiliar with Valet. Trellis seems like the right choice because it was made by the roots team for Bedrock and Sage.

That said I am also no longer a Vagrant fan. it takes up gigs of disk space and I have a small SSD drive on my laptop. I have been happy with Docker, but don’t feel like I am expert enough to implement Roots in a Docker local dev environment.

As to whether or not you need Docker on your server I think it depends on how you want to deploy. It is still a WP site inside the Docker containers so you should be able to deploy by migrating the files in database with whatever solution you have been using.

Some hosts allow Docker containers. Deploying the whole container seems to me like it would be a great way to go so you have EXACTLY the same local and remote. I have not learned that trick yet though. There may be challenges to deploying the whole container.

what happens when my server runs on Apache and not Nginx?

You try to run Apache on your local instead of Nginx? You create an .htaccess for remote… but then remote and local have variations.

Sometimes I find myself wishhing there wasnt an infinite number of ways to build/deploy sites.

After reading about Valet in this very topic I gave it a try for a new bedrock/sage/capistrano project. Staging and production servers both run on Apache. Database+media synchronisation and theme deployment is done by capistrano. So far I like Valet a lot.

Pros (for me):

  • homebrew takes care of php and mysql/mariadb
  • Valet secures local domains with self-signed (and valid) ssl-certificates. valet secure domain.test just works.
  • Once set up it stays in the background. It’s almost set & forget.

Cons

  • homebrew takes care of php and mysql/mariadb. It’s difficult to set different php and mysql versions per project.
2 Likes

I think that Valet offers the best local development environment though I use Trellis for staging and production deployments. If you are using a windows machine locally, Valet is difficult to setup - but you can setup the Caddy server (without DNS Masq) in less than 10 minutes. You can get info on Caddy here: https://caddyserver.com/

My Caddyfile is not an optimal configuration but it will allow you to get up and running quickly. Just make a Caddyfile in your project root:

localhost:8080
root web/
gzip
fastcgi / 127.0.0.1:9000 php
rewrite {
    if {path} not_match ^\/wp\/wp-admin
    to {path} {path}/ /index.php?_url={uri}
}
tls off
errors visible

Only roadblock after that is getting a local MariaDB and a local PHP with FastCGI setup.

If you are not comfortable with a terminal and sysadmin duties, I wouldn’t advise Docker for hosting. It still has a tendency to go haywire (bad for production) and has a pretty healthy learning curve compared to Trellis. I wouldn’t use Valet for production either, but I suppose if you make sure to keep the Caddy service alive it may do OK.

I think Trellis is your best bet - only 4-5 YAML files and you’re already setup with deployment / server provisioning that’s tuned to Wordpress.

Oh and since Docker works on containerization, there is no base requirements for web servers on your hosting setup. You could feasibly deploy 10 apache web servers and 10 nginx web servers on the same machine -

1 Like