We are trying to deploy Kong API Gateway (with a PostgreSQL database) on Railway using the following docker-compose.yml and Dockerfile. The setup works locally in Docker Desktop, but when deployed to Railway, the deployment fails. Below are the files we are using:
docker-compose.yml -------------------------
version: "3.8"
services:
kong-gateway:
image: kong/kong-gateway:3.8.0.0
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: junction.proxy.rlwy.net
KONG_PG_PORT: 45525
KONG_PG_USER: postgres
KONG_PG_PASSWORD: KJHSBdcJlvaFMOCiTXfvDGcqjpyUwPMX
KONG_PG_DATABASE: railway # Set the correct database
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_ADMIN_LISTEN: 0.0.0.0:8001
KONG_ADMIN_GUI_URL: http://localhost:8002
KONG_SSL: on # If you need SSL; adjust based on your settings
KONG_LICENSE_DATA: # Add your license data here if needed
ports:
- "8000:8000"
- "8443:8443"
- "8001:8001"
- "8444:8444"
- "8002:8002"
- "8445:8445"
- "8003:8003"
- "8004:8004"
networks:
kong-net:
Dockerfile -------------------------
FROM kong/kong-gateway:3.8.0.0
ENV KONG_DATABASE=postgres
ENV KONG_PG_HOST=junction.proxy.rlwy.net
ENV KONG_PG_USER=postgres
ENV KONG_PG_PASSWORD=KJHSBdcJlvaFMOCiTXfvDGcqjpyUwPMX
ENV KONG_PROXY_ACCESS_LOG=/dev/stdout
ENV KONG_ADMIN_ACCESS_LOG=/dev/stdout
ENV KONG_PROXY_ERROR_LOG=/dev/stderr
ENV KONG_ADMIN_ERROR_LOG=/dev/stderr
ENV KONG_ADMIN_LISTEN=0.0.0.0:8001
ENV KONG_ADMIN_GUI_URL=http://localhost:8002
EXPOSE 8000 8443 8001 8444 8002 8445 8003 8004
CMD ["kong", "docker-start"]
We receive the following error during deployment in deploy logs:
( Check comments for error )