- Acceso del alumno o tutor con link de un solo uso (hash SHA-256, consumo atómico, el GET no consume), sesión propia de 90 días deslizante, passkeys opcionales (SimpleWebAuthn) y mail de recuperación con rate limit. - Lado alumno (/i/:token, /acceso, /alumno/*): inicio, clases, avisar falta, pagos, informar pago con comprobante (S3 privado, magic bytes) y perfil. - Lado profe: acceso a la app en la ficha del alumno (invitar/reinvitar), "Pagos para verificar" en Cobros con badge, faltas avisadas en la ficha de grupo y datos para transferir en Ajustes. - "Requiere atención" y el recordatorio de WhatsApp excluyen cuotas informadas. - Zona horaria por defecto: Buenos Aires. - Migración add_student_access, tests contra Postgres real (test:db) y docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
137 lines
6.5 KiB
YAML
137 lines
6.5 KiB
YAML
# 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 <no-reply@gruperly.com>}"
|
|
# 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:-}
|
|
# Suscripcion a Gruperly Pro (docs/billing.md): credenciales de las cuentas de MP
|
|
# de Gruperly, una por pais. Un pais sin las dos variables no ofrece Pro (503).
|
|
MP_PLATFORM_ACCESS_TOKEN_AR: ${MP_PLATFORM_ACCESS_TOKEN_AR:-}
|
|
MP_PLATFORM_WEBHOOK_SECRET_AR: ${MP_PLATFORM_WEBHOOK_SECRET_AR:-}
|
|
MP_PLATFORM_ACCESS_TOKEN_BR: ${MP_PLATFORM_ACCESS_TOKEN_BR:-}
|
|
MP_PLATFORM_WEBHOOK_SECRET_BR: ${MP_PLATFORM_WEBHOOK_SECRET_BR:-}
|
|
MP_PLATFORM_ACCESS_TOKEN_CL: ${MP_PLATFORM_ACCESS_TOKEN_CL:-}
|
|
MP_PLATFORM_WEBHOOK_SECRET_CL: ${MP_PLATFORM_WEBHOOK_SECRET_CL:-}
|
|
MP_PLATFORM_ACCESS_TOKEN_CO: ${MP_PLATFORM_ACCESS_TOKEN_CO:-}
|
|
MP_PLATFORM_WEBHOOK_SECRET_CO: ${MP_PLATFORM_WEBHOOK_SECRET_CO:-}
|
|
MP_PLATFORM_ACCESS_TOKEN_MX: ${MP_PLATFORM_ACCESS_TOKEN_MX:-}
|
|
MP_PLATFORM_WEBHOOK_SECRET_MX: ${MP_PLATFORM_WEBHOOK_SECRET_MX:-}
|
|
MP_PLATFORM_ACCESS_TOKEN_PE: ${MP_PLATFORM_ACCESS_TOKEN_PE:-}
|
|
MP_PLATFORM_WEBHOOK_SECRET_PE: ${MP_PLATFORM_WEBHOOK_SECRET_PE:-}
|
|
MP_PLATFORM_ACCESS_TOKEN_UY: ${MP_PLATFORM_ACCESS_TOKEN_UY:-}
|
|
MP_PLATFORM_WEBHOOK_SECRET_UY: ${MP_PLATFORM_WEBHOOK_SECRET_UY:-}
|
|
# `on` aplica los limites del plan Free; cualquier otro valor deja a todos en Pro.
|
|
BILLING_ENFORCEMENT: ${BILLING_ENFORCEMENT:-off}
|
|
BILLING_GRACE_DAYS: ${BILLING_GRACE_DAYS:-7}
|
|
# App de alumnos: comprobantes de pago en un storage S3 privado (RustFS). Sin
|
|
# las cuatro primeras, "Informar pago" responde 503 y el resto funciona igual.
|
|
S3_ENDPOINT: ${S3_ENDPOINT:-}
|
|
S3_BUCKET: ${S3_BUCKET:-}
|
|
S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-}
|
|
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:-}
|
|
S3_REGION: ${S3_REGION:-us-east-1}
|
|
S3_VIRTUAL_HOSTED: ${S3_VIRTUAL_HOSTED:-}
|
|
# Dias que se guarda un comprobante ya revisado. 0 = para siempre.
|
|
RECEIPT_RETENTION_DAYS: ${RECEIPT_RETENTION_DAYS:-0}
|
|
# WebAuthn (Face ID / huella del alumno): por defecto salen de WEB_URL.
|
|
WEBAUTHN_RP_ID: ${WEBAUTHN_RP_ID:-}
|
|
WEBAUTHN_ORIGIN: ${WEBAUTHN_ORIGIN:-}
|
|
# Traefik + nginx delante de la API: la IP del cliente es la 2da desde el final
|
|
# de X-Forwarded-For (rate limit de "Pedir un link a mi mail").
|
|
TRUSTED_PROXY_HOPS: ${TRUSTED_PROXY_HOPS:-2}
|
|
# WhatsApp (recordatorios de pago y reenganche semanales). Ver docs/whatsapp.md.
|
|
# `openwa` (MVP, gateway instalado aparte) o `kapso` (API oficial de Meta). Sin las
|
|
# variables del proveedor elegido, /whatsapp/* responde 503 y el paso del
|
|
# onboarding es salteable.
|
|
WHATSAPP_PROVIDER: ${WHATSAPP_PROVIDER:-openwa}
|
|
# Pausa entre dos envios del mismo profesor (ms). No bajar de ~4000 con OpenWA.
|
|
WHATSAPP_SEND_INTERVAL_MS: ${WHATSAPP_SEND_INTERVAL_MS:-5000}
|
|
# OpenWA se instala por separado (no vive en este compose): URL de su API,
|
|
# p. ej. https://openwa.example.com/api.
|
|
OPENWA_API_URL: ${OPENWA_API_URL:-}
|
|
# Key OPERATOR sin `allowedSessions` (crea sesiones). Se crea con la key ADMIN
|
|
# que OpenWA escribe en /app/data/.api-key la primera vez que arranca.
|
|
OPENWA_API_KEY: ${OPENWA_API_KEY:-}
|
|
# Opcional: sin webhook la vinculacion funciona igual (polling), pero no se
|
|
# registran las confirmaciones de entrega/lectura. Tiene que ser una URL que
|
|
# OpenWA alcance: <WEB_URL>/api/v1/whatsapp/webhooks/openwa (requiere el secreto).
|
|
OPENWA_WEBHOOK_URL: ${OPENWA_WEBHOOK_URL:-}
|
|
OPENWA_WEBHOOK_SECRET: ${OPENWA_WEBHOOK_SECRET:-}
|
|
KAPSO_API_KEY: ${KAPSO_API_KEY:-}
|
|
KAPSO_CALLBACK_URL: ${KAPSO_CALLBACK_URL:-}
|
|
KAPSO_WEBHOOK_URL: ${KAPSO_WEBHOOK_URL:-}
|
|
KAPSO_WEBHOOK_SECRET: ${KAPSO_WEBHOOK_SECRET:-}
|
|
|
|
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
|