floross/docker-readthedocs

Database Starting too slowly?

petersmithca opened this issue · 2 comments

Hi there

When i bring up the containers, for some reason, even though theres a dependency I get
readthedocs_1 | Is the server running on host "database" (172.22.0.4) and accepting
readthedocs_1 | TCP/IP connections on port 5432?

and then a few lines further on

database_1 | 2018-08-30 09:46:38.445 UTC [20] LOG: database system was shut down at 2018-08-30 09:46:27 UTC
database_1 | 2018-08-30 09:46:38.466 UTC [1] LOG: database system is ready to accept connections

Not sure how I can resolve?

Note: This isn't consistent, but about 50% of the time

The dependency in compose file doesn't wait for any particular service to actually start up, it's more low-level ordering.

If this happens a lot - we can add some logic to wait for services (DB, ES, Redis) to be available.
Something like this should work seamlessly (picking up links from compose, etc) if run from somewhere in rtd-provision.sh.

A quick dirty fix is adding a sleep command in supervisord.conf
update command = /app/bin/rtd-provision.sh to
command = bash -c 'sleep 15 && /app/bin/rtd-provision.sh'