Skip to content

Docker compose setup from wodby, with dns and common mysql / mailhog / dns support

Notifications You must be signed in to change notification settings

reinier-vegter/docker-compose-drupal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Get started

Common apps (mysql, DNS etc)

Start common apps like mysql and mailhog (you need those first): export MYSQL_DATA=/my/mysql/datafolder; cd /path/to/docker-compose-drupal/common-apps && docker-compose up -d Add this command to your boot-scripts.

This gives you

  • mysql: 1 mysql-container for all persistent databases. Available at localhost:3306 and from your containers at mysql . Username / password: root and root.
  • mailhog: This is a mailsink with web UI where php-containers will send all email to. Note that only containers started with the project docker-compose.yml from this repo will use this! Available at http://mailhog.dev:8025/
  • devdns: This is the central dns-container that provides you the .dev domain and project hostnames. If this is not started, functionality from this repo won't work well (if not at all).

To get DNS to work on your host / laptop, follow instructions:

Ubuntu:

edit /etc/dhcp/dhclient.conf add: supersede domain-name "dev"; prepend domain-name-servers 127.0.0.1; see: https://github.com/ruudud/devdns

Run a project

Copy drupal-project/docker-compose.yml and drupal-project/.env to your project. Edit .env and docker-compose.yml.

Run docker-compose up -d.

To stop, run docker-compose down.

Slow filesystem on OSX

Try to use d4d-unison-sync in drupal-project/docker-compose.yml . Have not tested with it yet, so you're on your own. Read: http://docs.docker4drupal.org/en/latest/macos/ .

Fixing Permissions Problems

To avoid potential permissions problems between host machine and containers (e.g. can't access files generated by PHP) you can add a group on your host machine with ID 82, it's a standard GID/UID for www-data user in Alpine Linux. Read: http://docs.docker4drupal.org/en/latest/permissions/

Extra info

PHP logs

Run docker-compose logs -f php from your project folder to tail the php logs.

Drush, composer and drupal console

You might want to add these aliases to your ~/.bashrc file (restart terminal to take effect):

alias ddrush='docker-compose exec --user 82 php drush'
alias dcomposer='docker-compose exec --user 82 php composer'
alias ddrupal='docker-compose exec --user 82 php drupal'

# Note the 'up' alias adds a workaround to provide working DNS for each php-container.
# Drupal needs this for background_process support etc.
alias up='export DOCKERDNS=$(docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" dockerdns); docker-compose up'
alias down='docker-compose down'
alias restart='docker-compose down; docker-compose up -d'
alias logs='docker-compose logs -f php'

About

Docker compose setup from wodby, with dns and common mysql / mailhog / dns support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published