Giter Club home page Giter Club logo

wp-docker-bedrock's Introduction

Roots Bedrock for WordPress running on Docker

This is a Docker based local development environment for WordPress with Roots Bedrock.

What's Inside

This project is based on docker-compose. By default, the following containers are started: PHP-FPM, MariaDB, Elasticsearch, nginx, and Memcached. The /site/web directory is the web root which is mapped to the nginx container. See Bedrock for more info.

Docs from 10up/wp-docker

You can directly edit PHP, nginx, and Elasticsearch configuration files from within the repo as they are mapped to the correct locations in containers.

A Dockerfile is included for PHP-FPM (/dockerfiles/php-fpm/Dockerfile). This adds a few extra things to the PHP-FPM image.

The /config/elasticsearch/plugins folder is mapped to the plugins folder in the Elasticsearch container. You can drop Elasticsearch plugins in this folder to have them installed within the container.

Requirements

Setup

  1. git clone [email protected]:dwnload/wp-docker-bedrock.git <my-project-name>
  2. cd <my-project-name>
  3. docker-compose up
  4. Run bash ./bin/setup.sh to download Bedrock.

Default MySQL connection information (from within PHP-FPM container):

Database: wordpress
Username: wordpress
Password: password
Host: mysql

Default Elasticsearch connection information (from within PHP-FPM container):

Host: http://elasticsearch:9200

Docker Compose Overrides File

Adding a docker-compose.override.yml file alongside the docker-compose.yml file, with contents similar to the following, allows you to change the domain associated with the cluster while retaining the ability to pull in changes from the repo.

version: '2'
services:
  phpfpm:
    extra_hosts:
      - "dashboard.dev:172.18.0.1"

WP-CLI

Add this alias to ~/.bash_profile to easily run WP-CLI command.

alias dcwp='docker-compose exec --user www-data phpfpm wp'

Instead of running a command like wp plugin install you instead run dcwp plugin install from anywhere inside the <my-project-name> directory, and it runs the command inside of the php container.

There is also a script in the /bin directory that will allow you to execute WP CLI from the project directory directly: ./bin/wp plugin install.

SSH Access

You can easily access the WordPress/PHP container with docker-compose exec. Here's a simple alias to add to your ~/.bash_profile:

alias dcbash='docker-compose exec --user root phpfpm bash'

This alias lets you run dcbash to SSH into the PHP/WordPress container.

Alternatively, there is a script in the /bin directory that allows you to SSH in to the environment from the project directory directly: ./bin/ssh.

Credits

This project is our own flavor of an environment created by the 10up team based on work by John Bloch. Some additional code was used from easypath/bedrock-docker.

wp-docker-bedrock's People

Contributors

thefrosty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

wp-docker-bedrock's Issues

Recreating beddockercom_nginx_1 ... error

Hello - keen to try this out as have enough of vagrant & trellis but have an nginx issue with docker-compose up

ERROR: for beddockercom_nginx_1  Cannot start service nginx: b'driver failed programming external connectivity on endpoint beddockercom_nginx_1 (71821fcfde4de0de916b1ff1b8eb96a1ff417a4448ed57606bac9c277af23564): Bind for 0.0.0.0:8080 failed: port is already allocated'

ERROR: for nginx  Cannot start service nginx: b'driver failed programming external connectivity on endpoint beddockercom_nginx_1 (71821fcfde4de0de916b1ff1b8eb96a1ff417a4448ed57606bac9c277af23564): Bind for 0.0.0.0:8080 failed: port is already allocated'
ERROR: Encountered errors while bringing up the project.

Running on macOS.
Let me know if I should supply info.

$ docker-compose ps
              Name                             Command                State                  Ports
----------------------------------------------------------------------------------------------------------------
881d4577e91c_beddockercom_nginx_1   nginx -g daemon off;             Exit 128
beddockercom_elasticsearch_1        /docker-entrypoint.sh elas ...   Up         0.0.0.0:9200->9200/tcp, 9300/tcp
beddockercom_memcached_1            docker-entrypoint.sh memcached   Up         11211/tcp
beddockercom_mysql_1                docker-entrypoint.sh mysqld      Up         0.0.0.0:3306->3306/tcp
beddockercom_nginx_1                nginx -g daemon off;             Exit 128
beddockercom_phpfpm_1               docker-php-entrypoint php-fpm    Up         9000/tcp

setup.sh: Composer could not find a composer.json file

When invoking bash ./bin/setup.sh as described in README after upping the container,
an error occurs and nothing is installed by composer:

$ bash ./bin/setup.sh
WordPress config file not found. Installing...
Installer verified
All settings correct for using Composer
Downloading...
Composer (version 1.6.5) successfully installed to: /[...]/test/bin/composer.phar
     Use it: php bin/composer.phar
Composer could not find a composer.json file in /[...]/test/site    To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

Also composer is already globally installed.

Environment: WSL (Bash on Windows)

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.