Spring boot application deployed to google app engine and a request to an endpoint respond correctly with hard-coded text as expected. Apart from the default port 8080
exposed, another TCP:8595
is also exposed where data with be published to that port by tracking devices.
The problem is when i tested to get tcp connection with telnet projectid.appspot.com 8595
i get this response Connecting To projectid.appspot.com...Could not open connection to the host, on port 8595: Connect failed
, thought locally a connection is made without failure.
How can an application hosted in app engine expose ports?
Disclaimer: I'm new to App Engine and GCP
As it states in the docs, you should be able to set port forwarding in your app.yaml and then exposing it via Firewall rules.
1.) port forwarding
Debugging idea: with AppEngine Flex you can SSH into the instance for further debugging (App Engine > Instances , SSH button next to your instance).
After you logged in, you should be able to run this docker command to see the ports exposed (in my case I exposed 8081 in my
app.yaml
):You can even check if it listens or not (in my case it's an HTTP service replying correctly 404):
(for telnet you'll need to install it with
sudo apt-get update && sudo apt-get install -y telnet
)If this shows your port, then the next step is to double check your firewall settings.
2.) Firewall setup
However this will only let you access your app through the VM instance IP directly! (you can find your IP in the console or by listing your instances
gcloud compute instances list
)See the description of forwarded_ports in the docs