Skip to content
This repository has been archived by the owner on Dec 3, 2022. It is now read-only.
/ dropfabrik Public archive

Drop Fabrik is a collection of the docker container to help development more speedy for Drupal.

License

Notifications You must be signed in to change notification settings

blauerberg/dropfabrik

Repository files navigation

Drop Fabrik

"Drop Fabrik" is configuration of Docker to help development more speedy for Drupal. You will be able to build a Drupal environment on Docker in 5 to 10 minutes with the following steps.

日本語のREADMEはこちら

Overview

Example configuration includes the following containers:

Container Service name Image Exposed port
Nginx Proxy nginx-proxy jwilder/nginx-proxy 80
Nginx web nginx
MariaDB db mariadb 3306
PHP-FPM 5.6 / 7.0 / 7.1 php blauerberg/drupal-php
mailhog mailhog mailhog/mailhog 8025 (HTTP server)
phpmyadmin phpmyadmin phpmyadmin/phpmyadmin 8080 (HTTP server)
dozzle dozzle amir20/dozzle 8081 (HTTP server)

Prerequisites

Getting started

Start containers

First, get a configurations.

$ git clone https://github.com/blauerberg/dropfabrik.git
$ cd dropfabrik

Next, create a directory to mount source code of Drupal.

$ mkdir -p volumes/drupal

download & extract Drupal source code.

# Note: replace "X.Y.Z" in below to  Drupal's version you'd like to use.
$ curl https://ftp.drupal.org/files/projects/drupal-X.Y.Z.tar.gz | tar zx --strip=1 -C volumes/drupal

If you use macOS, highly recommend using docker-sync to avoid performance problems. please see Use docker-sync.

create & start containers.

$ docker-compose up -d

if you use Linux host, you have to fix permissions for your Drupal directory with:

$ docker-compose exec php chown -R www-data:www-data /var/www/html/sites/default

Access your Drupal site.

$ open http://localhost # or open http://localhost on your browser.

Install Drupal

Credentials of database is configured in docker-compose.override.yml. Default value is below:

  • Database Name: drupal
  • Username: drupal
  • Password: drupal

Please see also "Environment Variables" section in https://hub.docker.com/_/mariadb/

In Dropfabrik, nginx, mariadb and php-fpm run on the separate containers. Therefore, please note that hostname of database server when installing Drupal is db, not localhost.

Instead of the installation wizard, you can install Drupal using Drush as follows:

$ docker-compose exec php drush -y --root="/var/www/html" site-install standard --site-name="Drupal on Docker" --account-name="drupal" --account-pass="drupal" --db-url="mysql://drupal:drupal@db/drupal"
$ docker-compose exec php drush -y config-set system.theme admin bartik

Stop containers

$ docker-compose stop

Other tips

It's not work for me!

Dropfabrik includes Dozzle to display logs inside the container on a browser. Let's go to http://localhost:8081 to see what's happening inside the container. If you can get some help from someone, it's a good idea to show the Dozzle log as it is.

Access inside the containers

You should use docker-compose exec instead of ssh.

$ docker-compose exec {Service name} /bin/bash
# ex. docker-compose exec php /bin/bash

Use Drush

Drush is installed in php container.

$ docker-compose exec php drush st

Restore database from existing site

Put gzipped sql dump as initdb.sql.gz and uncomment below line at docker-compose.override.yml. It will be loaded by mariadb and will restore once only at generating the container.

- ./initdb.sql.gz:/docker-entrypoint-initdb.d/initdb.sql.gz

Connect database

Via Drush:

$ docker-compose exec php drush sqlc

Database container is exposing port 3306 on 127.0.0.1. So you can access database in the container from GUI application on Host OS such as MysqlWorkbench, Sequel Pro.

Use docker-sync

If you use macOS, highly recommend installing docker-sync as follows to avoid performance problems.

If you use docker-sync please copy docker-compose.override-for-docker-sync.yml as docker-compose.override.yml. Also, you need to run the image with docker-sync-stack instead of docker-compose.

$ docker-sync-stack start

Please see also: https://github.com/EugenMayer/docker-sync/wiki

Supporting Organizations