fix: compliance con directrices de red coolify y limpieza de variables de entorno

This commit is contained in:
urieljareth
2026-08-13 15:03:25 -06:00
parent f7fded5a44
commit 9a07a7b9b3
4 changed files with 70 additions and 57 deletions
+4 -3
View File
@@ -1,8 +1,9 @@
# Variables de Entorno para Coolify # Variables de Entorno para Producción en Coolify
PORT=3000 PORT=3000
NODE_ENV=production NODE_ENV=production
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=encuesta_e3 POSTGRES_DB=encuesta_e3
POSTGRES_USER=postgres POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres_password_e3 POSTGRES_PASSWORD=your_coolify_postgres_password
DATABASE_URL=postgresql://postgres:postgres_password_e3@db:5432/encuesta_e3
ADMIN_SECRET=RESETEOE3 ADMIN_SECRET=RESETEOE3
+4 -7
View File
@@ -1,17 +1,14 @@
# Configuración del Servidor y Base de Datos PostgreSQL # Variables de Entorno - Encuesta de Votación Consultoría E3
PORT=3000 PORT=3000
NODE_ENV=production NODE_ENV=production
# Conexión PostgreSQL (Formato URL o componentes individuales) # Configuración de Base de Datos PostgreSQL
DATABASE_URL=postgresql://postgres:postgres_password_e3@db:5432/encuesta_e3
# Variables alternativas de PostgreSQL
POSTGRES_HOST=db POSTGRES_HOST=db
POSTGRES_PORT=5432 POSTGRES_PORT=5432
POSTGRES_DB=encuesta_e3 POSTGRES_DB=encuesta_e3
POSTGRES_USER=postgres POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres_password_e3 POSTGRES_PASSWORD=your_secure_password_here
DATABASE_SSL=false DATABASE_SSL=false
# Clave secreta para funciones de administrador (Restablecer votos) # Clave secreta para panel de administración (Restablecer votos)
ADMIN_SECRET=RESETEOE3 ADMIN_SECRET=RESETEOE3
+35 -25
View File
@@ -1,44 +1,54 @@
# Docker Compose optimizado para despliegue en Coolify
# Cumple con todas las directrices de docs/AGENTS-coolify-apps.md
services: services:
web: web:
build: build: .
context: .
dockerfile: Dockerfile
restart: unless-stopped restart: unless-stopped
ports: expose:
- "3000:3000" - "3000"
environment: environment:
- NODE_ENV=production NODE_ENV: production
- PORT=3000 PORT: "3000"
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres_password_e3}@db:5432/${POSTGRES_DB:-encuesta_e3} POSTGRES_HOST: db
- ADMIN_SECRET=${ADMIN_SECRET:-RESETEOE3} POSTGRES_PORT: "5432"
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ADMIN_SECRET: ${ADMIN_SECRET}
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/health"]
interval: 20s
timeout: 5s
retries: 3
start_period: 15s
depends_on: depends_on:
db: - db
condition: service_healthy
networks: networks:
- app-network - coolify
db: db:
image: postgres:16-alpine image: postgres:16-alpine
restart: unless-stopped restart: unless-stopped
environment: environment:
- POSTGRES_DB=${POSTGRES_DB:-encuesta_e3} POSTGRES_DB: ${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER:-postgres} POSTGRES_USER: ${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres_password_e3} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - encuesta-db-data:/var/lib/postgresql/data
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-postgres} -d $${POSTGRES_DB:-encuesta_e3}"] test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 10s start_period: 10s
networks: networks:
- app-network - coolify
networks:
app-network:
driver: bridge
volumes: volumes:
postgres_data: encuesta-db-data: {}
driver: local
networks:
coolify:
name: coolify
external: true
+27 -22
View File
@@ -1,43 +1,48 @@
services: services:
web: web:
build: build: .
context: . restart: unless-stopped
dockerfile: Dockerfile
ports: ports:
- "3000:3000" - "3000:3000"
environment: environment:
- NODE_ENV=production NODE_ENV: production
- PORT=3000 PORT: "3000"
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres_password_e3}@db:5432/${POSTGRES_DB:-encuesta_e3} POSTGRES_HOST: db
- ADMIN_SECRET=${ADMIN_SECRET:-RESETEOE3} POSTGRES_PORT: "5432"
POSTGRES_DB: ${POSTGRES_DB:-encuesta_e3}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres_local_password}
ADMIN_SECRET: ${ADMIN_SECRET:-RESETEOE3}
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/health"]
interval: 20s
timeout: 5s
retries: 3
start_period: 15s
depends_on: depends_on:
db: - db
condition: service_healthy
networks: networks:
- app-network - default
db: db:
image: postgres:16-alpine image: postgres:16-alpine
restart: unless-stopped
ports: ports:
- "5432:5432" - "5432:5432"
environment: environment:
- POSTGRES_DB=${POSTGRES_DB:-encuesta_e3} POSTGRES_DB: ${POSTGRES_DB:-encuesta_e3}
- POSTGRES_USER=${POSTGRES_USER:-postgres} POSTGRES_USER: ${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres_password_e3} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres_local_password}
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - encuesta-db-data-local:/var/lib/postgresql/data
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-postgres} -d $${POSTGRES_DB:-encuesta_e3}"] test: ["CMD-SHELL", "pg_isready -U postgres -d encuesta_e3"]
interval: 5s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 10s start_period: 10s
networks: networks:
- app-network - default
networks:
app-network:
driver: bridge
volumes: volumes:
postgres_data: encuesta-db-data-local: {}