The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

321488 (6) [Avatar] Offline
#1
Wondering why you did not use the Docker-Compose capabilities to do:
- Health Checks
- Specify start up dependencies

But instead used, 'nc' test in the run.sh files. Obviously its a good simple approach but....

So example:

service-one:
...
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
interval: 5s
timeout: 5s
retries: 10

service-two:
...
depends_on:
service-one
condition: service_healthy

service-three:
...
depends_on:
service-one:
condition: service_healthy
John C Carnell (44) [Avatar] Offline
#2
Hi,

Actually a pretty simple answer. When I first began writing the book, docker-compose did not have the health check capabilities in it. I started the book almost a 2 years before it was actually published smilie. Using docker-compose is a better approach. The use of NC was just a very simple way of getting started.

For things like the database and Kafka containers, I probably could have written a side-car endpoint that could be used to determine when the database is fully up, but chose to keep it simple.

Thanks,
John