Skip to content

2. Setup

DΓ©nes Csala edited this page Apr 10, 2021 · 9 revisions

Set up the project folder

Start by cloning git clone https://github.com/denesdata/roeim.git (old repo name .../covid19-romania.git) this repository into a folder of your choice. Then, before you can docker-compose up, you will need to jump through a few hoops.

  • BTW, first thing is to install docker-compose, if you haven't already: apt install docker-compose
  • Next, go into sudo, as docker is a bit picky with non-superusers: sudo bash

Then, after pulling everything, you should end up with a docker-compose.yml and a traefik.toml file, as well as a jupyter folder, with a Dockerfile in it.

Passwords

The next thing you want to do is to set up your passwords.

  1. First, go into the jupyter/Dockerfile and change YOUR_PASSWORD_HERE with your chosen password to access Jupyter.
  2. Next, in the terminal type: export INFLUXDB_ADMIN_PASSWORD=YOUR_PASSWORD_HERE and change YOUR_PASSWORD_HERE with your chosen password for the InfluxDB admin user.
  3. Next, in the terminal type: export INFLUXDB_USER_PASSWORD=YOUR_PASSWORD_HERE and change YOUR_PASSWORD_HERE with your chosen password for InfluxDB editor user.
  4. Next, in the terminal type: export DOCKER_INFLUXDB_INIT_PASSWORD=YOUR_PASSWORD_HERE and change YOUR_PASSWORD_HERE with your chosen password for InfluxDB editor user. You will need to be on the same user account for this step to work, as the one from where you intend to docker-compose up at the end. I.e., if you are sudo now you will have to use the root account to docker-compose up.
  5. Finally, we need to set up the Traefik monitor. You may want to read this tutorial before you start.
  • We’ll use the htpasswd utility to create this encrypted password.
  • First, install the utility, which is included in the apache2-utils package: sudo apt-get install apache2-utils
  • Then generate the password with htpasswd command: htpasswd -nb admin YOUR_PASSWORD_HERE. Substitute YOUR_PASSWORD_HERE with the password you’d like to use for the Traefik admin user.
  • The output from the program will look like this: admin:$apr1$uca84Hq$mbjdMZBAG.KWn7vfN/SNK/. We will use this output in the Traefik configuration file to set up HTTP Basic Authentication for the Traefik health check and monitoring dashboard. Copy the entire output line so you can paste it later.

Traefik

Now we're ready to configure Traefik to route our services correctly. Create a dummy certificate file and set its correct permissions.

  • touch acme.json
  • chmod 600 acme.json
  • Next up, edit the traefik.toml file and change every path containing myserv.er to your server's domain.
  • Then, in the users section replace <YOUR_HASH_HERE> with your Traefik password hash generated with htpasswd at the previous step.

Services

Finally, you will need to configure the correct addresses for your services for Traefik in the docker-compose.yml file.

  • Edit the docker-compose.yml file and change every path containing myserv.er to your server's domain.
  • Do not change any ports, unless you also do it in traefik.toml.
  • Set up any custom environment variables, such as Grafana plugins or InfluxDB databases.

Start

πŸš€ If you did everything correctly, then following command should lift you off:

  • docker-compose up
  • If you get a network not found error, try docker network create web
  • You might want to use docker-compose up -d --build instead to run in detached mode (in the background), and force an image build (although it will build on first run anyway).
  • On migration and upgrades you might want to start with a clean Docker environment. For this stop and remove all containers (docker-compose down in the root directory of your project) and remove all unused images (docker image prune -a - be careful to understand what this means.)
  • After that, run docker-compose up -d again and you should see all your data nicely preserved, but not the styling. For this run the styling script again covered at the end of this section.

πŸ‘‰ Continue by starting the 3. Run.

Clone this wiki locally