Sync deploy: backend, frontend, worker, docker, config

This commit is contained in:
Azouhri Abdelaziz
2026-02-04 18:56:53 +01:00
parent 7183125a0d
commit 4cfe6500c2

View File

@@ -4,7 +4,14 @@
# Use this as "Docker Compose Location" in Coolify: docker/docker-compose.coolify-merged.yml
# Base Directory: /. Build contexts (backend, worker, frontend) are relative to Base Directory.
# Set all env vars in Coolify Environment Variables.
# Merges: base + staging-standalone + staging + staging-prod-frontend + staging-prod-api + prod + monitoring.
#
# Built-in for Coolify:
# - Traefik labels on frontend and api-gateway: public URL and /api routing + HTTPS (letsencrypt).
# Set TRAEFIK_PUBLIC_HOST in Coolify env to change domain (default app.getlinkzen.com).
# - prisma-init service: runs db push + seed once after Postgres is ready; api-gateway waits for it.
# So you do NOT need to add domains in Coolify UI for frontend/api or run Prisma manually.
# If Traefik routing or HTTPS does not work, Coolify may use different entry point names
# (e.g. web/websecure); then use docs/coolify-proxy-app-getlinkzen.yaml as fallback.
# =============================================================================
services:
@@ -222,12 +229,36 @@ services:
reservations:
memory: 512M
# One-time DB schema + seed (runs after Postgres is healthy; api-gateway waits for it)
prisma-init:
build:
context: backend
dockerfile: Dockerfile.prod
container_name: toolsplatform-prisma-init
restart: "no"
env_file:
- .env
environment:
DATABASE_URL: postgresql://postgres:${DB_PASSWORD:-postgres}@postgres:5432/${DB_NAME:-toolsplatform}?schema=app
command: ["sh", "-c", "npx prisma db push --accept-data-loss && npx prisma db seed"]
depends_on:
postgres:
condition: service_healthy
networks:
- backend
api-gateway:
build:
context: backend
dockerfile: Dockerfile.prod
container_name: toolsplatform-api-gateway
restart: unless-stopped
depends_on:
postgres: { condition: service_started }
redis: { condition: service_started }
minio: { condition: service_started }
keycloak: { condition: service_started }
prisma-init: { condition: service_completed_successfully }
env_file:
- .env
environment:
@@ -256,11 +287,6 @@ services:
IMAGOR_URL: http://imagor:8000
REMBG_URL: http://rembg:7000
LANGUAGETOOL_URL: http://languagetool:8010
depends_on:
- postgres
- redis
- minio
- keycloak
networks:
- backend
- frontend
@@ -268,6 +294,15 @@ services:
ports:
- "4000:4000"
deploy:
labels:
# Public URL + /api -> this service (priority so /api wins over frontend)
- "traefik.enable=true"
- "traefik.http.routers.tools-api.rule=Host(\"${TRAEFIK_PUBLIC_HOST:-app.getlinkzen.com}\") && PathPrefix(\"/api\")"
- "traefik.http.routers.tools-api.priority=10"
- "traefik.http.routers.tools-api.entrypoints=http,https"
- "traefik.http.routers.tools-api.service=tools-api-svc"
- "traefik.http.routers.tools-api.tls.certresolver=letsencrypt"
- "traefik.http.services.tools-api-svc.loadbalancer.server.port=4000"
resources:
limits:
memory: 1536M
@@ -335,6 +370,13 @@ services:
ports:
- "${FRONTEND_PORT:-3000}:3000"
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.tools-frontend.rule=Host(\"${TRAEFIK_PUBLIC_HOST:-app.getlinkzen.com}\")"
- "traefik.http.routers.tools-frontend.entrypoints=http,https"
- "traefik.http.routers.tools-frontend.service=tools-frontend-svc"
- "traefik.http.routers.tools-frontend.tls.certresolver=letsencrypt"
- "traefik.http.services.tools-frontend-svc.loadbalancer.server.port=3000"
resources:
limits:
memory: 512M