Docker
The repository contains a Dockerfile
for each of the OS2datascanner
modules:
- Administration:
docker/admin/Dockerfile
- Engine:
docker/engine/Dockerfile
- Report:
docker/report/Dockerfile
Using these is the recommended way to install OS2datascanner as a developer.
To run OS2datascanner in Docker, you need a running Docker daemon. See
the official Docker documentation <https://docs.docker.com/install/>
for installation instructions.
The containers for the Admin and Report modules require a connection to
a postgres database server. It is configured with the DATABASE_*
settings. The database server must have a user and a database object. It
can be created with the help of the scripts in the
/docker/postgres-initdb.d/
folder:
docker/postgres-initdb.d/20-create-admin-db-and-user.sh
docker/postgres-initdb.d/40-create-report-db-and-user.sh
The folder can easily be mounted into /docker-entrypoint-initdb.d/
in the
official postgres docker image, and further
contains a script to ensure that all relevant environment variables have been
passed to the container:
docker/postgres-initdb.d/10-test-for-valid-env-variables.sh
To run a fully functional OS2datascanner system, you will need to start a number of services. The recommended way to set up an appropriate development environment is to use docker-compose.
User permissions
Each Dockerfile
creates a dedicated user, and any services started are run as
the user created by the related Dockerfile
. All files generated by such a
service will be owned by the respective user. For each user, the UID
and
GID
are identical:
- Administration: 73020
- Engine: 73030
- Report: 73040
If you want to use another UID/GID
, you can specify it as the
--user=uid:gid
overwrite
flag for the docker run
command or in
docker-compose.
If you change the UID/GID
, the /log
and /static
volumes may not have the
right permissions. It is recommended to only use
bind if you overwrite the user
and set the same user as owner of the directory you bind.
Postgres initialisation
The postgres database is initialized using the scripts included in
docker/postgres-initdb.d/
folder, which checks that the configuration is
valid, and adds postgres users for the modules that need them. They do not
populate the database with users for the django modules or any other data.