# Coolify-Deployment (Testserver, intern) — abgeleitet von docker-compose.yml. # Unterschiede zum lokalen Dev-Compose: # - keine host "ports": Coolify-Proxy routet die Domain intern auf app:3000 # - Konfiguration über Coolify-Env-Variablen statt env_file: .env # - Service "migrate": Init-Job (prisma migrate deploy), läuft einmalig VOR app # - kein mailhog/worker (Dev bzw. noch nicht lauffähig) # In Coolify als "Docker Compose Location" -> docker-compose.coolify.yml setzen. services: # Einmaliger Migrations-Job. Nutzt die builder-Stage (volle node_modules inkl. # Prisma-CLI/tsx), da die runner-Stage kein Prisma-CLI enthält. Idempotent. # Optionaler Demo-Seed nur, wenn RUN_DEMO_SEED=true (Testserver) — der Seed ist # idempotent (upserts). In Produktion die Variable NICHT setzen. migrate: build: context: . target: builder command: sh -c "npx prisma migrate deploy && if [ \"$$RUN_DEMO_SEED\" = \"true\" ]; then echo '>> Demo-Seed läuft…'; npx tsx prisma/seed.ts; fi && if [ \"$$BOOTSTRAP_ADMIN\" = \"true\" ]; then echo '>> Bootstrap-Admin läuft…'; npx tsx scripts/bootstrap-admin.ts; fi" environment: DATABASE_URL: ${DATABASE_URL} # Test: Demo-Seed. Produktiv: stattdessen BOOTSTRAP_ADMIN (Erst-Superadmin). RUN_DEMO_SEED: ${RUN_DEMO_SEED:-false} BOOTSTRAP_ADMIN: ${BOOTSTRAP_ADMIN:-false} BOOTSTRAP_ADMIN_EMAIL: ${BOOTSTRAP_ADMIN_EMAIL:-} BOOTSTRAP_ADMIN_PASSWORD: ${BOOTSTRAP_ADMIN_PASSWORD:-} BOOTSTRAP_ADMIN_NAME: ${BOOTSTRAP_ADMIN_NAME:-} BOOTSTRAP_TENANT_NAME: ${BOOTSTRAP_TENANT_NAME:-} BOOTSTRAP_TENANT_SLUG: ${BOOTSTRAP_TENANT_SLUG:-} BOOTSTRAP_TENANT_SHORT: ${BOOTSTRAP_TENANT_SHORT:-} BOOTSTRAP_TENANT_SECTOR: ${BOOTSTRAP_TENANT_SECTOR:-} depends_on: postgres: condition: service_healthy restart: "no" app: build: context: . target: runner environment: DATABASE_URL: ${DATABASE_URL} REDIS_URL: ${REDIS_URL} AUTH_SECRET: ${AUTH_SECRET} AUTH_URL: ${AUTH_URL} # Hinter dem Coolify/Traefik-Proxy zwingend für Auth.js v5 (sonst UntrustedHost). AUTH_TRUST_HOST: ${AUTH_TRUST_HOST:-true} S3_ENDPOINT: ${S3_ENDPOINT} S3_ACCESS_KEY: ${S3_ACCESS_KEY} S3_SECRET_KEY: ${S3_SECRET_KEY} S3_BUCKET: ${S3_BUCKET} AI_PROVIDER: ${AI_PROVIDER} AI_API_KEY: ${AI_API_KEY} SMTP_HOST: ${SMTP_HOST} SMTP_PORT: ${SMTP_PORT} SMTP_USER: ${SMTP_USER} SMTP_PASSWORD: ${SMTP_PASSWORD} SMTP_FROM: ${SMTP_FROM} depends_on: postgres: condition: service_healthy redis: condition: service_started minio: condition: service_started migrate: condition: service_completed_successfully healthcheck: # Dependency-frei (node ist im Image vorhanden); alles < 500 gilt als gesund test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:3000/',r=>process.exit(r.statusCode<500?0:1)).on('error',()=>process.exit(1))"] interval: 15s timeout: 5s retries: 10 start_period: 30s restart: unless-stopped postgres: image: pgvector/pgvector:pg16 environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB} volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] interval: 5s timeout: 5s retries: 10 restart: unless-stopped redis: image: redis:7-alpine volumes: - redisdata:/data restart: unless-stopped minio: image: minio/minio:latest command: server /data --console-address ":9001" environment: MINIO_ROOT_USER: ${MINIO_ROOT_USER} MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} volumes: - miniodata:/data restart: unless-stopped volumes: pgdata: redisdata: miniodata: