Fix: Usar host único de Postgres para evitar conflictos en red compartida
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m5s

Cambio de 'postgres' a 'lotes-postgres' para evitar errores 28P01 causados
por resolución de DNS a instancias incorrectas en la red principal.
This commit is contained in:
2025-11-22 01:35:27 -06:00
parent 6331199e4a
commit a395dcbd62
4 changed files with 6 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ POSTGRES_USER=seguidor
POSTGRES_PASSWORD=seguidor_password
POSTGRES_DB=seguidor_lotes
POSTGRES_PORT=5432
NUXT_POSTGRES_URL=postgres://seguidor:seguidor_password@postgres:5432/seguidor_lotes
NUXT_POSTGRES_URL=postgres://seguidor:seguidor_password@lotes-postgres:5432/seguidor_lotes
# ===========================================
# REGISTRY AUTHENTICATION (solo para CI/CD)

View File

@@ -89,7 +89,7 @@ UVA-001 (2086kg)
- `APP_NAME` - `lotes`
- `APP_DOMAIN` - `lotes.nucleoriofrio.com`
- `NUXT_PUBLIC_APP_URL` - `https://lotes.nucleoriofrio.com`
- `NUXT_POSTGRES_URL` - `postgres://seguidor:seguidor_password@postgres:5432/seguidor_lotes`
- `NUXT_POSTGRES_URL` - `postgres://seguidor:seguidor_password@lotes-postgres:5432/seguidor_lotes`
- `POSTGRES_USER` - `seguidor`
- `POSTGRES_DB` - `seguidor_lotes`
- `POSTGRES_PORT` - `5432`

View File

@@ -39,7 +39,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- NUXT_POSTGRES_URL=${NUXT_POSTGRES_URL:-postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:${POSTGRES_PORT:-5432}/${POSTGRES_DB}}
- NUXT_POSTGRES_URL=${NUXT_POSTGRES_URL:-postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${APP_NAME}-postgres:${POSTGRES_PORT:-5432}/${POSTGRES_DB}}
networks:
- principal
- traefik-network

View File

@@ -15,7 +15,9 @@ function buildConnectionString(): string {
// Fallback para entornos locales si no se pasó NUXT_POSTGRES_URL
const user = process.env.POSTGRES_USER || 'seguidor'
const password = process.env.POSTGRES_PASSWORD || 'seguidor_password'
const host = process.env.POSTGRES_HOST || 'postgres'
const defaultHost =
process.env.APP_NAME ? `${process.env.APP_NAME}-postgres` : 'postgres'
const host = process.env.POSTGRES_HOST || defaultHost
const port = process.env.POSTGRES_PORT || '5432'
const db = process.env.POSTGRES_DB || 'seguidor_lotes'
return `postgres://${user}:${password}@${host}:${port}/${db}`