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

Ping DB instead of trying migration #1513

Merged
merged 5 commits into from
Feb 11, 2022
Merged

Ping DB instead of trying migration #1513

merged 5 commits into from
Feb 11, 2022

Conversation

MaxJa4
Copy link
Contributor

@MaxJa4 MaxJa4 commented Feb 8, 2022

In #1498 I added a retry functionality for the migration.
Since blindly retrying migrations can be dangerous since I'd see it as blindly messing with data, knowing something isn't right, I decided to look for a better solution (and also reduce log spam drastically).

With this, the PostgreSQL server in POSTGRES_HOST (e.g. db_recipes) will be pinged before migration.

The only downside to this is the necessity to add postgresql as additional dependency which increases image size slightly.
If someone knows another way to get access to the pg_isready command, please let me know.

@MaxJa4
Copy link
Contributor Author

MaxJa4 commented Feb 8, 2022

postgresql-client also has pg_isready and is quite a bit smaller than the whole postgresql package. Will test and change.

@MaxJa4
Copy link
Contributor Author

MaxJa4 commented Feb 8, 2022

Installation size of postgresql: 32.11 MB
Installation size of postgresql-client: 2.07 MB
Sizes are uncompressed. So image should be only slightly bigger with the client variant, barely noticeable :)

Tested and worked flawlessly for me.

@vabene1111 vabene1111 merged commit dd2f27c into TandoorRecipes:develop Feb 11, 2022
@vabene1111
Copy link
Collaborator

awesome, thats really cool, thanks for making this better :)

@MaxJa4 MaxJa4 deleted the improvement/ping_db branch February 18, 2022 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants