← All articles

Engineering note · Flexi-Ride

One port per job

Project
Flexi-Ride — Internal project, Zone01 Kisumu
Issue
#58 HYG-005: Add gRPC server port config to all services; #50 HYG-003: Fix docker-compose health check URLs
My role
Author of PRs #127 and #108
Stack
Spring Boot · gRPC · Docker Compose
Status
Merged 7 Sep and 16 Sep 2026

The problem

Each Flexi-Ride service runs two servers: an embedded HTTP server for REST and Actuator, and a gRPC server for calls between services. Both need a port, and they are set separately. server.port is the HTTP port. grpc.server.port is the gRPC port.

When I picked up HYG-005, only auth (50051) and email (50053) had a gRPC port configured. The other 11 services had none. With 13 services calling each other, every one needed its own fixed port that the others could rely on.

HYG-003 was the Docker side. The issue said every health check in docker-compose.yml used http://localhost:8080/actuator/health, whatever the service's real port was. By the time I worked on it, the backend services had already been given their own ports. The two BFF gateways had not. Both still ran on 8080 inside the container, mapped to 8000 and 8001 on the host.

What I did

For HYG-005 (PR #127), I added grpc.server.port to the 11 services that were missing it, following the port map in the issue. The full map is:

  • auth 50051, user 50052, email 50053, booking 50054, driver 50055
  • leads 50056, matching 50057, notification 50058, payment 50059
  • sacco 50060, analytics 50061, audits 50062, tracking 50063

The backend HTTP ports sit in the 8080–8099 range, so the two kinds of port never overlap. I added services/GRPC_PORTS.md with the full map, so the next person doesn't have to read 13 properties files to find a port.

For HYG-003 (PR #108), I changed the two gateways so the internal port, the published port and the health-check URL all use the same number:

environment:
  - SERVER_PORT=8000
ports:
  - "8000:8000"
healthcheck:
  test: ["CMD", "curl", "-f", "http://localhost:8000/actuator/health"]

Mobile BFF got the same change with 8001.

How I checked it

For the gRPC ports, I built the services with Maven 3.9.6 and JDK 21 and started all 13 locally. I then probed each gRPC port with a TCP socket check, and confirmed that no gRPC listener collided with an HTTP server. A reviewer approved the PR after confirming every service had a unique gRPC port.

For the health checks, I ran the stack and checked docker compose ps. All 15 containers reported healthy. While doing this I also saw that Docker Compose v2 warns about the obsolete top-level version: '3.8'. It is harmless, and I noted it in the PR.

What I learned

The gateway health checks were not actually broken. They probed 8080 and the gateways listened on 8080. The problem was that the same service had a different port depending on where you looked: 8000 from the host and 8080 inside the container. One number per service, used everywhere, is easier to check by eye. That paid off later. When I wrote the Prometheus targets for these services, each target was just the service name and the one port it uses everywhere.