Files
stiftung-management-system/deploy-production/docker-compose.prod.yml
Stiftung Development fa6d1b64df Add Paperless-ngx to production deployment
- Add Paperless-ngx service to Docker Compose configuration
- Configure nginx routing for /paperless/ path with large file support
- Add production environment variables for Paperless
- Create automated setup script for initial Paperless configuration
- Add comprehensive production setup documentation
- Configure Paperless with HTTPS and proper database setup
- Update Django app to use production Paperless instance
2025-09-09 22:00:32 +02:00

200 lines
5.4 KiB
YAML

version: '3.8'
services:
db:
image: postgres:15-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./backups:/backups
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 30s
timeout: 10s
retries: 5
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
web:
build:
context: ./app
dockerfile: Dockerfile
restart: unless-stopped
environment:
- DEBUG=False
- ALLOWED_HOSTS=${ALLOWED_HOSTS}
- SECRET_KEY=${SECRET_KEY}
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
volumes:
- ./app/media:/app/media
- ./app/static:/app/static
- ./backups:/app/backups
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
ports:
- "127.0.0.1:8000:8000"
worker:
build:
context: ./app
dockerfile: Dockerfile
restart: unless-stopped
command: celery -A core worker -l info --concurrency=2
environment:
- DEBUG=False
- SECRET_KEY=${SECRET_KEY}
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
volumes:
- ./app/media:/app/media
- ./backups:/app/backups
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
beat:
build:
context: ./app
dockerfile: Dockerfile
restart: unless-stopped
command: celery -A core beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
environment:
- DEBUG=False
- SECRET_KEY=${SECRET_KEY}
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
volumes:
- ./app/media:/app/media
- ./backups:/app/backups
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
deploy:
resources:
limits:
memory: 256M
cpus: '0.25'
grampsweb:
image: ghcr.io/gramps-project/grampsweb:latest
restart: unless-stopped
environment:
GRAMPSWEB_TREE: ${GRAMPSWEB_TREE:-Stiftung}
GRAMPSWEB_SECRET_KEY: ${GRAMPSWEB_SECRET_KEY}
GRAMPSWEB_ADMIN_EMAIL: ${GRAMPSWEB_ADMIN_EMAIL}
GRAMPSWEB_ADMIN_PASSWORD: ${GRAMPSWEB_ADMIN_PASSWORD}
volumes:
- gramps_users:/app/users
- gramps_index:/app/indexdir
- gramps_thumb_cache:/app/thumbnail_cache
- gramps_cache:/app/cache
- gramps_secret:/app/secret
- ./media:/app/media
ports:
- "127.0.0.1:5000:5000"
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
paperless:
image: ghcr.io/paperless-ngx/paperless-ngx:latest
restart: unless-stopped
depends_on:
- db
- redis
ports:
- "127.0.0.1:8080:8000"
healthcheck:
test: ["CMD", "curl", "-fs", "-S", "--max-time", "2", "http://localhost:8000"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- paperless_data:/usr/src/paperless/data
- paperless_media:/usr/src/paperless/media
- paperless_export:/usr/src/paperless/export
- paperless_consume:/usr/src/paperless/consume
environment:
PAPERLESS_REDIS: redis://redis:6379
PAPERLESS_DBHOST: db
PAPERLESS_DBNAME: ${PAPERLESS_DB:-paperless}
PAPERLESS_DBUSER: ${PAPERLESS_USER:-paperless}
PAPERLESS_DBPASS: ${PAPERLESS_PASSWORD:-paperless}
PAPERLESS_ADMIN_USER: ${PAPERLESS_ADMIN_USER:-admin}
PAPERLESS_ADMIN_PASSWORD: ${PAPERLESS_ADMIN_PASSWORD:-admin}
PAPERLESS_ADMIN_MAIL: ${PAPERLESS_ADMIN_MAIL:-admin@localhost}
PAPERLESS_SECRET_KEY: ${PAPERLESS_SECRET_KEY}
PAPERLESS_URL: https://vhtv-stiftung.de/paperless
PAPERLESS_ALLOWED_HOSTS: vhtv-stiftung.de,www.vhtv-stiftung.de
PAPERLESS_CORS_ALLOWED_HOSTS: https://vhtv-stiftung.de,https://www.vhtv-stiftung.de
PAPERLESS_TRUSTED_PROXIES: 172.16.0.0/12,10.0.0.0/8,192.168.0.0/16
PAPERLESS_FORCE_SCRIPT_NAME: /paperless
PAPERLESS_STATIC_URL: /paperless/static/
deploy:
resources:
limits:
memory: 2G
cpus: '1.0'
volumes:
postgres_data:
redis_data:
gramps_users:
gramps_index:
gramps_thumb_cache:
gramps_cache:
gramps_secret:
paperless_data:
paperless_media:
paperless_export:
paperless_consume:
networks:
default:
driver: bridge