nginx: skip cert fetch on startup when existing cert is still valid#8517
Merged
Conversation
Avoid acme.sh hitting Let's Encrypt for every domain on each container restart. Per-domain, skip if a cert exists and is valid for more than 3 days; cron continues to handle renewals.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
@aapeliv we should probably add cron monitoring with something like |
WouldYouKindly
approved these changes
May 10, 2026
Contributor
📝 Release NotesThis PR should be included in the release notes. Suggested release note: 🤖 Bot Debug InformationModel: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On deploy, the nginx container's
run.shcallsget-certs.sh, which iterates over every domain and runsacme.sh --issue. If a cert happens to be inside acme.sh's renewal window at the moment of a deploy, this triggers a renewal against Let's Encrypt before the site comes up. This causes ~1 min downtime.This PR adds a per-domain guard in
get-certs.sh: iffullchain.pemalready exists and is valid for more than 3 days, skip theacme.sh --issuecall. The cron-based renewal (every 2 hours) continues to handle actual renewals, so deploys no longer touch Let's Encrypt as long as cron is healthy. The 3-day buffer is a safety net so that a long cron outage still gets rescued by a deploy before expiry.Testing
Reviewed on production by inspecting the script logic. Manual test plan:
/certs/live/<domain>/fullchain.pem: log should showSkipping <domain>: existing cert valid for >3 daysfor each domain and no acme.sh calls.For maintainers
This PR was created with the Couchers PR skill.