-
-
Notifications
You must be signed in to change notification settings - Fork 2
Run scheduled maintenance securely on every site #1862
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
Merged
Merged
Changes from 78 commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
374c59c
Add secure scheduled maintenance
stefan-burke 57c74e1
Map mutation tests to source files
stefan-burke d5f1e16
Test built site action wrapper
stefan-burke 0301b84
Split scheduler page mutation tests
stefan-burke d903e70
Move built site tests beside routes
stefan-burke d57ffc8
Test scheduled read-only blocking
stefan-burke ea84201
Test scheduled route isolation
stefan-burke 0578093
Test request scope wrapper
stefan-burke 5d4212d
Test scheduled settings isolation
stefan-burke 796cdcf
Test scheduler route definitions
stefan-burke b30e6aa
Test API key attempt limiter
stefan-burke 69a9438
Test successful login clearing
stefan-burke 26c67dd
Narrow login clearing test
stefan-burke ef271c0
Test historical prune migration
stefan-burke ef8af50
Test maintenance migration order
stefan-burke ceda86b
Test maintenance task schema
stefan-burke 47abe87
Test built site schema revision
stefan-burke c74f291
Test combined database budget
stefan-burke d432907
Test retired maintenance settings
stefan-burke d065b75
Move user tests beside source
stefan-burke 801370b
Test fetch subrequest counting
stefan-burke 44f9b86
Test Sentry subrequest counting
stefan-burke dc00f51
Test retired settings keys
stefan-burke 9eb728f
Test assignable site build
stefan-burke db9f3d1
Test storage subrequest counting
stefan-burke 9326162
Test release subrequest counting
stefan-burke 754495f
Test maintenance key panel
stefan-burke 9086232
Test retired debug pruning state
stefan-burke efcad24
Harden mutation contracts
stefan-burke af7c07c
Keep page tests on their owner
stefan-burke 56182d4
Test builder form contract
stefan-burke d556586
Test built-site page contract
stefan-burke 98d33c9
Move Sentry tests to their owner
stefan-burke 5f584e1
Test settings page state
stefan-burke 3f11390
Simplify read-only admin matching
stefan-burke 3913126
Test scheduled failure reports
stefan-burke 2c9b030
Unify organic maintenance gating
stefan-burke 36f964f
Test app route dispatch
stefan-burke aff4358
Test missing content type
stefan-burke a310d86
Test builder security contracts
stefan-burke 2e4d154
Test activity backfill logging
stefan-burke 5e22a56
Test built-site storage contracts
stefan-burke f2b317f
Test storage backend contracts
stefan-burke 1cfa65e
Test payment retention limits
stefan-burke bc83c75
Test schema metadata names
stefan-burke 1d29c85
Test settings write contracts
stefan-burke cae0e3d
Test debug status rendering
stefan-burke dd28a70
Test built-site panel contracts
stefan-burke 1bec805
Test site assignment contracts
stefan-burke 2a67304
Test user storage contracts
stefan-burke 9166c7d
Test assignable site publishing
stefan-burke a856380
Test expired invite pruning
stefan-burke c42208e
Test Sentry transport contracts
stefan-burke cfc943b
Test maintenance marker boundary
stefan-burke 61ea10d
Document query log equivalents
stefan-burke f277df6
Test advanced settings rendering
stefan-burke fb18539
Simplify scheduled maintenance keys
stefan-burke 4001583
Move built-site tests to source mirror
stefan-burke 3edb5c4
Merge origin/main into scheduled maintenance
stefan-burke 83eb39b
Address scheduled maintenance review feedback
stefan-burke 706dbf5
Fix site retention and invite pruning
stefan-burke 05c81af
Map mutation tests to changed sources
stefan-burke ad11154
Add direct settings template mutation tests
stefan-burke 74ede5c
Kill branch mutation survivors
stefan-burke 44dfa37
Merge remote-tracking branch 'origin/main' into work/scheduled-mainte…
stefan-burke 390b361
Merge branch 'main' into work/scheduled-maintenance
stefan-burke 475535d
Fix scheduled maintenance review findings
stefan-burke 8587be0
Align review tests with mutation ownership
stefan-burke 181f492
Place transaction coverage with integrations
stefan-burke 64d526a
Add direct URL feature coverage
stefan-burke 475b111
Handle legacy empty renewal indexes
stefan-burke 16b5778
Map site database mutation coverage
stefan-burke 55b373f
Map site update mutation coverage
stefan-burke 3fda320
Scope built-site template test setup
stefan-burke 5dabd8d
Add direct built-site component coverage
stefan-burke d7b46e2
Map field validator mutation coverage
stefan-burke 7d90730
Complete review mutation coverage
stefan-burke 0613331
Merge remote-tracking branch 'origin/work/scheduled-maintenance' into…
stefan-burke 9e9fdef
Merge origin/main into scheduled maintenance
stefan-burke 7b88027
Stabilize listing query scaling test
stefan-burke d28fb6e
Keep scheduled retries within fresh state and budget
stefan-burke 14ad188
Merge structured value validation from main
stefan-burke 079d3b3
Merge origin/main into scheduled maintenance
stefan-burke 14e303f
Merge origin/main into scheduled maintenance
stefan-burke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Scheduled maintenance | ||
|
|
||
| Each site runs its own small database maintenance jobs. An external HTTPS | ||
| monitor must send one request to each site at least every 15 minutes: | ||
|
|
||
| ```http | ||
| POST /scheduled HTTP/1.1 | ||
| Authorization: Bearer <site key> | ||
| ``` | ||
|
|
||
| The request has no body. A successful run returns an empty `204`. A configured | ||
| site returns an empty `401` for a missing or wrong key. A site with no key, or a | ||
| non-`POST` request, returns an empty `404`. A system failure returns an empty | ||
| `503`. All responses use `Cache-Control: no-store`. | ||
|
|
||
| ## Set Up A Site | ||
|
|
||
| Create a different 32-byte key for every independently deployed site: | ||
|
|
||
| ```bash | ||
| openssl rand -base64 32 | tr '+/' '-_' | tr -d '=' | ||
| ``` | ||
|
|
||
| Store it as the native `SCHEDULED_TASK_KEY` secret on that site. Never put the | ||
| key in a URL, monitor name, note, log, or plaintext database field. The owner | ||
| can read the local key on **Settings > Advanced**. | ||
|
|
||
| The built-site manager creates a different key for every child. It stores the | ||
| key in the child's native secret and in the builder's encrypted site data. Use | ||
| the child's **Scheduled maintenance** tab to set up an older child. | ||
|
|
||
| ## Change A Child Key | ||
|
|
||
| Coordinated one-click key rotation is intentionally deferred to the upcoming | ||
| Uptime Kuma integration, which will update the child and its monitor together. | ||
| Until then, a host operator can manually replace a compromised key on the child | ||
| and in the monitor. | ||
|
|
||
| ## CDN Rules | ||
|
|
||
| Allow the monitor to reach `/scheduled` without a browser challenge, cached | ||
| response, redirect, or body rewrite. If the CDN has an allowlist, add the | ||
| monitor there. | ||
|
|
||
| Rate-limit `/scheduled` at the CDN before requests reach the edge script. The | ||
| application deliberately does not keep a request counter for rejected calls: | ||
| doing so would let unauthenticated traffic consume database subrequests before | ||
| authentication. Keep the limit high enough for the monitor's retries, but far | ||
| below a general API traffic rate. |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.