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
NODE_ENV=production
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=encuesta_e3
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres_password_e3
DATABASE_URL=postgresql://postgres:postgres_password_e3@db:5432/encuesta_e3
POSTGRES_PASSWORD=your_coolify_postgres_password
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
NODE_ENV=production
# Conexión PostgreSQL (Formato URL o componentes individuales)
DATABASE_URL=postgresql://postgres:postgres_password_e3@db:5432/encuesta_e3
# Variables alternativas de PostgreSQL
# Configuración de Base de Datos PostgreSQL
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_DB=encuesta_e3
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres_password_e3
POSTGRES_PASSWORD=your_secure_password_here
DATABASE_SSL=false
# Clave secreta para funciones de administrador (Restablecer votos)
# Clave secreta para panel de administración (Restablecer votos)
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:
web:
build:
context: .
dockerfile: Dockerfile
build: .
restart: unless-stopped
ports:
- "3000:3000"
expose:
- "3000"
environment:
- NODE_ENV=production
- PORT=3000
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres_password_e3}@db:5432/${POSTGRES_DB:-encuesta_e3}
- ADMIN_SECRET=${ADMIN_SECRET:-RESETEOE3}
NODE_ENV: production
PORT: "3000"
POSTGRES_HOST: db
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:
db:
condition: service_healthy
- db
networks:
- app-network
- coolify
db:
image: postgres:16-alpine
restart: unless-stopped
environment:
- POSTGRES_DB=${POSTGRES_DB:-encuesta_e3}
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres_password_e3}
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
- encuesta-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-postgres} -d $${POSTGRES_DB:-encuesta_e3}"]
interval: 5s
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- app-network
networks:
app-network:
driver: bridge
- coolify
volumes:
postgres_data:
driver: local
encuesta-db-data: {}
networks:
coolify:
name: coolify
external: true
+27 -22
View File
@@ -1,43 +1,48 @@
services:
web:
build:
context: .
dockerfile: Dockerfile
build: .
restart: unless-stopped
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- PORT=3000
- DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres_password_e3}@db:5432/${POSTGRES_DB:-encuesta_e3}
- ADMIN_SECRET=${ADMIN_SECRET:-RESETEOE3}
NODE_ENV: production
PORT: "3000"
POSTGRES_HOST: db
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:
db:
condition: service_healthy
- db
networks:
- app-network
- default
db:
image: postgres:16-alpine
restart: unless-stopped
ports:
- "5432:5432"
environment:
- POSTGRES_DB=${POSTGRES_DB:-encuesta_e3}
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres_password_e3}
POSTGRES_DB: ${POSTGRES_DB:-encuesta_e3}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres_local_password}
volumes:
- postgres_data:/var/lib/postgresql/data
- encuesta-db-data-local:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-postgres} -d $${POSTGRES_DB:-encuesta_e3}"]
interval: 5s
test: ["CMD-SHELL", "pg_isready -U postgres -d encuesta_e3"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- app-network
networks:
app-network:
driver: bridge
- default
volumes:
postgres_data:
encuesta-db-data-local: {}