Docker-compose setup

Submitted by rnsrk on Thu, 08/19/2021 - 15:12

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 and 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 (you need to have GIT LFS support) 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).

To use Mirador Integration, you need the Mirador 2 library. Download it here and unzip to dockerWissKI/drupal-context/libraries/ (there have to be a folder-structure dockerWissKI/drupal-context/libraries/mirador afterwards).

If you like to use GraphDB as the triple store, get the GraphDB standalone server zip file. 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 and Docker-Compose. 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. Open drupal-context/example-settings.php and paste the credentials there, too and safe it as drupal-context/settings.php. Go to the DATABASE SECTION at line 775 and change:

  'database' => 'DBNAME',
  'username' => 'DBUSER',
  'password' => 'USERPW',
  'port' => 'DBPORT',

Start

Run

docker-compose up -d

to start containers in the background.

Stop

Run docker-compose down to stop the containers.

Docker-compose environment

There are four services corresponding to four containers

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

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

for example

docker -it dockerwisski_drupal_1 bash

gets you into the drupal container.

All containers have volumes:

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

You find these volumes (hopefully) under /var/lib/docker/volumes/docker-volume-name/_data (Linux - you have to be root to access) or at the location shown in your Docker Desktop settings (Windows - only available for premium users).

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'.

RUN the Drupal Installer

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

 

Was this reply helpful?
0
0
1 votes with an average rating of 0.

Need help?