-
Notifications
You must be signed in to change notification settings - Fork 650
Allow the application to start without a database connection #3572
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
Conversation
1444992
to
c9bc0cb
Compare
Need to investigate the tests failing later, but the PR is still ready for review. My guess is that CI doesn't have the right environment variables configured. |
7e5c6f5
to
719d1f2
Compare
Looks great to me! The tests passed for me locally, but if I comment out either Eventually we could probably hook GitHub and S3 requests into our existing HTTP recording code, but for now its fine if we just document that these tests should not hit endpoints that could trigger external HTTP requests. |
I think GitHub and S3 are exactly what is already hooked up, or am I missing something? 🤔 |
The 2 new My understanding is that for now, if we tried to hit say the crate publish endpoint in a We should probably add an environment variable that disables all outgoing requests, returning an error instead. But I don't think it is necessary to block this PR on that. |
☔ The latest upstream changes (presumably #3596) made this pull request unmergeable. Please resolve the merge conflicts. |
719d1f2
to
2c9d038
Compare
2c9d038
to
1523948
Compare
Resolved the conflict and (hopefully!) fixed CI. |
LGTM!! @bors r+ |
📌 Commit 1523948 has been approved by |
☀️ Test successful - checks-actions |
This PR implements the last bit of #3541, making sure the server binary can start without a database connection.
To avoid serving the initial requests without a connection, the server will now wait for 5 seconds at startup to initialize the database connections, and if it can't do that in that timeframe it will treat the database as unhealthy and continue starting up the server.
This is critical to our continued availability, so to make sure this doesn't regress I also implemented a test that fails if a database connection becomes a requirement to start the server again. The test is implemented by starting the server binary with the right environment variables and doing proper HTTP requests to it.
Fixes #3541
r? @jtgeibel