Scenario

The service is running and unreachable

The process is alive, its own log says it is listening, and it answers from the machine itself. From outside, nothing gets through.

Monitoring has been reporting orders-api down for three hours. The on-call engineer logged in, checked, and could not see it: the process is up, the port is listening, the request goes through. The ticket was closed as a false alarm. Monitoring is still complaining.

The symptom

From the machine itself everything is fine. From anywhere else the connection never establishes.

$ sudo service orders-api status
orders-api is running

$ curl -s http://localhost:8080/
orders-api ok

$ curl -sS --max-time 3 http://$(hostname -I | awk '{print $1}'):8080/
curl: (7) Failed to connect to 172.18.0.5 port 8080 after 0 ms: Couldn't connect to server

Look at the last command. hostname -I prints the machine's address on the network (yours will differ). That address is how everyone except you reaches the service.

What you have to end up with

Three conditions. The service listens on every address of the machine, not only on loopback (127.0.0.1). The API answers orders-api ok on the machine's outside address. And the program file /usr/local/bin/orders-api is unchanged: this scenario is about configuration, and the code needs no rewriting.

How to work through "running but unreachable"

First: "the process is up" and "the service is reachable" are two different claims, and different commands answer them. ps answers the first. ss -ltnp an

Free with account

Finish this lesson with a free account

This lesson is free once you sign in. Create an account to keep reading and open the lab.

Create a free account

Already have an account? Sign in