JoeyKhd / docker-compose-development

Clone and `bin/dev up`. Quickly start of developing locally with Nginx, PHP, Blackfire, Percona, Mailhog and Redis.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Waffle.io - Issues in progress

Docker Development stack

Docker-compose-development aims to be a plug 'n play setup for you to quickly start developing locally with services as NGINX, PHP, Blackfire, Percona, MailHog and more!

Also, it contains different configurations for use with Symfony, Silex, Magento 1 & 2, on PHP5 / PHP7 and with XDEBUG enabled.

We follow a Code of Conduct.

Table of Contents

Prerequisites

Before continuing you must have the following installed and working correctly:

OSX users should also install:

  • Docker Sync and its dependencies

  • Coreutils using Homebrew brew install coreutils

  • Make sure that port 80/443 and 3306 are not being used by other services. sudo netstat -tupln|egrep '80|443|3306'

How to get started

Make sure that you have the prerequisites installed and running correctly before proceeding.

1). Configure your environment

  1. Clone this repository:
git clone git@github.com:JeroenBoersma/docker-compose-development.git development
  1. Create a new persistent data volume with:
docker volume create --name dockerdev-mysql-volume

Or, if you already were using this repository before (or want a local directory), you can map the existing volume with:

docker volume create -o 'type=none' -o 'device='${PWD}'/mysql' -o 'o=bind' dockerdev-mysql-volume
  1. Configure you MySQL credentials by copying conf/mysql.dist to conf/mysql and setting your strong awesome password.
  2. Start your containers!
./bin/dev up

Or, if you are on OSX:

docker-sync start

A optional, but recommended, step to take is to add the provided .bin/dev command to your system so you can use its commands anywhere you like.

  1. Run ./bin/dev profile from the development folder.
  2. Copy the output into ~/.bashrc ~/.bash_aliases ~/.zshrc, on your own preference.
  3. Log out and log back in for this to take effect. You could also just source the new files in your current terminal . ~/.bashrc.

If succeeded you can now use dev <command> from anywhere. You can also just type cdw which will take you to your workspace directory.

2). Configure your hostnames...

There are several ways of configuring hostnames.

By using DNSMASQ (preferred)

Only applies if you have DNSMASQ installed, otherwiste continue to use the hostfile instead.

Create a file /etc/dnsmasq.d/dev.conf and copy the following as its content: address=/.localhost/127.0.0.1

Or by using the hostfile

Add a hostname entry for each of your projects manually to /etc/hosts, e.g.: 127.0.0.1 mail.localhost 127.0.0.1 test.project.localhost

You should now be able to browse to http://test.project.localhost/info.php and get a phpinfo() output.

3). Now, setup your projects!

Inside the development folder you will find a folder called workspace. The folders follow a certain structure, as described below: customer/project/htdocs

You will notice that this has a 1-on-1 relation to the hostname provided in your hostfile: workspace/test/project/htdocs => https://test.project.localhost/

Other examples are:

  • workspace/iwant/coffee/htdocs => https://iwant.coffee.localhost/
  • workspace/iwant/beer/htdocs => https://iwant.beer.localhost/
  • workspace/nomore/soup4you/htdocs => https://nomore.soup4you.localhost/

To be compatible with various projects, we have included the following definitions as webroots:

  • htdocs
  • httpdocs
  • public
  • pub
  • web
  • magento

You can read more about project webroots in the Hosts and File structure documentation.

Xdebug

Xdebug is enabled with support for remote debugging on your local machine. It will try to connect to the host 172.17.0.1:9000 by default. Make sure to add a file mapping in your IDE: ./workspace/customer/project => /data/customer/project

But wait, there is more!

About

Clone and `bin/dev up`. Quickly start of developing locally with Nginx, PHP, Blackfire, Percona, Mailhog and Redis.

License:MIT License


Languages

Language:Shell 99.5%Language:PHP 0.5%