team-3/local_run/compose.yml
2025-08-02 00:45:04 +02:00

109 lines
2.8 KiB
YAML

# SPDX-FileCopyrightText: 2024 NOI Techpark
# SPDX-FileCopyrightText: 2024 https://github.com/c3nav/c3nav
#
# SPDX-License-Identifier: Apache-2.0
# Initially Copied from https://github.com/c3nav/c3nav/blob/034f8fe4633be3a982e94fd9e2f1fbc6d3dfafe1/deployment/docker/compose.yaml
x-restart-policy: &restart-policy
restart: unless-stopped
x-depends_on-default: &depends_on
condition: service_started
x-depends_on-healthy: &depends_on-healthy
condition: service_healthy
x-healthcheck_defaults: &healthcheck_defaults
interval: 10s
timeout: 2s
retries: 5
start_period: 5s
x-c3nav-defaults: &c3nav-defaults
build:
context: ..
dockerfile: docker/Dockerfile
args:
- COMMIT=${COMMIT}
depends_on:
redis:
<<: *depends_on-healthy
postgres:
<<: *depends_on-healthy
volumes:
- type: bind
source: ${C3NAV_DOCKER_DATA_DIR:-./data}
target: /data
bind:
create_host_path: true
x-c3nav-environment: &c3nav-environment
C3NAV_DEBUG: false
C3NAV_LOGLEVEL: info
C3NAV_CONFIG: /data/c3nav.cfg
C3NAV_DATA_DIR: /data
C3NAV_DJANGO_ALLOWED_HOSTS: localhost,127.0.0.1,c3nav-core,c3nav-tiles,${C3NAV_DJANGO_ALLOWED_HOSTS:-""},${C3NAV_DOMAIN}
C3NAV_DJANGO_REVERSE_PROXY: "true"
UWSGI_WORKERS: ${C3NAV_CORE_WORKERS:-2}
C3NAV_DATABASE_BACKEND: postgresql
C3NAV_DATABASE_NAME: ${C3NAV_DATABASE_NAME:-c3nav}
C3NAV_DATABASE_USER: ${C3NAV_DATABASE_USER:-postgres}
C3NAV_DATABASE_HOST: postgres
C3NAV_REDIS: "redis://redis:6379/0"
C3NAV_CELERY_BROKER: "redis://redis:6379/1"
C3NAV_CELERY_BACKEND: "redis://redis:6379/2"
services:
c3nav-core:
<<: [*restart-policy, *c3nav-defaults]
command: webstatic
environment:
<<: *c3nav-environment
C3NAV_AUTOMIGRATE: yes
healthcheck:
<<: *healthcheck_defaults
test: curl -f http://localhost:8000/
ports:
- "${SERVER_PORT:-8000}:8000"
c3nav-workers:
<<: [*restart-policy, *c3nav-defaults]
command: worker
environment:
<<: *c3nav-environment
C3NAV_AUTOMIGRATE: no
healthcheck:
interval: 30s
timeout: 15s
retries: 2
start_period: 5s
test: entrypoint worker_healthcheck
postgres:
<<: *restart-policy
image: postgres:16
healthcheck:
<<: *healthcheck_defaults
test: pg_isready -U postgres
environment:
POSTGRES_DB: ${C3NAV_DATABASE_NAME:-c3nav}
POSTGRES_HOST_AUTH_METHOD: "trust"
volumes:
- "c3nav-postgres:/var/lib/postgresql/data"
redis:
<<: *restart-policy
image: redis:7.2
command: redis-server --save 60 1 --loglevel warning
healthcheck:
<<: *healthcheck_defaults
test: redis-cli ping
volumes:
- "c3nav-redis:/data"
ulimits:
nofile:
soft: 10032
hard: 10032
volumes:
c3nav-postgres:
external: true
c3nav-redis:
external: true