137 lines
3.5 KiB
YAML
137 lines
3.5 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
web:
|
|
image: "vlafvlaf/karrot_frontend:test"
|
|
depends_on:
|
|
- app
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost/"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 30
|
|
networks:
|
|
- proxy
|
|
volumes:
|
|
- "app_data:/app/uploads"
|
|
deploy:
|
|
update_config:
|
|
failure_action: rollback
|
|
order: start-first
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
|
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
|
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
|
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
|
- "coop-cloud.${STACK_NAME}.version=0.0.1+testing"
|
|
|
|
app:
|
|
image: "vlafvlaf/karrot_backend:test"
|
|
networks:
|
|
- internal
|
|
depends_on:
|
|
- postgres
|
|
- redis
|
|
volumes:
|
|
- "shiv_data:/root/.shiv"
|
|
- "geoip_data:/var/lib/GeoIP"
|
|
- "app_data:/app/uploads"
|
|
environment:
|
|
- SITE_URL=http://localhost:8080
|
|
- LISTEN_HOST=0.0.0.0
|
|
- LISTEN_SERVER=uvicorn
|
|
- SECRET_KEY=foobar
|
|
- DATABASE_HOST=postgres
|
|
- DATABASE_PORT=5432
|
|
- DATABASE_NAME=karrot
|
|
- DATABASE_USER=karrot
|
|
- DATABASE_PASSWORD=karrot
|
|
- REDIS_HOST=redis
|
|
- REDIS_PORT=6379
|
|
- REDIS_DB=0
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/api/"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 90
|
|
command: >
|
|
sh -c "
|
|
echo 'EditionIDs GeoLite2-City GeoLite2-Country' > /etc/GeoIP.conf &&
|
|
echo AccountID $${MAXMIND_ACCOUNT_ID} >> /etc/GeoIP.conf &&
|
|
echo LicenseKey $${MAXMIND_LICENSE_KEY} >> /etc/GeoIP.conf &&
|
|
echo 'Updating geoip data, first time could be slow...' &&
|
|
geoipupdate &&
|
|
pip install tzdata &&
|
|
python karrot-backend.pyz migrate &&
|
|
python karrot-backend.pyz server
|
|
"
|
|
worker:
|
|
image: "vlafvlaf/karrot_backend:test"
|
|
depends_on:
|
|
# shiv + geoip data gets loaded on the first run of the app
|
|
# so to ensure it's available in the worker too, we need to wait
|
|
- app
|
|
volumes:
|
|
- "shiv_data:/root/.shiv"
|
|
- "geoip_data:/var/lib/GeoIP"
|
|
networks:
|
|
- internal
|
|
environment:
|
|
- SITE_URL=http://localhost:8080
|
|
- LISTEN_HOST=0.0.0.0
|
|
- LISTEN_SERVER=uvicorn
|
|
- SECRET_KEY=foobar
|
|
- DATABASE_HOST=postgres
|
|
- DATABASE_PORT=5432
|
|
- DATABASE_NAME=karrot
|
|
- DATABASE_USER=karrot
|
|
- DATABASE_PASSWORD=karrot
|
|
- REDIS_HOST=redis
|
|
- REDIS_PORT=6379
|
|
- REDIS_DB=0
|
|
command:
|
|
sh -c "
|
|
pip install tzdata &&
|
|
python karrot-backend.pyz worker"
|
|
|
|
redis:
|
|
image: "redis:6-alpine"
|
|
command: ["redis-server", "--appendonly", "yes"]
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 1s
|
|
timeout: 3s
|
|
retries: 30
|
|
volumes:
|
|
- "redis_data:/data"
|
|
networks:
|
|
- internal
|
|
|
|
postgres:
|
|
image: "postgres:12-alpine"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U karrot"]
|
|
interval: 1s
|
|
timeout: 3s
|
|
retries: 30
|
|
volumes:
|
|
- "postgres_data:/var/lib/postgresql/data"
|
|
networks:
|
|
- internal
|
|
environment:
|
|
- POSTGRES_PASSWORD=karrot
|
|
- POSTGRES_USER=karrot
|
|
- POSTGRES_DB=karrot
|
|
|
|
volumes:
|
|
shiv_data:
|
|
geoip_data:
|
|
app_data:
|
|
postgres_data:
|
|
redis_data:
|
|
networks:
|
|
proxy:
|
|
external: true
|
|
internal:
|