Skip to content

Docker image does not deploy on a slow host

Describe the bug

Deploying the castopod docker image on a not-that-good host fails because of a race condition.

Steps to reproduce

  1. Get a not-that-good host (mine is a Debian server with a HDD, 4Go DDR3, CPU : Intel ATOM N2800 - 2c/4t - 1,86 GHz/1,86 GHz)
  2. Deploy the castopod docker image (with the example docker-compose setup from the documentation)
  3. Try to connect to the website

Expected behavior

It should be possible to connect to the installed Castopod website and finish the installation process.

Actual behavior

The website is not reachable.

Relevant logs and/or screenshots

The only relevant log from the castopod-app container seems to be curl: (7) Failed to connect to localhost port 80 after 1 ms: Couldn't connect to server

Context

  • Castopod: 1.6.5 (castopod/castopod:latest)
  • OS: Debian 12 server
  • Browser: not relevant
  • Web server: nginx bundled in castopod docker image
  • The server is not as fast as my local setup, where all is working well (maybe it is the HDD?)

Possible fixes

It’s coming from https://code.castopod.org/adaures/castopod/-/blob/main/docker/production/castopod/entrypoint.sh

Changing sleep 2 to sleep 5 makes it work. But it does not look like a proper fix, because it leaves this open for a race condition. A proper fix would be to wait for localhost web server to correctly initialize (I don’t know how, maybe querying for localhost every second until it properly respond, or even better have a localhost/status returning a code stating that everything is up and running).