Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry to establish db connection for query log #351

Closed
ivoberger opened this issue Nov 26, 2021 · 2 comments
Closed

Retry to establish db connection for query log #351

ivoberger opened this issue Nov 26, 2021 · 2 comments
Assignees
Labels
🔨 enhancement New feature or request
Milestone

Comments

@ivoberger
Copy link

ivoberger commented Nov 26, 2021

I've got my blocky running in a docker-compose setup which also includes a mariadb instance for query logging.
The problem is, even though I've set blocky as dependent on the database it usually doesn't connect to the db on first try and just starts logging to the console instead.
I have to manually restart it.
Since it's all in docker it would be great to have an option to have blocky error if it can't connect to the database since then I can setup docker to restart it until it works (i.e. until the database is ready).
Basically like the failStartOnListError in the blocking section for the database connection.

@0xERR0R
Copy link
Owner

0xERR0R commented Nov 26, 2021

The behaviour was changed with #318 . DNS is typically a critical part of the infrastructure - in case of power outage, blocky will be restarted at some time later and should run even if database is down, otherwise you'll have no DNS. Maybe we should add some kind of retry: for example blocky tries 3 times to establish the db connection with 3 seconds pause between attempts?

If you use a single compose file with blocky and mariadb, you can try to add depends_on with "condition: service_healthy" for mariadb. In this case, docker will start mariadb first and if the service is healthy (health check), blocky will be started.

@ivoberger
Copy link
Author

Right, makes perfect sense. I'll try to fix it with my docker setup, thx for the suggestion, but retries sounds like a good idea anyway since my setup probably isn't the only were stuff doesn't always work on the first try.

Also, thanks for making this cool project, I've sent you a coffee (or whatever you want) on PayPal.

@0xERR0R 0xERR0R added the 🔨 enhancement New feature or request label Nov 27, 2021
@0xERR0R 0xERR0R added this to the 0.18 milestone Nov 27, 2021
@0xERR0R 0xERR0R self-assigned this Dec 13, 2021
@0xERR0R 0xERR0R changed the title Add option to fail if database connection could not be estabilished Retry to establish db connection for query log Dec 13, 2021
@0xERR0R 0xERR0R closed this as completed Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants