feat(edge): route PACKAGES requests to the per-R-minor slot #152

Merged
pat-s merged 4 commits from feat/per-minor-edge-routing into main 2026-08-07 14:12:22 +00:00
Showing only changes of commit 6916eb95f6 - Show all commits

feat(cdn): manage the edge middleware script from this repo

- add bunnynet_compute_script.rpkgs_router, sourced from edge/rpkgs-router.ts,
  so the middleware is reviewed and deployed like the rest of the config
- add the UNION_SLOTS script variable, empty until a slot carries a union index
- point the pull zone's middleware_script at the resource instead of the
  hard-coded id 29277, which the script is adopted from via tofu import
Patrick Schratz 2026-08-07 14:01:11 +00:00
No known key found for this signature in database
GPG key ID: 62050D5BC68AB6DC

25
cdn.tf
View file

@ -52,6 +52,29 @@
### cran.rpkgs.com
# The edge middleware that resolves the bare cran.rpkgs.com form to an
# <arch>/<os> slot and routes PACKAGES* to the per-R-minor slot. The source of
# truth is edge/rpkgs-router.ts; `tofu apply` publishes a new release.
#
# The script pre-dates this configuration, so it is adopted rather than created:
# tofu import bunnynet_compute_script.rpkgs_router 29277
resource "bunnynet_compute_script" "rpkgs_router" {
type = "middleware"
name = "rpkgs-router"
content = file("${path.module}/edge/rpkgs-router.ts")
}
# Slots ("<arch>/<os>", comma separated) whose per-minor index bincraft has
# already republished as a union of the per-minor and flat slots. Routing to a
# slot that is not listed here would hide every package the per-minor index does
# not carry, so this stays empty until a slot has been backfilled.
resource "bunnynet_compute_script_variable" "rpkgs_router_union_slots" {
script = bunnynet_compute_script.rpkgs_router.id
name = "UNION_SLOTS"
default_value = ""
required = false
}
resource "bunnynet_pullzone" "cran_rpkgs_com" {
name = "cran-rpkgs"
@ -64,7 +87,7 @@ resource "bunnynet_pullzone" "cran_rpkgs_com" {
origin {
type = "OriginUrl"
url = "https://devxy-rpkgs-binaries.s3.eu-central-003.backblazeb2.com"
middleware_script = 29277
middleware_script = bunnynet_compute_script.rpkgs_router.id
}
routing {