Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Docker Setup

Alexander Dubrawski edited this page Aug 22, 2020 · 37 revisions

Install Docker

Ubuntu

Please refer to https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04

On Ubuntu you also need to install docker compose separately: apt install docker-compose

Mac

Please refer to https://docs.docker.com/docker-for-mac/install/

Windows

Please refer to https://docs.docker.com/docker-for-windows/install/

Basic Usage

To get a better understanding of how docker is working I recommend the following training: https://training.play-with-docker.com/dev-stage1/

Inside the docker setup we have five Images:

  • backend
  • frontend
  • influxdb
  • hyrise_1
  • hyrise_2

The hyrise images are based on the same base image.

Running Setup on the local machine

If you are running the cockpit and your browser all on the local machine you can run:

docker-compose up

to build and start all images. If you just want to run the cockpit components in docker you can use:

docker-compose up backend frontend influxdb

If you want to run the containers in the background use the -d flag:

docker-compose up -d

The frontend will be reachable via. 127.0.0.1:5000. The backend via. 127.0.0.1:8000.

Running Setup on server or VM

If you run the setup on a remote server or VM you need to build the frontend explicitly. The reason is that you need to set the address off the machine in build time. So if your server has the address 123.123.123.123 you need to set the VUE_APP_BACKEND_HOST environment variable by running:

docker-compose build --no-cache --build-arg VUE_APP_BACKEND_HOST=123.123.123.123 frontend

After that you can run:

docker-compose up

to start the components

The frontend will be reachable over 123.123.123.123:5000. The backend via. 123.123.123.123:8000.

Shutting down Setup

To stop and remove the running containers execute the command:

docker-compose down

To stop and remove a specific container, for example, the frontend run:

docker-compose down frontend

Build hyrise image

If you use docker-compose up, docker will look if a hyrise image exists. If not it will pull it from docker hub. This image is optimized to run on most architectures. If you want to use an optimized hyrise for your architecture you can build the image manually. For that run:

docker image build --no-cache --tag hyrise/bp1920:hyrise ./hyrise

After that you can run:

docker-compose up

to start the components.

This way the hyrise will be build for the native architecture of your machine. If you want to build the hyrise optimized for a different architecture you can set the environment variable ARCHITECTURE in the hyrise dockerfile (hyrise/Dockerfile). For example you could replace ENV ARCHITECTURE native to ENV ARCHITECTURE core2. There are many other options you can use. For that please have a look at https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html. Please be aware that if you chose a newer architecture than the one of your system, there is a change that the hyrise will not work.

Add a hyrise in the frontend

If the hyrise is not running in docker you can add it in the frontend UI the normal way (click on database, click on add database, enter host and port). For example, your hyrise is running at the machine with the IP 123.123.123.123 on port 1234 you can enter: host: 123.123.123.123 port: 1234

Please remember: if you are using a not dockerized hyrise you need to have the cached tables in the location /usr/local/hyrise (on the machine where the hyrise is running) you can download the files via https://www.dropbox.com/s/yqw3f7ranl79swf/cached_tables.tar.xz?dl=0. You can uncompress and unpack the file with tar -xf cached_tables.tar.xz.

If you use the hyrise in the docker containers you can add them in the fronted UI (click on database, click on add database, enter host and port) with:

host: hyrise_1 port: 5432

and

host: hyrise_2 port: 5432

You need to use the container names because docker containers can just communicate over their names.

Run hyrise container on diffrent machine

Say you want to run the cockpit (frontend, backend, influx) on machine A with the IP 123.123.123.123 and the hyrise instances on machine B with the IP 444.444.444.444. Then you need to run the following command on machine A:

docker-compose build --no-cache --build-arg VUE_APP_BACKEND_HOST=123.123.123.123 frontend && docker-compose up frontend, backend, influx

On machine B you need to run:

docker-compose up hyrise_1 hyrise_2

You can add the hyrise instances in the frontend UI (click on database, click on add database, enter host and port) with:

(hyrise_1)
host: 444.444.444.444 port: 5432

and

(hyrise_2)
host: 444.444.444.444 port: 6432

Access hyrise via psql

If the hyrise containers are running on your local machine run the following command to access hyrise_1:

psql -h 0.0.0.0 -p 5432

and

psql -h 0.0.0.0 -p 6432

to access hyrise_2.

If the hyrise instances are running on a different machine for example with the IP 123.123.123.123 run:

(To access hyrise_1)
psql -h 123.123.123.123 -p 5432

(To access hyrise_2)
psql -h 123.123.123.123 -p 6432

Quick fixes

  • If docker throws an error with the hyrise containers, try to build it manually with: docker image build --no-cache --tag hyrise/bp1920:hyrise ./hyrise
  • If you have problems building the hyrise image try to reduce the threads for make: for example, if the default four threads are too many and you want to change it to two adjust ENV ENV THREADS 4 in the docker file (in hyrise/Dockerfile) to ENV THREADS 2.
Clone this wiki locally