Easily add Traefik and Docker support to your roots/bedrock project. It's great! It's super easy to do! Nothing to lose (except some port conflicts!)
And it's basically non-destructive for an existing Trellis setup. Dank.
My Docker VMs now start up in less than ten seconds. They take up a fraction of the harddrive space. They use a completely negligible amount of RAM.
- Docker
- Docker-compose
The following assumes you are running Bedrock in a local environment.
Run the following commands from the traefik
directory:
docker network create traefikify
docker-compose up -d
Run the following commands from the example.com
directory:
composer install
mv env.example .env
docker-compose up -d
You will then need to add example.test
to /etc/hosts
, or however you manage your virtual hosts.
The WordPress installation screen should be available at example.test
. Additionally, you can monitor traefik at localhost
.
The mixins
directory contains everything you need. You should be able to more-or-less just drop those files in and get to work, but read on:
- Copy
./config/docker/
to yourconfig
directory. - Copy
./Dockerfile
to bedrock root. - Copy
./docker-compose.yml
to bedrock root. - Add
database
to your.gitignore
🙀 - Make sure the variables in the traefik-ify
env.example
are included in your existing.env
. It should look something like this:
WP_ENV=development
DOMAIN_CURRENT_SITE=example.test
WP_HOME=http://example.test
WP_SITEURL=http://example.test/wp
DB_NAME=example_test_development
DB_USER=example_test
DB_PASSWORD=example_test
You should be good to execute docker-compose up
from traefik
, then your Bedrock root. You'll notice the database mounts to a directory in Bedrock. You can change this behavior (and lots of other things) in docker-compose.yml
.