GithubHelp home page GithubHelp logo

balankarthikeyan / wordpress-heroku-docker-project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anttiviljami/wordpress-heroku-docker-project

0.0 1.0 0.0 154 KB

WordPress project template for Heroku and local Docker

License: GNU General Public License v3.0

PHP 76.15% Shell 11.17% HCL 5.49% Dockerfile 7.19%

wordpress-heroku-docker-project's Introduction

WP Heroku Docker Project

Build Status License

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

Features

  • Bedrock-like modern development environment
  • Local Heroku-like environment with Docker-compose
  • WP-CLI
  • 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

Local Development

Install Docker

Install Node.js

Install AWS-CLI

Install Heroku-CLI

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

npm start

You can now navigate to http://localhost:8080 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 wp-terraform-backend

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

WP-CLI

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 wp.

Running tests

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

npm test

wordpress-heroku-docker-project's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.