Deployment problem with node + postgres [ docker compose ]
parvez-ahammed
FREEOP

a year ago

This is my docker-compose.yml file.

services:
    db:
        image: postgres:17.2-alpine
        container_name: ${PROJECT_NAME}-db
        networks:
            - dev-jots-net
        ports:
            - '${DB_PORT}:5432'
        environment:
            - POSTGRES_USER=${DB_USER}
            - POSTGRES_PASSWORD=${DB_PASSWORD}
            - POSTGRES_DB=${DB_NAME}
        volumes:
            - db-data:/var/lib/postgresql/data
        healthcheck:
            test: ['CMD', 'pg_isready', '-U', '${DB_USER}', '-d', '${DB_NAME}']
            interval: 10s
            timeout: 5s
            retries: 5

    app:
        build:
            context: .
            dockerfile: Dockerfile
        container_name: ${PROJECT_NAME}-app
        networks:
            - dev-jots-net
        ports:
            - '${PORT}:3000'
        environment:
            - DB_HOST=db
            - DB_PORT=${DB_PORT}
            - DB_USER=${DB_USER}
            - DB_PASSWORD=${DB_PASSWORD}
            - DB_NAME=${DB_NAME}
        volumes:
            - .:/app
            - /app/node_modules
        depends_on:
            db:
                condition: service_healthy

networks:
    dev-jots-net:
        driver: bridge

volumes:
    db-data:
        driver: local

and this is my

env vars

DB_HOST="dev-jots-db.railway.internal"

DB_NAME="dev_jots"

ENABLE_ALPINE_PRIVATE_NETWORKING="true"

so I am getting the error

[2025-03-22T12:48:27.344Z] Error: Error: getaddrinfo ENOTFOUND dev-jots-db.railway.internal

Mar 22 18:48:27

at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26)

so what is the problem here and what am i doing wrong ?

3 Replies

a year ago

Private networking is not available during the build process. Railway supports specifying a pre-deploy command: https://docs.railway.com/guides/pre-deploy-command.


uxuz

Private networking is not available during the build process. Railway supports specifying a pre-deploy command: <https://docs.railway.com/guides/pre-deploy-command>.

parvez-ahammed
FREEOP

a year ago

This is actually my deploy logs.


a year ago

Please do not run a development build in production. Furthermore, this looks like an application level issue, keep in mind that private networking is IPv6 only.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...