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
This commit is contained in:
parent
628d19d650
commit
6916eb95f6
1 changed files with 24 additions and 1 deletions
25
cdn.tf
25
cdn.tf
|
|
@ -52,6 +52,29 @@
|
||||||
|
|
||||||
### cran.rpkgs.com
|
### 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" {
|
resource "bunnynet_pullzone" "cran_rpkgs_com" {
|
||||||
name = "cran-rpkgs"
|
name = "cran-rpkgs"
|
||||||
|
|
||||||
|
|
@ -64,7 +87,7 @@ resource "bunnynet_pullzone" "cran_rpkgs_com" {
|
||||||
origin {
|
origin {
|
||||||
type = "OriginUrl"
|
type = "OriginUrl"
|
||||||
url = "https://devxy-rpkgs-binaries.s3.eu-central-003.backblazeb2.com"
|
url = "https://devxy-rpkgs-binaries.s3.eu-central-003.backblazeb2.com"
|
||||||
middleware_script = 29277
|
middleware_script = bunnynet_compute_script.rpkgs_router.id
|
||||||
}
|
}
|
||||||
|
|
||||||
routing {
|
routing {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue