Commit Graph

151 Commits

Author SHA1 Message Date
Catherine
d887ae1602 Allow metadata retrieval with Codeberg Pages v2 authorization method. 2025-10-09 13:48:46 +00:00
Catherine
e0b659f668 Add [limits].allowed-repository-url-prefixes configuration option.
This is useful to limit updates to a specific Git forge.
Naturally, enabling this option disables updates from archive.
2025-10-09 13:48:15 +00:00
Catherine
15107298b2 Allow a trailing dot in Codeberg Pages v2 DNS TXT authentication method. 2025-10-07 19:00:46 +00:00
miyuko
a85905bd31 Fix time-based cache expiration practically never working.
config.MaxAge is now a nanosecond value, and multiplying it by
time.Second (number of nanoseconds in a second) will make it too large
for the cache expiry algorithm to have any effect.
2025-10-05 15:06:33 +01:00
Catherine
0eede0792d Add hostname and (if present) $PAGES_REGION to Server:.
Indispensable when debugging anycast configurations.
2025-10-05 08:11:52 +00:00
Catherine
a14f9e1e6c Use int64, not uint32, for sizes in the manifest.
This change eliminates a number of rather sketchy casts.

This conversion is a no-op for the wire format, explicitly per
Protobuf documentation.
2025-10-03 06:02:21 +00:00
Catherine
1e01a12958 Implement force redirects. 2025-10-02 16:41:23 +00:00
Catherine
157ceb8342 Add an HTTP status code workaround for GitHub. 2025-10-02 12:41:15 +00:00
Catherine
a7c47a798f Allow running without a configuration TOML file.
This is useful if it's more convenient to configure the server via
environment variables only.
2025-10-02 11:33:21 +00:00
miyuko
d5a4ac4098 Fix URL argument validation when using the -update-site CLI option. 2025-09-30 21:59:41 +01:00
Catherine
f0805c9ff5 Revert "Remove redundant bounds check from ExtractTar. NFCI"
This reverts commit 485cd4b9b1.

It wasn't redundant.
2025-09-30 05:20:02 +00:00
Catherine
485cd4b9b1 Remove redundant bounds check from ExtractTar. NFCI 2025-09-30 05:19:07 +00:00
Catherine
277b329e2d Merge backend_observer.go into observe.go. NFC 2025-09-30 04:40:30 +00:00
Catherine
b1ef57d32a Only cache NotFound errors from S3 backend, rather than any errors.
We need to cache NotFound responses to avoid hitting the backend
whenever there's a flurry of requests for the same invalid domain.
But caching any kind of error, including context cancellation, results
in poisoning the cache with that error, e.g. if the domain exists but
the client that requested it first did not wait for the response.
2025-09-30 03:44:24 +00:00
Catherine
764b4cd9f5 Observe blob size in GetBlob as well. 2025-09-30 02:54:53 +00:00
Catherine
396cabd43b Exclude metrics endpoint from observability.
Who watches the watchers? Nobody should!
2025-09-30 02:26:20 +00:00
Catherine
5f3ec8464f Fix Sentry sample rate calculation. 2025-09-30 02:09:38 +00:00
Catherine
f63940b459 Submit server region and machine ID to tracing. 2025-09-30 02:09:38 +00:00
Catherine
5f0a9ad360 Remove Honeybadger integration. 2025-09-30 00:59:14 +00:00
Catherine
1a0e594624 Add span based timings measurement and Sentry integration. 2025-09-30 00:56:58 +00:00
Catherine
b1c50c10de Thread context argument through the backend interface. NFC 2025-09-29 23:10:33 +00:00
Catherine
f533d84de9 Simplify. NFC 2025-09-29 22:16:23 +00:00
Catherine
217f3a9320 Switch log handling to slog.
This currently doesn't add any structure to the logs, changing just
the handler and output format. It does also add Sentry logging support.

The `log-format` configuration value now accepts values `none`, `text`,
and `json`.
2025-09-29 22:10:41 +00:00
Catherine
c3575a09ca Add Sentry support. 2025-09-29 21:11:10 +00:00
Catherine
dcabcac106 Rename feature h2c to serve-h2c. 2025-09-29 01:47:13 +00:00
Catherine
be389329f2 Gate compression behind compress feature flag.
Compression increases memory use during updates and can cause OOMs.
2025-09-29 01:45:20 +00:00
Catherine
25b1720940 Compress files with Zstandard.
This can save as much as 30% of storage space while adding negligible
CPU overhead.
2025-09-29 01:17:25 +00:00
Catherine
f82cf371f6 Inline ExternalizeManifest. NFC
It doesn't really make sense as a separate function and is only used
as a part of `StoreManifest`.
2025-09-29 01:17:25 +00:00
Catherine
79bfbb96c0 Accept repository URL in -update-site CLI option. 2025-09-29 01:16:59 +00:00
Catherine
f9487fb8b6 Fix misleading variable name. NFC 2025-09-29 00:26:55 +00:00
miyuko
1c7ef99359 Add manifest and blob metrics. 2025-09-27 18:36:17 +01:00
Catherine
94ec490ca5 Add -update-site CLI argument, for administrative updates. 2025-09-26 00:31:14 +00:00
Catherine
d36bebfe4e Move repository to https://codeberg.org/git-pages/git-pages.git. 2025-09-25 02:06:35 +00:00
Catherine
80aa8e2901 Add Codeberg Pages v2 specific DNS authorization mechanism.
Feature-gated behind `codeberg-pages-compat` since it has no generic
use outside of that specific deployment.
2025-09-25 01:18:47 +00:00
Catherine
d26fe98577 Refactor authorization code to handle non-pages branches. NFC 2025-09-24 22:54:58 +00:00
Catherine
714e37cce8 Implement partial Netlify _redirects support.
This is roughly to match the Codeberg subset:
https://docs.codeberg.org/codeberg-pages/redirects/
2025-09-24 19:11:27 +00:00
Catherine
c6330ccffc Don't attempt to proxy if a fallback URL hasn't been set up. 2025-09-24 11:12:00 +00:00
Catherine
fc029ad219 [breaking-change] Remove health endpoint handler and renumber metrics.
The previous commit has eliminated any way to use `ServeHealth()`,
but kept it around to not introduce breaking changes. This one has
no such constraint.
2025-09-23 02:39:11 +00:00
Catherine
4c087278cb Fly.io: switch health check method to [[services.http_checks]].
More specifically, remove the dedicated HTTP datapath for health
checks and verify the entire stack, from TLS frontend to S3 backend.
Verifying too little has resulted in a small outage recently when
the pages listener got misconfigured but the health listener happily
accepted connections like normal. This would not happen now that
the health check uses port 443, too.
2025-09-23 02:34:55 +00:00
Catherine
922cc6315a Use filename, not URL path, for MIME type sniffing.
Otherwise, even though `/foo/index.html` and `/foo` are identical
resources in every way, their MIME type could differ.
2025-09-23 00:42:19 +00:00
Catherine
38269c66ae Add -get-blob mode, printing contents of a blob. 2025-09-22 21:33:23 +00:00
Catherine
b1c372ea54 All subdomains of a forbidden domain are forbidden as well. 2025-09-22 20:00:54 +00:00
Catherine
f0b19debdc Make X-Pages-Update: no-change a reportable event. 2025-09-22 19:48:31 +00:00
Catherine
3701aa1800 Simplify. NFC 2025-09-22 19:46:17 +00:00
Catherine
9907a26397 Remove leftover comments. NFC 2025-09-22 19:43:56 +00:00
Catherine
c11114149c Allow marking a domain as unconditionally forbidden to update. 2025-09-22 19:39:23 +00:00
Catherine
6a2cc5b157 Minor refactor. NFC 2025-09-22 19:39:23 +00:00
miyuko
1aef0288e7 Add page operation metrics and expose them in Prometheus text format. 2025-09-22 19:03:59 +01:00
Catherine
584957a92d Provide Allow: header when responding with 405 Method Not Allowed. 2025-09-22 17:41:03 +00:00
Catherine
789a5e682e [breaking-change] Use type-safe representation for time durations. 2025-09-22 17:05:22 +00:00