LarsNieuwenhuizen / Development-environment

A development environment with docker compose

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker compose development environment

Use this setup as a basic setup for your development environment for macOS.

Credits for the initial setup of this environment go to @radmiraal

Menu:

Docker

For this environment to work Docker, Docker compose and Docker machine have to be installed. How to install and run this you can read here: https://www.docker.com/products/docker

Dinghy

This environment assumes dinghy http proxy is activated which catches all calls to *.docker.

How to install and activate dinghy you read here: https://github.com/codekitchen/dinghy

.env

Basic environment variables are set in the .env file.

Currently:
  • HOSTNAME: the url by which you access your app. Has to end with .docker
  • PORTSUFFIX: Used to override some default ports for access
    • Elastichsearch
    • Mariadb
  • MYSQL_ROOT_PASSWORD
  • MYSQL_DATABASE
  • MYSQL_USER
  • MYSQL_PASSWORD
  • MAILCATCHER_HOSTNAME
  • ELASTICSEARCH_HOSTNAME

Get started

To create an app like Symfony or Laravel you can simply use the framework installer.

  • Ensure Dinghy is active and catching all request to *.docker. You can check this by opening a browser and going to whatever.docker/ You should see a dinghy start page
  • Open the terminal and run $ bin/install-framework.sh
  • Choose your framework
  • The installer will install the framework and create a Web symlink to the public folder
  • Run $ bin/start-environment.sh
  • Go to development.docker
  • You should see the start page of your framework
  • Start developing :)

Start and stop

The environment can be controlled by:

  • Start: $ bin/start-environment.sh
  • Stop: $ bin/stop-environment.sh
  • Restart: $ bin/restart-environment.sh
  • Composer: $ bin/composer.sh

Public web root

If you create your application in ./app you can use:

$ bin/generate-public-link.sh

To generate a symlink named Web to point to your app's public web root. THe supported frameworks currently are:

This way the nginx configuration for the web root does not have to change. The symlink is created automatically when you use the framework-installer.sh script in the bin folder.

Containers

The activated containers by default are:

  • nginx
    • VHOST: development.docker
  • mariadb
  • php (7.0)
  • composer
  • mailcatcher
    • VHOST: mailcatcher.docker
  • elasticsearch
    • VHOST: es.docker

All the hostnames can be edited in .env file

Override

To add or override your own containers you can edit the docker-compose.yml file. Or use the docker-compose.override.yml

About

A development environment with docker compose


Languages

Language:Shell 70.8%Language:Nginx 29.2%