Skip to main content

Docker compose setup

Submitted by rnsrk on

Docker is a appropriate way to ship entire environments. DockerWissKI consists of multiple services (Drupal, MariadB, GraphDB or BlazeGraph and SOLR), which are orchestrated by docker-compose.

Prerequisites

You have to install docker (comes with docker compose). Consider to perform post installation steps to make life easier.

Change to a preferred directory, i. e. ~/ for Linux/MacOS users (that's your home directory) or your user directory in Windows.

Clone the repository with

git clone git@github.com:rnsrk/dockerWissKI.git

or download the zip file by clicking on Code and Download ZIP in the dockerWissKI repository (unzip it, after the download finished).

We use GraphDB as the triple store, get the GraphDB standalone server zip file (no installer like DEB or EXE). Apply on the GraphDB free download page, they will send you an email with a link to the stand alone server; safe the file as graphdb.zip in the graphdb_context folder.

Installation

Linux

Install Docker. You may want to manage Docker as a non-root user as a post-installation step.

Windows/ MacOS

Install Docker Desktop. You may need to install the WSL 2 Linux kernel, if you are using Windows.

Beware if you are using Virtualization software like VirtualBox, they may conflict with your Docker-Software in Windows.

Setup

Script-driven (only Linux)

Open a terminal and navigate to dockerWissKI root (the one where cloned the repo, i. e. ~/dockerWissKI). Run

./setup.bash

to set your database credentials and port definitions.

Manual installation in Windows, MacOS and Linux

In the dockerWissKI root directory, there is .example-env file. Open it and provide the credentials and ports according to your needs and save it as .env.

Do not change DB_DRIVER and DB_HOST, we only support MariaDB at this point.

DB_ADMINISTRATION_PORT=8081
DB_DRIVER=mysql
DB_HOST=mariadb
DB_NAME=DATABASE
DB_PASSWORD=USERPW
DB_PORT=3306
DB_ROOT_PASSWORD=ROOTPW
DB_USER=DBUSER
DRUPAL_PORT=80
GRAPHDB_PORT=7200
SOLR_PORT=8983

Start

Run

docker compose up -d

to start containers in the background (remove -d to see what is going on if something fails). 

Stop

Run 

docker-compose down 

to stop the containers.

Rebuild

If you change environment variables you have to rebuild the docker image!

docker-compose build

Restart the compose environment again with

docker compose up -d

Docker compose environment

Services

There are five services corresponding to four containers

  • drupal/ dockerwisski_drupal_1
  • mariadb/ dockerwisski_mariadb_1
  • graphdb/ dockerwisski_graphdb_1
  • phpmyadmin/ dockerwisski_phpmyadmin_1
  • solr/ dockerwisski_solr_1

To browse your services enter your domain and the port of the service (i.e. localhost:7200 if you installed it on your local machine and left the default graphdb port).

To connect to your services over the internal docker network, you have to provide the service name (drupal, mariadb, solr, graphdb) as host instead of localhost or 172.168.0.1. For example the correct setting in the settings.php for host is not 'host' => 'localhost', but 'host' => 'mariadb'.

Editing

If you want to jump into a container, open a console and type docker -it <container id> bash

for example

docker exec -it dockerwisski_drupal_1 bash

gets you into the drupal container.

Volumes

All containers have three bind volumes:

  • volumes/drupal-data stores your drupal web directory
  • volumes/mariadb-data corresponds to /var/lib/mysql
  • volumes/solr-data to SORL root dir

and one docker volume:

  • graphdb-data to Graphfb root dir

You find these bind volumes in your git directory and the docker managed under /var/lib/docker/volumes/<composer-prefix>_<volume name>/_data (Linux - you have to be root to access) or at the location shown in your Docker Desktop settings (Premium Feature). Please check the right permissions, if you copy or alter files and folders.

RUN the Drupal Installer

This step is identical to the chapter in the default server setup.

 

Need help?

Write an email or join chat.wiss-ki.eu!