Unable to Deploy Kong API Gateway with PostgreSQL on Railway

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 )
No description
4 Replies
Percy
Percy2mo ago
Project ID: N/A
SonicLabs
SonicLabsOP2mo ago
We receive the following error during deployment in deploy logs: Starting Container Sep 24 17:52:38 2024/09/24 12:22:38 [warn] 1#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:7 Sep 24 17:52:38 nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/kong/nginx.conf:7 Sep 24 17:52:43 2024/09/24 12:22:38 [error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:689: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: timeout Sep 24 17:52:43 stack traceback: Sep 24 17:52:43 [C]: in function 'assert' Sep 24 17:52:43 /usr/local/share/lua/5.1/kong/init.lua:689: in function 'init' Sep 24 17:52:43 init_by_lua(nginx-kong.conf:57):3: in main chunk Sep 24 17:52:43 nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:689: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: timeout Sep 24 17:52:43 stack traceback: Sep 24 17:52:43 [C]: in function 'assert' Sep 24 17:52:43 /usr/local/share/lua/5.1/kong/init.lua:689: in function 'init' Sep 24 17:52:43 init_by_lua(nginx-kong.conf:57):3: in main chunk The error seems related to the PostgreSQL connection timing out. Can anyone provide guidance or help with why this might be happening in Railway?
jeremy
jeremy2mo ago
FYI, docker compose is not supported by Railway https://docs.railway.app/guides/dockerfiles#docker-compose
Railway Docs
Build from a Dockerfile | Railway Docs
Documentation for Railway
SonicLabs
SonicLabsOP2mo ago
Can we run the deployed Kong API template Gateway in local using railway CLI ??? What is the command?
Want results from more Discord servers?
Add your server