Files
ISSSTELEON/docker-compose.yml
T

96 lines
2.6 KiB
YAML

# Development stack built from source. The installable package is in dist/.
x-api: &api
build:
context: .
dockerfile: WebApi/Dockerfile
image: isssteleon/webapi:dev
# SQLite files in the webapi_data volume by default; point the
# *_DATABASE_URL variables at another engine in .env (see .env.example).
env_file:
- path: .env
required: false
volumes:
- webapi_data:/data
services:
webapi:
<<: *api
volumes:
- webapi_data:/data
- notebook_jobs:/trabajos
environment:
# Notebooks uploaded from Gobernanza are left here for the `notebooks`
# service; their folders are handed to its user.
NOTEBOOK_JOBS_DIR: /trabajos
NOTEBOOK_RUNNER_UID: "10001"
ports:
# 5000 on the host is taken by AirPlay on macOS.
- "5050:5000"
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/health', timeout=5)"]
interval: 15s
timeout: 6s
retries: 5
start_period: 180s
# Recomputes a domain's indicators after an import writes to it.
indicadores:
<<: *api
command: ["indicadores"]
depends_on:
webapi:
condition: service_healthy
# One-shot (`docker compose run --rm entrenar`): exports the latest CaCu
# surveillance cohort build, trains cin2_logistic on it and puts that version
# in production, so the `indicadores` service estimates risks on each cycle.
# Run it after the first load; it's a no-op once the version is trained.
entrenar:
<<: *api
profiles: [entrenar]
command: ["entrenar"]
depends_on:
webapi:
condition: service_healthy
# Runs the notebooks uploaded from Gobernanza, isolated: no network, a
# read-only system, an unprivileged user and only the jobs folder. Same
# image as webapi; the jobs folder must be mounted at the same path in both.
notebooks:
image: isssteleon/webapi:dev
command: ["notebooks"]
user: "10001:10001"
network_mode: none
read_only: true
tmpfs:
- /tmp
environment:
NOTEBOOK_JOBS_DIR: /trabajos
NOTEBOOK_RENDERER: jupyter
HOME: /tmp
JUPYTER_RUNTIME_DIR: /tmp/jupyter
volumes:
- notebook_jobs:/trabajos
cap_drop: [ALL]
security_opt: ["no-new-privileges:true"]
mem_limit: 4g
cpus: 2
pids_limit: 256
depends_on:
- webapi
webapp:
build:
context: ./WebApp
image: isssteleon/webapp:dev
# nginx with the production build, proxying the API paths to webapi
# (WebApp/nginx.conf).
ports:
- "8080:80"
depends_on:
- webapi
volumes:
webapi_data:
notebook_jobs: