News for hackers. Stuff that matters.
Re:Show HN: Is_ready – Wait for many services to become avai... by fumplethumb on Sunday April 28, 2024 @08:40AM (#40188171)
With Docker compose, there is a more idiomatic way to achieve this with zero dependencies using healthchecks[0]. Works well!

I used wait_for_it.sh for the purpose described in the OP until I found healtchecks could be used instead.

[0] https://github.com/peter-evans/docker-compose-healthcheck

Re:Show HN: Is_ready – Wait for many services to become avai... by stavepan on Sunday April 28, 2024 @08:48AM (#40188210)
Healthchecks are a great way to achieve this.

As this repository mentions, this is the example using PostgreSQL.

depends_on: postgres-database: condition: service_healthy

healthcheck: test: ["CMD-SHELL", "pg_isready"] interval: 10s timeout: 5s retries: 5

However, PostgreSQL has already a command for this called pg_isready.

How is this going to work for other cases such as MySQL?

Re:Show HN: Is_ready – Wait for many services to become avai... by hiatus on Sunday April 28, 2024 @09:15AM (#40188356)
> How is this going to work for other cases such as MySQL?

You could do a query like SHOW DATABASES as a healthcheck for mysql.

Re:Show HN: Is_ready – Wait for many services to become avai... by rmbyrro on Sunday April 28, 2024 @08:53AM (#40188243)
Interesting. And it works for external HTTP services as well, I presume, right?
Re:Show HN: Is_ready – Wait for many services to become avai... by drewbitt on Sunday April 28, 2024 @10:30AM (#40188852)
A shell command, so curl would work