Upon working with the current docker-compose.yml, I have noticed that some services are starting before their dependencies are ready. This leads to initial startup failures and makes the docker-compose process less reliable.
Specifically, I observed that services depending on the Redis instances and PostgreSQL databases were starting before these dependencies were fully initialized. Additionally, the PostgreSQL services (txs-db and cfg-db) did not have health checks, which is necessary for reliably determining when these services are ready to accept connections.
To address these problems, I propose the following changes:
Add health checks to the txs-db and cfg-db services, using the pg_isready -U postgres command to determine if the PostgreSQL servers are accepting connections.
Add the service_healthy condition to all services that depend on txs-db or cfg-db, to ensure they only start after the databases are ready.
Add a health check to the txs-redis and cgw-redis services, using the redis-cli ping command to determine if the Redis server is up.
Add the service_healthy condition to all services that depend on txs-redis and cgw-redis, to ensure they only start after Redis is ready.
Upon working with the current
docker-compose.yml
, I have noticed that some services are starting before their dependencies are ready. This leads to initial startup failures and makes the docker-compose process less reliable.Specifically, I observed that services depending on the Redis instances and PostgreSQL databases were starting before these dependencies were fully initialized. Additionally, the PostgreSQL services (
txs-db
andcfg-db
) did not have health checks, which is necessary for reliably determining when these services are ready to accept connections.To address these problems, I propose the following changes:
txs-db
andcfg-db
services, using thepg_isready -U postgres
command to determine if the PostgreSQL servers are accepting connections.service_healthy
condition to all services that depend ontxs-db
orcfg-db
, to ensure they only start after the databases are ready.txs-redis
andcgw-redis
services, using theredis-cli ping
command to determine if the Redis server is up.service_healthy
condition to all services that depend ontxs-redis
andcgw-redis
, to ensure they only start after Redis is ready.