Skip to content
Snippets Groups Projects
Commit e7f68003 authored by Klaas Kliffen's avatar Klaas Kliffen :satellite:
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
inputs/*
inputs/*
!inputs/.gitkeep
FROM postgres:13-bullseye
# Install extensions
RUN DEBIAN_FRONTEND='noninteractive' && \
apt-get update && \
apt-get install -y postgresql-13-pgsphere && \
apt-get install -y postgresql-13-q3c && \
apt-get clean
FROM debian:bullseye
# Everyday tools
RUN DEBIAN_FRONTEND='noninteractive' \
&& apt-get update \
&& apt-get install -y \
curl \
git \
gnupg2 \
locales \
procps \
wget \
mupdf-tools \
&& apt-get clean
# BUILD argument for extra repositories (besides debian/stable) to install dachs.
# Options are:
# - backports (debian/backports)
# - gavo or latest: (gavo/release + gavo/beta)
# - main (debian/main)
# * If not defined, default is 'latest'
ARG INSTALL_REPO="${INSTALL_REPO:-latest}"
ENV REPO_RELEASE='deb http://vo.ari.uni-heidelberg.de/debian release main'
ENV REPO_BETA='deb http://vo.ari.uni-heidelberg.de/debian beta main'
ENV REPO_BACKPORT='deb http://deb.debian.org/debian bullseye-backports main contrib'
ENV APT_SOURCES="/etc/apt/sources.list.d/gavo.list"
COPY etc/apt_sources.list "$APT_SOURCES"
ARG PG_VERSION=13
ENV PG_VERSION=${PG_VERSION}
# Setup GAVO key, then repositories according to INSTALL_REPO
RUN wget -qO - http://docs.g-vo.org/archive-key.asc | apt-key add -
RUN [ "$INSTALL_REPO" != "main" ] \
&& sed -i '/deb.*backports/s/^#//' $APT_SOURCES \
|| echo "NOT using debian/backports repo"
RUN [ "$INSTALL_REPO" = "gavo" -o "$INSTALL_REPO" = "latest" ] \
&& sed -i '/deb.*heidelberg/s/^#//' $APT_SOURCES \
|| echo "NOT using gavo beta/release repos"
RUN echo "Using the following repositories:" && grep "deb" $APT_SOURCES
# Define some important env
ENV GAVO_ROOT="/var/gavo"
ENV GAVO_INPUTS="${GAVO_ROOT}/inputs"
ENV GAVO_SETTINGS="/etc/gavo.rc"
ENV GAVOSETTINGS="$GAVO_SETTINGS"
# Install only the core of gavo and spatial extension to db
RUN DEBIAN_FRONTEND='noninteractive' && \
apt-get update && \
apt-get install -y python3-gavo && \
apt-get install -y postgresql-$PG_VERSION-q3c && \
apt-get clean
# Setup dachs environment
RUN addgroup --system gavo && \
adduser --system --ingroup gavo gavo && \
adduser --disabled-password --gecos "" --ingroup gavo dachsroot && \
adduser --quiet gavo gavo && \
adduser --quiet dachsroot gavo && \
mkdir -m 775 "${GAVO_ROOT}" && \
chown dachsroot "${GAVO_ROOT}" && \
mkdir -m 775 "${GAVO_INPUTS}" && \
chown dachsroot "${GAVO_INPUTS}"
# Copy gavo settings
COPY etc/gavo.rc "$GAVO_SETTINGS"
# Add a 'port' variable to env
ENV GAVO_PORT=8080
EXPOSE $GAVO_PORT
COPY bin/serve.sh /serve.sh
ENTRYPOINT ["/bin/bash"]
CMD ["--rcfile", "/serve.sh"]
# Dachs on Docker
A more robust version of Dachs on Docker using modern docker practices.
Main change compared to upstream is the usage of a default Postgres image
with some additional plugins installed for faster indices.
## Building Images
```bash
docker compose build
```
## Running Dachs
```bash
# First time, start DB and let it initialize:
docker compose up postgres
# then CTRL^C to exit & start both
docker compose up -d
```
### Interact with Dachs:
To interact with the container via the shell:
```bash
docker exec -it dachs bash
```
Your data can be shared with the container via the inputs directory.
This is mounted at `/var/gavo/inputs/` inside the container.
**TODO**: Look into if it is possible to put symlinks in the inputs directory.
su dachsroot -c "gavo init -d 'host=${POSTGRES_HOST} user=${POSTGRES_USER} password=${POSTGRES_PASSWORD} dbname=${POSTGRES_DB} '"
dachs serve start --foreground
services:
postgres:
build:
dockerfile: Docker/Dockerfile.dachs_postgres
image: astron-sdc/gavodachs-postgres
volumes:
- postgres-db:/usr/local/pgsql/data
environment:
POSTGRES_DB: "gavo"
POSTGRES_USER: "dachsroot"
POSTGRES_PASSWORD: "supersecret"
dachs:
build:
dockerfile: Docker/Dockerfile.dachs_server
image: astron-sdc/gavodachs-server
container_name: dachs
environment:
POSTGRES_HOST: "postgres"
POSTGRES_DB: "gavo"
POSTGRES_USER: "dachsroot"
POSTGRES_PASSWORD: "supersecret"
tty: true
volumes:
- ./inputs:/var/gavo/inputs
depends_on:
- postgres
ports:
- "8080:8080"
volumes:
postgres-db:
driver: local
# The following repos extend the (lts) Dachs debian/main distribution:
# + (Debian) Backports provides upgrades, quote:
# "which you don't want if you don't look at your service, but which
# you do want if, say, you'd like a few new fancy UDFs or so." -- Markus;
# + (GAVO) Release and Beta: you get the bleeding edge.
# Debian backports repo
#deb http://deb.debian.org/debian bullseye-backports main contrib
# GAVO release repo
#deb http://vo.ari.uni-heidelberg.de/debian release main
# GAVO beta repo
#deb http://vo.ari.uni-heidelberg.de/debian beta main
[web]
sitename: Dachs-on-Docker
bindAddress:
serverPort: 8080
serverURL: http://localhost:8080
logFormat: combined
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment