# Deploy on Dokploy (or `docker compose up --build` anywhere). # # The public domain is exposed once, on `web`: nginx serves the Vite bundle and # proxies /api to the `api` container. That keeps the session cookie # first-party (no SameSite=None needed) and makes the CORS preflight # unnecessary. If you rather have the API on its own subdomain, drop the # `location /api/` block from apps/web/nginx.conf and set VITE_API_URL when # building web. x-backend-env: &backend-env NODE_ENV: production # Web and API share the public domain: same origin for cookies and CORS. DATABASE_URL: "${DATABASE_URL:?falta DATABASE_URL}" WEB_URL: "${WEB_URL:?falta WEB_URL - origen publico de la app, sin barra final}" BETTER_AUTH_URL: "${WEB_URL:?falta WEB_URL - origen publico de la app, sin barra final}" BETTER_AUTH_SECRET: "${BETTER_AUTH_SECRET:?falta BETTER_AUTH_SECRET - generalo con openssl rand -base64 32}" GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-} GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET:-} EMAIL_PROVIDER: ${EMAIL_PROVIDER:-smtp} EMAIL_SERVER_HOST: ${EMAIL_SERVER_HOST:-} EMAIL_SERVER_PORT: ${EMAIL_SERVER_PORT:-587} EMAIL_SERVER_USER: ${EMAIL_SERVER_USER:-} EMAIL_SERVER_PASSWORD: ${EMAIL_SERVER_PASSWORD:-} EMAIL_FROM: "${EMAIL_FROM:-Gruperly }" # Mercado Pago OAuth. Opcionales: sin credenciales, GET /mp/connect responde # 503 mp_not_configured y la app sigue funcionando (el paso es salteable). MP_CLIENT_ID: ${MP_CLIENT_ID:-} MP_CLIENT_SECRET: ${MP_CLIENT_SECRET:-} # Tiene que coincidir con la "Redirect URL" del panel de MP, character por # character. En produccion, HTTPS y la URL publica de la API. MP_REDIRECT_URI: ${MP_REDIRECT_URI:-} # Clave de 32 bytes en base64 (openssl rand -base64 32) para cifrar los tokens # en reposo. Sin ella, mp/callback falla al guardar la cuenta. TOKEN_ENCRYPTION_KEY: ${TOKEN_ENCRYPTION_KEY:-} services: api: build: context: . dockerfile: Dockerfile.backend target: api environment: *backend-env restart: unless-stopped expose: - "4000" networks: - default - dokploy-network web: build: context: . dockerfile: Dockerfile.web target: web args: # Baked into the bundle. Empty = same origin (nginx's /api proxy). VITE_API_URL: ${VITE_API_URL:-} restart: unless-stopped depends_on: - api ports: # Host publishing, only for local testing. On Dokploy the domain goes to # port 80 of the container: Traefik does not go through the mapping. - "8080:80" networks: - default # Dokploy adds dokploy-network only to the service with a domain, so it has # to be declared explicitly for Traefik to reach this container. - dokploy-network # Dokploy shared network: that is where the databases Dokploy manages live. # Without it, the api container neither resolves nor reaches the database and # Prisma fails with P1001 "Can't reach database server". # # Outside Dokploy you have to create it once, before the first `docker compose up`: # docker network create dokploy-network networks: dokploy-network: external: true