- panel/Dockerfile: python3.12-slim + git (estampar) + docker-cli/compose (desplegar vía socket del host); imagen solo-dependencias, el código y el estado llegan por bind mount del repo en /opt/collina-smart-assistant (misma ruta que el host → git archive y compose funcionan idénticos) - panel/docker-compose.yml: labels Traefik reales (routers csa-panel, certresolver letsencrypt), red externa coolify, sin ports: publicados, env_file panel/.env (llave maestra existente), PANEL_DB en el mount, healthcheck, restart unless-stopped - panel servir: --host parametrizado (default 127.0.0.1; 0.0.0.0 en contenedor); nuevo GET /health público para healthchecks - panel/Dockerfile.dockerignore: contexto mínimo (no viaja a réplicas) - README del panel: sección de despliegue VPS con la tabla de persistencia - 3 tests nuevos: 193 verdes; smoke real del contenedor (health/login/ git archive/docker cli) ejecutado localmente
62 lines
2.7 KiB
YAML
62 lines
2.7 KiB
YAML
# Panel madre en el VPS, detrás de Traefik (Coolify) con HTTPS Let's Encrypt.
|
|
# docker compose -f panel/docker-compose.yml up -d --build
|
|
#
|
|
# Persistencia: TODO el estado vive en el host vía el bind mount del repo
|
|
# (/opt/collina-smart-assistant): panel/panel.db, panel/.env (llave maestra,
|
|
# vía env_file), replicas/ y registry.json. Recrear el contenedor NO pierde
|
|
# admins ni fichas cifradas.
|
|
#
|
|
# Seguridad: SIN `ports:` — el 8090 no se publica al host; solo Traefik
|
|
# lo alcanza por la red `coolify`. SIN PANEL_COOKIE_SECURE: el default es
|
|
# true (cookie Secure), correcto detrás de HTTPS real.
|
|
|
|
name: csa-panel
|
|
|
|
services:
|
|
panel:
|
|
build:
|
|
context: ..
|
|
dockerfile: panel/Dockerfile
|
|
image: csa-panel
|
|
container_name: csa-panel
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env # → /opt/collina-smart-assistant/panel/.env (PANEL_MASTER_KEY ya generada en el VPS)
|
|
environment:
|
|
PANEL_DB: /opt/collina-smart-assistant/panel/panel.db
|
|
volumes:
|
|
# Repo completo, MISMA ruta que el host: código + .git (estampar) +
|
|
# panel.db + replicas/. Es la capa de persistencia.
|
|
- /opt/collina-smart-assistant:/opt/collina-smart-assistant
|
|
# Socket del daemon del HOST: habilita el botón «Desplegar» (el
|
|
# contenedor solo trae el CLI). Nota de seguridad: el socket equivale
|
|
# a root en el host; el panel exige login y no publica puertos.
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
networks:
|
|
- coolify
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request as u; u.urlopen('http://localhost:8090/health', timeout=3)"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 15s
|
|
labels:
|
|
- traefik.enable=true
|
|
- traefik.http.middlewares.gzip.compress=true
|
|
- traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
|
|
- traefik.http.routers.http-csa-panel.entryPoints=http
|
|
- traefik.http.routers.http-csa-panel.middlewares=redirect-to-https
|
|
- traefik.http.routers.http-csa-panel.rule=Host(`csa.collinasystems.com.mx`) && PathPrefix(`/`)
|
|
- traefik.http.routers.http-csa-panel.service=csa-panel
|
|
- traefik.http.routers.https-csa-panel.entryPoints=https
|
|
- traefik.http.routers.https-csa-panel.middlewares=gzip
|
|
- traefik.http.routers.https-csa-panel.rule=Host(`csa.collinasystems.com.mx`) && PathPrefix(`/`)
|
|
- traefik.http.routers.https-csa-panel.service=csa-panel
|
|
- traefik.http.routers.https-csa-panel.tls=true
|
|
- traefik.http.routers.https-csa-panel.tls.certresolver=letsencrypt
|
|
- traefik.http.services.csa-panel.loadbalancer.server.port=8090
|
|
|
|
networks:
|
|
coolify:
|
|
external: true
|