incubator-answer icon indicating copy to clipboard operation
incubator-answer copied to clipboard

Attempt to reconnect to the provided database at startup.

Open ghost opened this issue 2 years ago • 2 comments

Describe the bug When entrypoint.sh starts with answer init, and the database is not ready for connections yet, the whole process fails and does not attempt to reconnect to the database.

To Reproduce I found this out by deploying a sidecar for GCP cloud-sql-proxy. The startup of answer happens so quickly that the cloud-sql-proxy is not completely ready to accept connections yet and then startup fails because the database is not ready. I was able to get passed this by bypassing entrypoint.sh and adding a 5 second sleep before answer init runs.

Expected behavior Ideally, the process would keep trying to connect to the provided database in config.yaml if its there from a previous configuration.

Platform (please complete the following information):

  • OS: Kubernetes (GKE)
  • Answer Version 1.0.7
  • Database: Postgres

ghost avatar Apr 07 '23 22:04 ghost

@cl-christschantz I'm not really sure, but would it be possible to try starting the database proxy first and using readiness to ensure that sidecar has finished starting first before starting Answer?

LinkinStars avatar Apr 10 '23 03:04 LinkinStars

@LinkinStars Thanks for the response. In Kubernetes, containers are spun up in parallel so there is not really a way to control timing or order of when they start. Unlike docker where you can use depends_on.

ghost avatar Apr 10 '23 15:04 ghost