personlin / docker-seiscomp3

SeisComP3 ported to Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-seiscomp3

A Dockerfile to create a SeisComP3 image for Docker.

Build

git clone https://github.com/eost/docker-seiscomp3.git
cd docker-seiscomp3
docker build -t seiscomp3:latest .

Configuration

Here is a docker-compose example file:

version: '2.1'

services:
    # Define database docker
    db:
        image: postgres:10-alpine
        environment:
            POSTGRES_USER: sysop
            POSTGRES_PASSWORD: sysop
            POSTGRES_DB: seiscomp3
        volumes:
            # Mount database in a permanent volume
            - db:/var/lib/postgresql/data
        ports:
            # Allow external database connection
            - "10000:5432"

    seiscomp3:
        image: seiscomp3:latest
        environment:
            # Used to start GUI applications
            DISPLAY: unix$DISPLAY
        volumes:
            # `/data/seiscomp3` is copied at the start of the docker in
            # `/opt/seiscomp3`.
            - ./seiscomp3:/data/seiscomp3
            # `/data/.seiscomp3` is copied at the start of the docker in
            # `/home/sysop/.seiscomp3`.
            - ./.seiscomp3:/data/.seiscomp3
            # This volume is used to keep the state of the modules. A deamon is
            # running to copy every `*.auto` file of the
            # `/opt/seiscomp3/etc/init` folder in the `/data/init` folder so
            #that the container can be restarted in the same state.
            - ./init:/data/init
            # Configuration folder
            - ./etc:/opt/seiscomp3/etc
            # Mount etc/defaults, etc/descriptions and etc/init in volumes to
            # keep the files of the docker.
            - defaults:/opt/seiscomp3/etc/defaults
            - descriptions:/opt/seiscomp3/etc/descriptions
            - init:/opt/seiscomp3/etc/init
            # Mount eventually maps folder
            - path/to/maps:/opt/seiscomp3/share/maps
            # Mount locsat folder
            - path/to/seiscomp3/share/locsat:/opt/seiscomp3/share/locsat
            - ./var:/opt/seiscomp3/var
            - ./.seiscomp3/log:/home/sysop/.seiscomp3/log
            # Custom scripts under `/docker-entrypoint-init.d` will be executed
            # before starting seiscomp.
            - ./docker-entrypoint-init.d:/docker-entrypoint-init.d
            # Used to start GUI applications
            - /tmp/.X11-unix:/tmp/.X11-unix
        ports:
            # Allow external messaging system connection
            - "10001:4803"

volumes:
    # Define external volume for database
    db:
        external: True
        name: project_db
    # define named volumes which can be remove with `docker-compose down -v`
    defaults:
    descriptions:
    init:

The project_db external volume must be created before starting docker-compose:

docker volume create project_db

With this docker-compose, seiscomp3 applications like scolv can be started on the user computer:

seiscomp exec scolv -H localhost:10001 -d postgresql://sysop:sysop@localhost:10000/seiscomp3

or in the docker:

docker exec -it project_seiscomp3_1 seiscomp exec scolv

Use of Supervisor

Supervisor is used to run multiple services in the container. It basically starts 3 services:

  • Cron. This allows to start periodic tasks, such as seiscomp check.
  • Lsyncd. Lsyncd is used to synchronize every etc/init/*.auto files. This way, the SeisComP3 modules can be restarted at the start of the container.
  • SeisComP3: a seiscomp start command is executed.

About

SeisComP3 ported to Docker

License:GNU General Public License v3.0


Languages

Language:Dockerfile 79.5%Language:Shell 20.5%