Manually setting PORT for Docker Image
I'm running a docker image (kong) that listens on 8000 by default.
As it doesn't use PORT, I have manually added PORT=8000 as a variable (which is mentioned as an alternative in Fixing Common Errors [0] ).
When I make a request via public url, I get "Application failed to respond".
When I run the same image locally, I can make request to 8000 without an issue, so I'm not sure could have gone wrong.
I would appreciate any help!
[0] https://docs.railway.app/troubleshoot/fixing-common-errors#application-error-this-application-failed-to-respond
43 Replies
Project ID:
34a3782b-6485-41f9-923a-6b3b9753ab6e
project id:
34a3782b-6485-41f9-923a-6b3b9753ab6e
how is your port defined ?
in the docker
if you dont need to listen to port8000
then make your kong listen to the env var 'PORT'
railway should populate it with their chosen port during deployment
OP said Kong doesn't use PORT, there is plenty of software that use hardcoded ports, so settings a PORT variable to the same port the software listens on works too
@ChubbyAvocado will need more info though, is port 8000 running an http server?
Yes, it’s an api gateway so it mainly just routes to other http services.
Locally I don’t have any issue making http requests to 8000 but something seems messed up with the deployment on railway 😔
okay then it also needs to be listening on the host 0.0.0.0, Kong probably has some way to configure the host it listens on
look into that
Thanks, I believe the default is 0.0.0.0:8000 (I will double check).
https://docs.konghq.com/gateway/latest/reference/configuration/#nginx-section
Kong Docs
Configuration Reference for Kong Gateway - v3.4.x | Kong Docs
Documentation for Kong, the Cloud Connectivity Company for APIs and Microservices.
there also stuff about SSL and HTTPS, and http2, make sure you only listen on http 1.1 with no SSL of any kind
As far as I can tell it's http 1.1 only without ssl. 🥲
Any other idea on what else could have gone worng or how to further debug this?
you have set a PORT service variable to 8000 right?
yeah!
does Kong have a docker image?
i'm using kong:3.4.2
https://hub.docker.com/_/kong
kong - Official Image | Docker Hub
The Cloud-Native API Gateway for APIs and Microservices
ill see what i can do
kong listens on multiple ports
right 8000 is for proxy 8001 is admin api
8002 is admin dashboard
you cant access a railway service publicly from multiple ports
even if i only need to expose one port?
if you only care about exposing one port, then it doesnt matter
what do you want to expose? the admin gui?
8000
that's the proxy
how do you plan on configuring kong if you are exposing the proxy instead of the admin gui
for now, I can connect to postgres directly (spin up gui locally and connect to railway postgres where kong config is stored).
I guess later assuming I can access 8001 internally, the other backend service will send requests to 8001 to control kong.
their docs suck, send me the page where they list all of the env vars you can use?
seriously, these docs sucks https://docs.konghq.com/gateway/latest/production/environment-variables/
GitHub
kong/kong.conf.default at master · Kong/kong
🦍 The Cloud-Native API Gateway . Contribute to Kong/kong development by creating an account on GitHub.
yeah lol
i also tried to find it once and this is the best i found so far
those arent env vars though
my understanding is that these map to env var
e.g. proxy_listen -> KONG_PORXY_LISTEN
you're missing thelog_level
setting ->KONG_LOG_LEVEL
env variable
KONG
prefixdumb
but yes those should all map over
@luna oh yeah that's important 🙏
if you cant get that one working btw this very likely works with envs
https://hub.docker.com/r/bitnami/kong/
I also tried to make some requests via private network (another railway service) just for debugging purposes and that also didn't work...
(calling http://${APP_NAME}.railway.internal:8000 from another service).
thanks! I don't think env var is an issue here though (based on debug logs and it also connects to the postgres without an issue)
that for sure wouldnt work, the proxy listens on 0.0.0.0, and ipv4 address but the private network is ipv6 only
I see 😦
neither images are behaving
i give up
@Brody Thanks for trying!
sorry i couldnt solve it
maybe i will try find an alternative this point lol
caddy
I'm not familiar with it. Does it support rate-limting and key authentication? (for third-party access)
Those were the main reasons for considering Kong.
im sure you could yeah
https://caddyserver.com/
cool, I will check it out.