Skip to content

rdmorganiser/rdmo-docker-compose

Repository files navigation

RDMO Docker Compose build

! Please note that the configuration mechanism of this docker setup has changed. Configuration is now a plain .env file in the root folder of the repository. Please see Configuration & Usage for more information.

This repository contains RDMO docker images that are held together by docker compose which obviously is required to make use of it. If not configured differently the built RDMO instance should be available at localhost:8484. Please see below how setting can be changed.

Structure

Dockers

Four containers are going to be created: Caddy, PostgreSQL, RDMO, and a short-lived fixperms helper. caddy, postgres and rdmo each run as an unprivileged, UID/GID-mapped user rather than root. fixperms runs once, as root, before the other three start: it creates vol/log and vol/postgres if they don't exist yet and makes sure they (and the rest of vol/) are owned by that same UID/GID, then exits. This is only needed because docker would otherwise create missing bind-mount folders as root, which the unprivileged containers couldn't write to; the three long-running services never run as root themselves.

Volumes

VOLDIR on the docker host (vol/ next to docker-compose.yaml by default, see VOLDIR in Configuration & Usage to relocate it, e.g. to a different disk) holds everything that needs to persist or be shared between containers:

  1. log log files
  2. postgres database
  3. rdmo-app rdmo app installation

Note that VOLDIR is bind-mounted directly (not a named docker volume), so any folder created inside it is available inside the caddy and the rdmo container and may be used to transfer data between the docker host and these two containers.

Configuration & Usage

  1. Declare your settings in a root-level .env file

    The basic settings are stored in .env.defaults. These settings are loaded and passed to the containers but can be overwritten in a .env file next to it in the repository root (this file is git-ignored). You only need to declare the keys you actually want to change; everything else falls back to the defaults.

    Please note that you might need to change the ALLOWED_HOSTS entry depending on your server setup. The URL or IP under which RDMO is served needs to be allowed by putting it into the list. Usually the allowed hosts are declared in the local.py. In this docker compose setup we decided to move it to an environment variable instead, which might need to be adjusted.

    It is possible to change the restart policy of all three Docker services via changing the RESTART_POLICY variable.

    VOLDIR controls where persistent data (see Volumes) is stored on the docker host; it defaults to ./vol but can be set to an absolute path to store it elsewhere.

  2. Build and run the stack

    Plain docker compose up -d --build works out of the box, docker-compose.yaml ships sensible defaults for every setting. Optionally, install Task for a bit of convenience on top (matches build args to your host UID/GID, adds shortcuts like task logs or task sh, see task --list for all of them) and run task instead. Neither is required to use the other.

  3. Maybe create an RDMO user

    Note that we decided not to automatically create any user account for the freshly created RDMO instance. You may want to do this manually.

    # connect to the docker
    docker exec -ti rdc-rdmo bash
    
    # do either
    python manage.py createsuperuser
    # or
    python manage.py create_admin_user
  4. Import data from rdmo-catalog

    A fresh RDMO installation does not contain any data. You may want to import conditions, domains, options, questions, tasks and views. In the RDMO container there is a shell script that automatically clones the rdmo-catalog repo and imports everything in it. If you consider it being helpful you could do import-github-catalogues.sh.

Multiple RDMO Instances on a Single Docker Host

You can have multiple running RDMO instances on a single docker host as long as you pay attention to three things.

  1. Use different folders containing the rdmo-docker-compose repo to make sure docker compose considers your build attempts to be different projects.
  2. Make sure to use different GLOBAL_PREFIX settings in your .env to avoid conflicts between your docker containers and volumes.
  3. And obviously change the FINALLY_EXPOSED_PORT settings to make sure to use a free port to expose RDMO.

About

RDMO running in different docker images held together by docker compose

Resources

License

Stars

3 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors