WP Heroku Docker Project
The Holy Grail WordPress project template for Heroku deployment and local Docker development.
- Bedrock-like modern development environment
- Local Heroku-like environment with Docker-compose
- Configurable Nginx
- Travis CI pipeline you can run with Docker
- PHP Codesniffer with nicer coding standards for WordPress
- Terraform deployment for full WordPress stack provisioning to Heroku & AWS
- Heroku PHP7 & Node 8 application runtime
- Heroku Redis Cache
- AWS S3 for media uploads
- AWS RDS for MariaDB
- Papertrail log management
- NPM scripts for ease of use
Clone this repo and source set up your environment inside the project root.
cp .env.sample .env source .env
I also recommend installing autoenv, so you don't have to run the source command all the time.
Start a shell inside Docker. It might take a moment for the images to download and build. This is normal.
npm run shell
Now you can run
composer install inside Docker
composer install && exit
Outside the docker shell, you can now start the main process
You can now navigate to
start working with your local WordPress installation.
Deploying with Terraform
To deploy using Terraform, make sure you've prepared Heroku and AWS credentials, and you've installed the Terraform CLI binary on your system.
You can get your Heroku API key from the Heroku dashboard
export HEROKU_API_KEY= export HEROKU_EMAIL=
For AWS, create an IAM user with Administrator rights
export AWS_ACCESS_KEY_ID= export AWS_SECRET_ACCESS_KEY=
The state of Terraform is managed in S3, so it should automatically sync any
changes from the remote backend. For this you'll need to manually set up an S3
bucket in the eu-west-1 region with the name
terraform init terraform apply
After this you can push to your newly created Heroku app's git URL to trigger a Heroku deployment.
git remote add dev https://git.heroku.com/[my-project-name]-dev.git git push dev
You can run WP-CLI locally by starting the shell container
npm run shell
To run wp-cli in a Heroku instance, just run a temporary dyno.
heroku run bash
Both environments have WP-CLI available as
Travis CI will run the
ci container to test your app. You can do the same