WordPress on Heroku

by mitramejia

GitHub Readme.md

WP Heroku Docker Project

Build Status License

The Holy Grail WordPress project template for Heroku deployment and local Docker development.

Play Video

Video Tutorial available on YouTube


  • Bedrock-like modern development environment
  • Deployment to Heroku pipelines
  • Local Heroku-like environment with Docker-compose
  • PHP 7
  • WP-CLI
  • Configurable Nginx
  • Redis Object Cache
  • Travis CI pipeline you can run with Docker
  • PHP Codesniffer with nicer coding standards for WordPress
  • Media Uploads to S3
  • Newrelic APM monitoring
  • Papertrail log management
  • Environment management for complete local, development, qa and production pipeline
  • CloudFormation script for provisioning a MariaDB RDS instance and an S3 bucket on AWS
  • Scripts for automating deployment, synchronising databases
  • Basic integration tests

Local Development

Install Docker

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.

docker-compose run shell

Now you can run composer install inside Docker

composer install

Outside the docker shell, you can now start the main process

docker-compose up web

You can now navigate to http://localhost:8080 to start working with your local WordPress installation.

Deploying to Heroku

Database and S3 Bucket

Use the included CloudFormation script to provision a MariaDB instance and an S3 bucket for uploads on AWS.

Launch Stack

The script will output the values needed for Heroku config variables:

AWS Cloudformation script output

Heroku App

Set up a new app on Heroku for your WordPress project. Use the values generated by the Cloudformation script previously


This is how your project should look like on Heroku:

Heroku App Dashboard

Here's an example of a WordPress instance running on Heroku:



You can run WP-CLI locally by starting the shell container

docker-compose run shell

To run wp-cli in a Heroku instance, just run a temporary bash dyno.

heroku run bash

Both environments have WP-CLI available as wp.

Running tests

Travis CI will run the ci container to test your app. You can do the same locally:

docker-compose up ci