1.8 KiB
1.8 KiB
Plan: Centralize Certificate Renewal for all certificates
- Remove renewal logic from Port80Handler
- Delete
startRenewalTimer()
andcheckForRenewals()
methods - Remove
renewThresholdDays
andrenewCheckIntervalHours
options fromIPort80HandlerOptions
- Delete
- Expose certificate status from Port80Handler
- Ensure
getDomainCertificateStatus()
returns{certObtained, expiryDate}
for each domain
- Ensure
- Add renewal settings to SmartProxy
- Extend
port80HandlerConfig
to includerenewThresholdDays
andrenewCheckIntervalHours
- Extend
- Implement renewal scheduler in SmartProxy using taskbuffer
- Add dependency on
@push.rocks/taskbuffer
and import{ Task, TaskManager }
inSmartProxy
- Add
performRenewals()
to iterate domains and trigger renewals wheredaysRemaining <= renewThresholdDays
- Instantiate a
TaskManager
and define aTask
that wrapsperformRenewals()
- Use
taskManager.addAndScheduleTask(task, cronExpr)
to schedule renewals, buildingcronExpr
fromrenewCheckIntervalHours
(e.g.0 0 */${renewCheckIntervalHours} * * *
) - Call
taskManager.start()
inSmartProxy.start()
- Add dependency on
- Clean shutdown handling
- Call
taskManager.stop()
inSmartProxy.stop()
alongside other cleanup
- Call
- Throttling and safety
- Skip domains already in
obtainingInProgress
- Optionally batch or stagger renewal calls for large domain sets
- Skip domains already in
- Tests
- Unit test
performRenewals()
, mockinggetDomainCertificateStatus()
to simulate expiring certificates - Integration test using an in-memory
Port80Handler
to verify that scheduled renewals invokeobtainCertificate()
correctly
- Unit test
- Documentation
- Update
readme.plan.md
(this section) - Update
README.md
and code comments to document new renewal settings and workflow
- Update