edumanagerpro2/docker-compose.yml

171 lines
5.4 KiB
YAML

version: '3.8'
services:
# ============================
# BANCO DE DADOS PRINCIPAL
# ============================
postgres:
image: postgres:15-alpine
restart: always
environment:
POSTGRES_DB: edumanager
POSTGRES_USER: edumanager
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-EduManager2026!Seguro}
volumes:
- pgdata:/var/lib/postgresql/data
- ./schema.sql:/docker-entrypoint-initdb.d/01_schema.sql
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U edumanager"]
interval: 10s
timeout: 5s
retries: 5
networks:
- edumanager-internal
# ============================
# STORAGE S3-COMPATIBLE (MINIO)
# ============================
minio:
image: minio/minio:latest
restart: always
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-MiniO2026!Seguro}
volumes:
- miniodata:/data
ports:
- "9000:9000" # API S3
- "9001:9001" # Console Web
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 10s
timeout: 5s
retries: 5
networks:
- edumanager-internal
- traefik-public
deploy:
labels:
- "traefik.enable=true"
- "traefik.http.routers.minio.rule=Host(`storageedu.microtecinformaticacurso.com.br`)"
- "traefik.http.routers.minio.entrypoints=websecure"
- "traefik.http.routers.minio.tls.certresolver=letsencrypt"
- "traefik.http.services.minio.loadbalancer.server.port=9000"
# Cria os buckets automaticamente na primeira vez
minio-init:
image: minio/mc:latest
depends_on:
minio:
condition: service_healthy
entrypoint: >
/bin/sh -c "
mc alias set local http://minio:9000 $${MINIO_ROOT_USER:-minioadmin} $${MINIO_ROOT_PASSWORD:-MiniO2026!Seguro};
mc mb --ignore-existing local/fotos-alunos;
mc mb --ignore-existing local/documentos;
mc mb --ignore-existing local/atestados;
mc mb --ignore-existing local/logos;
mc mb --ignore-existing local/exames;
mc mb --ignore-existing local/carnes;
mc anonymous set download local/fotos-alunos;
mc anonymous set download local/documentos;
mc anonymous set download local/logos;
mc anonymous set download local/exames;
mc anonymous set download local/carnes;
echo '✅ Buckets criados com sucesso!';
"
networks:
- edumanager-internal
# ============================
# EDUMANAGER (PAINEL ADMIN)
# ============================
edumanager:
build:
context: ./manager
dockerfile: Dockerfile
restart: always
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
environment:
- NODE_ENV=production
- PORT=3000
- DATABASE_URL=postgresql://edumanager:${POSTGRES_PASSWORD:-EduManager2026!Seguro}@postgres:5432/edumanager
- JWT_SECRET=${JWT_SECRET:-EduManager-JWT-Secret-2026!}
- MINIO_ENDPOINT=minio
- MINIO_PORT=9000
- MINIO_ACCESS_KEY=${MINIO_ROOT_USER:-minioadmin}
- MINIO_SECRET_KEY=${MINIO_ROOT_PASSWORD:-MiniO2026!Seguro}
- MINIO_PUBLIC_URL=${MINIO_PUBLIC_URL:-https://storageedu.microtecinformaticacurso.com.br}
- ASAAS_API_KEY=${ASAAS_API_KEY}
- ASAAS_API_URL=${ASAAS_API_URL}
- ASAAS_WEBHOOK_TOKEN=${ASAAS_WEBHOOK_TOKEN}
networks:
- edumanager-internal
- traefik-public
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.http.routers.edumanager.rule=Host(`edumanager.microtecinformaticacurso.com.br`)"
- "traefik.http.routers.edumanager.entrypoints=websecure"
- "traefik.http.routers.edumanager.tls.certresolver=letsencrypt"
- "traefik.http.services.edumanager.loadbalancer.server.port=3000"
# ============================
# PORTAL DO ALUNO
# ============================
portalaluno:
build:
context: ./portal
dockerfile: Dockerfile
restart: always
depends_on:
postgres:
condition: service_healthy
environment:
- NODE_ENV=production
- PORT=3001
- DATABASE_URL=postgresql://edumanager:${POSTGRES_PASSWORD:-EduManager2026!Seguro}@postgres:5432/edumanager
- JWT_SECRET=${JWT_SECRET:-EduManager-JWT-Secret-2026!}
- MINIO_ENDPOINT=minio
- MINIO_PORT=9000
- MINIO_ACCESS_KEY=${MINIO_ROOT_USER:-minioadmin}
- MINIO_SECRET_KEY=${MINIO_ROOT_PASSWORD:-MiniO2026!Seguro}
- MINIO_PUBLIC_URL=${MINIO_PUBLIC_URL:-https://storageedu.microtecinformaticacurso.com.br}
networks:
- edumanager-internal
- traefik-public
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.http.routers.portalaluno.rule=Host(`portal.microtecinformaticacurso.com.br`)"
- "traefik.http.routers.portalaluno.entrypoints=websecure"
- "traefik.http.routers.portalaluno.tls.certresolver=letsencrypt"
- "traefik.http.services.portalaluno.loadbalancer.server.port=3001"
volumes:
pgdata:
driver: local
miniodata:
driver: local
networks:
edumanager-internal:
driver: overlay
traefik-public:
external: true