forge
Explore
Log in

Don't you dare go Hollow

🧹 one source for the deployment defaults

Browse files at this commit

6fd81aae15608342b5cbcd5a33643da571ec0a12Ahmet Kaan GümüşParent: 5f63fb5
  • refactor
    • 🧹 one source for the deployment defaults
Show full message
refactor: 🧹 one source for the deployment defaults
- the defaults (PORT, HOST, BACKEND_ORIGIN) are written once, in the image ENV
  block in Containerfile; server.ts now refuses to boot without them instead
  of carrying its own copies, so a stripped image fails loudly
- compose healthcheck asks the container for PORT; the deploy gate and the
  verify step read the running container for the port instead of parsing a
  second copy out of the operator file
- drop deploy/Containerfile.runtime: CI now builds the repo Containerfile, so
  there is no CI-only twin whose base image or ENV can drift
- docs follow: knobs paragraph, env example and unit header describe overrides
  of the image defaults rather than fallbacks scattered across files
.github/workflows/main.ymlmodified+32 -33
@@ -2,9 +2,10 @@
2 #2 #
3 # Typecheck β€” tsc --noEmit on its own runner. No browser, no build.3 # Typecheck β€” tsc --noEmit on its own runner. No browser, no build.
4 # Build and test β€” the unit suite (vitest: node + jsdom projects), the4 # Build and test β€” the unit suite (vitest: node + jsdom projects), the
5-# production build, then packs dist/ + server.ts into the5+# production build, then the repo Containerfile's image
6-# runtime image (deploy/Containerfile.runtime) and uploads6+# (its ENV block is the single source of the deployment
7-# the image tarball + compose files as the run's artifact.7+# defaults) and uploads the image tarball + compose files
8+# as the run's artifact.
8 # Deploy β€” SSH: podman load the image, point the deploy-owned9 # Deploy β€” SSH: podman load the image, point the deploy-owned
9 # stack.env's HEZARFEN_TAG at it, install compose.yaml +10 # stack.env's HEZARFEN_TAG at it, install compose.yaml +
10 # the hezarfen_frontend_compose user unit, restart the11 # the hezarfen_frontend_compose user unit, restart the
@@ -141,34 +142,23 @@ jobs:
141 test -f dist/index.html142 test -f dist/index.html
142 du -sh dist143 du -sh dist
143 144
144- - name: Stage the runtime context145+ # One Containerfile for laptop and CI, so there is no CI-only twin to
146+ # drift: whatever its ENV block says is what ships.
147+ - name: Build the image
145 run: |148 run: |
146 set -euo pipefail149 set -euo pipefail
147- mkdir -p stage150+ docker build -f Containerfile -t localhost/hezarfen_frontend:$GITHUB_SHA .
148- # dist/ and server.ts are exactly what deploy/Containerfile.runtime
149- # COPYs; nothing else from the repo goes into the shipped image.
150- cp -r dist stage/dist
151- cp server.ts stage/server.ts
152- ls -l stage
153 151
154- - name: Build the runtime image152+ - name: Stage the release bundle
155 run: |153 run: |
156 set -euo pipefail154 set -euo pipefail
157- # Pack the already-built SPA into the slim runtime image. Never155+ mkdir -p stage
158- # build from source here: the bun/vite build ran above (same
159- # division of labour as the backend's deploy).
160- docker build -f deploy/Containerfile.runtime -t localhost/hezarfen_frontend:$GITHUB_SHA stage/
161 docker save localhost/hezarfen_frontend:$GITHUB_SHA | gzip > stage/hezarfen_frontend.tar.gz156 docker save localhost/hezarfen_frontend:$GITHUB_SHA | gzip > stage/hezarfen_frontend.tar.gz
162-
163- - name: Stage the compose bundle
164- run: |
165- set -euo pipefail
166 cp compose.yaml deploy/hezarfen_frontend_compose.service stage/157 cp compose.yaml deploy/hezarfen_frontend_compose.service stage/
167 echo -n "$GITHUB_SHA" > stage/tag158 echo -n "$GITHUB_SHA" > stage/tag
168 # Everything the deploy installs on the server must be here; a159 # Everything the deploy installs on the server must be here; a
169 # missing piece fails here, on the runner, not mid-deploy on the160 # missing piece fails here, on the runner, not mid-deploy on the
170- # VPS. (stage/ also still holds dist/ and server.ts β€” docker build161+ # VPS.
171- # context, not deploy payload.)
172 test -f stage/hezarfen_frontend.tar.gz162 test -f stage/hezarfen_frontend.tar.gz
173 test -f stage/compose.yaml163 test -f stage/compose.yaml
174 test -f stage/hezarfen_frontend_compose.service164 test -f stage/hezarfen_frontend_compose.service
@@ -331,13 +321,9 @@ jobs:
331 }321 }
332 done322 done
333 323
334- # PORT is optional there (compose falls back to 5173), but the health324+ # The probe port is not repeated here: ask the container that gets
335- # gate below has to probe the port the stack actually published, so325+ # (re)created below what it carries (image ENV, overridden by the
336- # read the same value compose will β€” same file, no second place to326+ # operator's file), instead of parsing a second copy of the number.
337- # keep in sync. Plain KEY=value, as deploy/hezarfen_frontend.env.example
338- # documents.
339- port=$(sed -n 's/^PORT=\(.*\)$/\1/p' "$env_file" | tail -1)
340- port=${port:-5173}
341 327
342 # Rootless podman plus a compose provider; fail with the fix, not328 # Rootless podman plus a compose provider; fail with the fix, not
343 # a bare command-not-found three steps in.329 # a bare command-not-found three steps in.
@@ -408,6 +394,17 @@ jobs:
408 systemctl --user enable -- "$service"394 systemctl --user enable -- "$service"
409 systemctl --user restart "$service" || true395 systemctl --user restart "$service" || true
410 396
397+ # Ask the container that was just (re)created which port to probe
398+ # (image ENV, overridden by the operator's file) β€” the number lives in
399+ # one place and this reads it, rather than keeping a second copy that
400+ # can drift. No container reachable = nothing came up.
401+ port=$(podman inspect -f '{{range .Config.Env}}{{println .}}{{end}}' hezarfen_frontend 2>/dev/null | sed -n 's/^PORT=//p') || true
402+ if [ -z "$port" ]; then
403+ echo 'the frontend container reports no PORT; rolling back' >&2
404+ rollback
405+ exit 1
406+ fi
407+
411 # The oneshot returns before the container has bound its port. Wait408 # The oneshot returns before the container has bound its port. Wait
412 # for the SPA shell rather than a clock: a 200 whose body carries409 # for the SPA shell rather than a clock: a 200 whose body carries
413 # the index.html title means the new build is really being served.410 # the index.html title means the new build is really being served.
@@ -455,11 +452,13 @@ jobs:
455 deploy_path=$HOME/$1452 deploy_path=$HOME/$1
456 export XDG_RUNTIME_DIR=/run/user/$(id -u)453 export XDG_RUNTIME_DIR=/run/user/$(id -u)
457 cd -- "$deploy_path"454 cd -- "$deploy_path"
458- # Same derivation as the deploy step: the gate must probe the port455+ # Same source as the deploy step: the container's own PORT, not a
459- # the operator's file published, not a remembered default.456+ # second copy of the number in this script.
460- env_file=$deploy_path/hezarfen_frontend.env457+ port=$(podman inspect -f '{{range .Config.Env}}{{println .}}{{end}}' hezarfen_frontend | sed -n 's/^PORT=//p')
461- port=$(sed -n 's/^PORT=\(.*\)$/\1/p' "$env_file" | tail -1)458+ if [ -z "$port" ]; then
462- port=${port:-5173}459+ echo 'the frontend container reports no PORT' >&2
460+ exit 1
461+ fi
463 tag=$(cat -- "$deploy_path/current_tag")462 tag=$(cat -- "$deploy_path/current_tag")
464 image=$(podman inspect -f '{{.Config.Image}}' hezarfen_frontend)463 image=$(podman inspect -f '{{.Config.Image}}' hezarfen_frontend)
465 case "$image" in464 case "$image" in
Containerfilemodified+10 -2
@@ -17,8 +17,16 @@ WORKDIR /app
17 COPY --from=build /app/dist ./dist17 COPY --from=build /app/dist ./dist
18 COPY server.ts ./server.ts18 COPY server.ts ./server.ts
19 19
20-ENV PORT=517320+# THE deployment defaults, and the only place they are written. server.ts reads
21-EXPOSE 517321+# all three from the environment and refuses to boot without them, compose's
22+# healthcheck asks the container for PORT instead of repeating a number, and the
23+# deploy pipeline reads the port back out of the running container. Override any
24+# of them in hezarfen_frontend.env β€” env_file wins over these image values.
25+# Nothing is EXPOSEd: the service runs with host networking, so it binds the
26+# host's interface directly and no port mapping exists.
27+ENV PORT=5173 \
28+ HOST=0.0.0.0 \
29+ BACKEND_ORIGIN=http://127.0.0.1:7656
22 USER bun30 USER bun
23 31
24 # Healthcheck lives in compose.yaml (podman's OCI image format ignores a32 # Healthcheck lives in compose.yaml (podman's OCI image format ignores a
README.mdmodified+2 -2
@@ -65,7 +65,7 @@ podman compose down # stop
65 65
66 The `Containerfile` is a two-stage build: `bun install --frozen-lockfile` plus `bun run build` produce `dist/`, and `oven/bun:1-slim` serves it with `server.ts` β€” which also reverse-proxies `/api/*` (plain HTTP and the exam-room WebSocket) to `BACKEND_ORIGIN`. No nginx, no node_modules at runtime, no state: one container and no volumes. It runs with `network_mode: host`, so it shares the host's loopback and reaches a backend published on `127.0.0.1:7656` exactly as a host process would (a bridge network would resolve `127.0.0.1` to the container itself). Host networking means no port mapping: the app binds the host's interface directly, so set `HOST=127.0.0.1` and let the reverse proxy on the same loopback be the only door.66 The `Containerfile` is a two-stage build: `bun install --frozen-lockfile` plus `bun run build` produce `dist/`, and `oven/bun:1-slim` serves it with `server.ts` β€” which also reverse-proxies `/api/*` (plain HTTP and the exam-room WebSocket) to `BACKEND_ORIGIN`. No nginx, no node_modules at runtime, no state: one container and no volumes. It runs with `network_mode: host`, so it shares the host's loopback and reaches a backend published on `127.0.0.1:7656` exactly as a host process would (a bridge network would resolve `127.0.0.1` to the container itself). Host networking means no port mapping: the app binds the host's interface directly, so set `HOST=127.0.0.1` and let the reverse proxy on the same loopback be the only door.
67 67
68-**Knobs live in two places and are never mixed.** On a laptop nothing is required: with no env file the app falls back to its own defaults (`BACKEND_ORIGIN=http://127.0.0.1:7656`, `HOST=0.0.0.0`, `PORT=5173`), so the `up` above works with zero extra files. On a server the operator copies `deploy/hezarfen_frontend.env.example` to `$HOME/hezarfen_frontend/hezarfen_frontend.env`, `chmod 0600` it and edits it β€” nothing automated creates, overwrites or uploads that file. The service declares it as `env_file:`, so **every key it carries reaches the container with no extra flag**; nothing else is interpolated from it, and the only compose-level variable is `HEZARFEN_TAG`, which the deploy owns in `stack.env`.68+**Knobs live in two places and are never mixed.** The defaults are written once, in the image's `ENV` block (`Containerfile`) β€” `BACKEND_ORIGIN`, `HOST`, `PORT` β€” and nothing else in the repo repeats them: `server.ts` reads all three and refuses to boot without them, the compose healthcheck asks the container for `PORT`, and the deploy reads the port back out of the running container. A laptop needs no extra files. On a server the operator copies `deploy/hezarfen_frontend.env.example` to `$HOME/hezarfen_frontend/hezarfen_frontend.env`, `chmod 0600` it and edits it β€” nothing automated creates, overwrites or uploads that file. The service declares it as `env_file:`, so **every key it carries overrides the image default with no extra flag**; nothing is interpolated from it, and the only compose-level variable is `HEZARFEN_TAG`, which the deploy owns in `stack.env`.
69 69
70 Environment values are read when the container **starts**: after editing the file, recreate (`podman compose up -d`, or `systemctl --user restart hezarfen_frontend_compose`). `podman restart` keeps the old environment.70 Environment values are read when the container **starts**: after editing the file, recreate (`podman compose up -d`, or `systemctl --user restart hezarfen_frontend_compose`). `podman restart` keeps the old environment.
71 71
@@ -78,7 +78,7 @@ podman compose --env-file ~/hezarfen_frontend/hezarfen_frontend.env \
78 78
79 `--env-file` feeds both compose's interpolation and β€” through `env_file:` β€” the container; the second file is compose-owned and carries `HEZARFEN_TAG` (a later `--env-file` wins for duplicate keys). Because the unit passes `--no-build`, the image must already exist on the host (`podman compose build`, or `podman load` of a tarball shipped from elsewhere). After an env change: `systemctl --user restart hezarfen_frontend_compose`.79 `--env-file` feeds both compose's interpolation and β€” through `env_file:` β€” the container; the second file is compose-owned and carries `HEZARFEN_TAG` (a later `--env-file` wins for duplicate keys). Because the unit passes `--no-build`, the image must already exist on the host (`podman compose build`, or `podman load` of a tarball shipped from elsewhere). After an env change: `systemctl --user restart hezarfen_frontend_compose`.
80 80
81-Deploying is GitHub Actions' job, not the server's. `.github/workflows/main.yml` typechecks (`tsc --noEmit`, its own runner, parallel with the rest), runs the vitest suite, builds the SPA, packs `dist/` + `server.ts` into the runtime image (`deploy/Containerfile.runtime`), and ships the image tarball together with `compose.yaml`, the `hezarfen_frontend_compose.service` unit and a `tag` file as the run's artifact. The deploy job loads that image on the server and starts the stack with `podman compose up -d --no-build`; the tag travels in a deploy-owned `stack.env`, so a release never rewrites the operator's knobs file. A health gate protects the swap: the new container must serve the SPA shell and must be *this* build's image, otherwise the deploy rolls back to `previous_tag` (and on a first deploy stops the stack instead). The operator's only manual step is writing the env file once (above).81+Deploying is GitHub Actions' job, not the server's. `.github/workflows/main.yml` typechecks (`tsc --noEmit`, its own runner, parallel with the rest), runs the vitest suite, builds the SPA, builds the repo `Containerfile`'s image (the same one a laptop builds β€” its `ENV` block is the single source of the deployment defaults), and ships the image tarball together with `compose.yaml`, the `hezarfen_frontend_compose.service` unit and a `tag` file as the run's artifact. The deploy job loads that image on the server and starts the stack with `podman compose up -d --no-build`; the tag travels in a deploy-owned `stack.env`, so a release never rewrites the operator's knobs file. A health gate protects the swap: the new container must serve the SPA shell and must be *this* build's image, otherwise the deploy rolls back to `previous_tag` (and on a first deploy stops the stack instead). The operator's only manual step is writing the env file once (above).
82 82
83 It needs three repository secrets β€” `SSH_PRIVATE_KEY`, `SSH_HOST`, `SSH_USER`, the same three names the backend deploy uses β€” plus `loginctl enable-linger` for the deploy user. `workflow_dispatch` (Actions β†’ Run workflow, or `gh workflow run main.yml --ref main`) redeploys the newest green build without re-running the suite, which is the door to use when only the server side changed.83 It needs three repository secrets β€” `SSH_PRIVATE_KEY`, `SSH_HOST`, `SSH_USER`, the same three names the backend deploy uses β€” plus `loginctl enable-linger` for the deploy user. `workflow_dispatch` (Actions β†’ Run workflow, or `gh workflow run main.yml --ref main`) redeploys the newest green build without re-running the suite, which is the door to use when only the server side changed.
84 84
compose.yamlmodified+13 -18
@@ -1,23 +1,17 @@
1 # The frontend: one container behind podman compose β€” Bun serves the built SPA1 # The frontend: one container behind podman compose β€” Bun serves the built SPA
2 # and reverse-proxies /api/* to the backend.2 # and reverse-proxies /api/* to the backend.
3 #3 #
4-# Knobs live in two places and are never mixed (see README):4+# Every default (BACKEND_ORIGIN, HOST, PORT) is written once, in the image's
5-# laptop the ${VAR:-default} interpolations below β€” `podman compose up`5+# ENV block (Containerfile); this file declares no `environment:` at all, so
6-# works with zero extra files6+# nothing here can shadow a value. A laptop runs it as-is; a server overlays
7-# server ~/hezarfen_frontend/hezarfen_frontend.env (0600, written by hand7+# ~/hezarfen_frontend/hezarfen_frontend.env (0600, written by hand from
8-# from deploy/hezarfen_frontend.env.example)8+# deploy/hezarfen_frontend.env.example) through `env_file:`.
9 #9 #
10-# Interpolation reads the --env-file arguments (hezarfen_frontend.env first,10+# `--env-file` only matters for `HEZARFEN_TAG` (the deploy passes the
11-# deploy-owned stack.env second); the service's `env_file:` passes that same11+# deploy-owned stack.env second, so it wins for that one key); the container's
12-# file into the container. BACKEND_ORIGIN is deliberately NOT listed under12+# knobs arrive through `env_file:`, which needs no flag.
13-# `environment:` β€” a listed key wins over `env_file:`, which would shadow the
14-# file with this file's default whenever compose runs without --env-file.
15-# server.ts keeps the same default built in, so nothing is lost on a laptop and
16-# the operator's file is authoritative on a server. PORT stays listed: the
17-# publish above is interpolated from it, and one source has to move the
18-# listener and the publish together.
19 #13 #
20-# The value is read when the container STARTS: editing the file needs a14+# Those values are read when the container STARTS: editing the file needs a
21 # recreate (`podman compose up -d`, or `systemctl --user restart15 # recreate (`podman compose up -d`, or `systemctl --user restart
22 # hezarfen_frontend_compose`), not a `podman restart`.16 # hezarfen_frontend_compose`), not a `podman restart`.
23 17
@@ -47,9 +41,10 @@ services:
47 required: false41 required: false
48 restart: unless-stopped42 restart: unless-stopped
49 healthcheck:43 healthcheck:
50- # Bun-based: the slim runtime image ships no curl. Reads the container's44+ # Bun-based: the slim runtime image ships no curl. PORT comes from the
51- # own PORT, so a moved port does not silently wedge the healthcheck.45+ # container's own environment β€” the image ENV block is where the number
52- test: ["CMD", "bun", "-e", "fetch('http://127.0.0.1:'+(Bun.env.PORT??5173)+'/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]46+ # lives, so this probe holds no second copy of it.
47+ test: ["CMD", "bun", "-e", "fetch('http://127.0.0.1:'+Bun.env.PORT+'/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
53 interval: 30s48 interval: 30s
54 timeout: 5s49 timeout: 5s
55 retries: 350 retries: 3
deploy/Containerfile.runtimedeleted+0 -21
@@ -1,21 +0,0 @@
1-# CI-only runtime image: the build CONTEXT is `stage/`, which holds the
2-# already-built `dist/` and `server.ts` β€” never the repo (see
3-# .github/workflows/main.yml). The laptop path is the repo-root Containerfile,
4-# which installs dependencies and runs `vite build`; this one only packs that
5-# build's output, so the shipped image carries no source, no node_modules and
6-# no toolchain.
7-#
8-# Keep the runtime stage in sync with the repo Containerfile's second stage.
9-
10-FROM docker.io/oven/bun:1-slim
11-WORKDIR /app
12-COPY dist ./dist
13-COPY server.ts ./server.ts
14-
15-ENV PORT=5173
16-EXPOSE 5173
17-USER bun
18-
19-# Healthcheck lives in compose.yaml (podman's OCI image format ignores a
20-# Containerfile HEALTHCHECK).
21-CMD ["bun", "run", "server.ts"]
deploy/hezarfen_frontend.env.examplemodified+7 -5
@@ -11,11 +11,13 @@
11 # into the frontend container). Plain KEY=value lines: no quotes, no `export`,11 # into the frontend container). Plain KEY=value lines: no quotes, no `export`,
12 # no trailing comment.12 # no trailing comment.
13 #13 #
14-# The service declares this file as `env_file:`, so every key below reaches the14+# The service declares this file as `env_file:`, so every key below overrides
15-# container with no extra flag and nothing is shadowed by a compose default.15+# the image's own ENV defaults (see the ENV block in Containerfile β€” that block
16-# Values are read when the container STARTS: after editing, recreate16+# is the only place the default values are written) with no extra flag, and
17-# (`podman compose up -d`, or `systemctl --user restart17+# nothing is shadowed by a compose default. Values are read when the container
18-# hezarfen_frontend_compose`). `podman restart` keeps the old environment.18+# STARTS: after editing, recreate (`podman compose up -d`, or
19+# `systemctl --user restart hezarfen_frontend_compose`). `podman restart` keeps
20+# the old environment.
19 #21 #
20 # The app reads three keys today (server.ts): BACKEND_ORIGIN, PORT, HOST.22 # The app reads three keys today (server.ts): BACKEND_ORIGIN, PORT, HOST.
21 23
deploy/hezarfen_frontend_compose.servicemodified+4 -3
@@ -11,14 +11,15 @@
11 # podman load -i image.tar # or load one shipped from elsewhere11 # podman load -i image.tar # or load one shipped from elsewhere
12 #12 #
13 # Keys read from hezarfen_frontend.env (full docs in13 # Keys read from hezarfen_frontend.env (full docs in
14-# deploy/hezarfen_frontend.env.example):14+# deploy/hezarfen_frontend.env.example). All three have defaults in the image's
15+# ENV block (Containerfile) β€” this file overrides them:
15 # BACKEND_ORIGIN the origin /api/* is proxied to; on this16 # BACKEND_ORIGIN the origin /api/* is proxied to; on this
16 # host that is http://127.0.0.1:7656, which17 # host that is http://127.0.0.1:7656, which
17 # the service can reach because compose runs18 # the service can reach because compose runs
18 # it with host networking19 # it with host networking
19-# HOST bind address; 127.0.0.1 keeps the app on20+# HOST bind address; 127.0.0.1 keeps the app on
20 # loopback behind the reverse proxy21 # loopback behind the reverse proxy
21-# PORT listen port, default 517322+# PORT listen port
22 #23 #
23 # Env-only restart (re-runs `compose up -d`, recreating the container when its24 # Env-only restart (re-runs `compose up -d`, recreating the container when its
24 # environment changed):25 # environment changed):
server.tsmodified+20 -10
@@ -6,16 +6,26 @@
6 // Local dev uses Vite's own proxy (vite.config.ts); this file is only the6 // Local dev uses Vite's own proxy (vite.config.ts); this file is only the
7 // container's runtime after `vite build`.7 // container's runtime after `vite build`.
8 8
9-const PORT = Number(Bun.env.PORT ?? 5173);9+// Every knob comes from the environment; the values themselves live in exactly
10-// Interface to bind. 0.0.0.0 is what a published container port needs; under10+// one place β€” the image's ENV block (see Containerfile), overridden per
11-// host networking the process sits directly on the host, so a server sets11+// deployment by hezarfen_frontend.env. Boot refuses rather than guessing: a
12-// HOST=127.0.0.1 and only the reverse proxy beside it can reach the app.12+// missing value here means the image was stripped or the process was started
13-const HOST = Bun.env.HOST ?? "0.0.0.0";13+// outside it, and silently binding :5000-style defaults hides that.
14-// Where the backend lives. The default is the co-located backend a server14+function required(name: string): string {
15-// publishes on its own loopback (the compose stack maps 127.0.0.1:7656), which15+ const value = Bun.env[name];
16-// is what the frontend container reaches under host networking. Override with16+ if (!value) {
17-// BACKEND_ORIGIN for anything else.17+ console.error(
18-const BACKEND_ORIGIN = Bun.env.BACKEND_ORIGIN ?? "http://127.0.0.1:7656";18+ `${name} is not set. The image supplies the defaults (see the ENV block in Containerfile); ` +
19+ `set ${name} in hezarfen_frontend.env to override them.`,
20+ );
21+ process.exit(1);
22+ }
23+ return value;
24+}
25+
26+const PORT = Number(required("PORT"));
27+const HOST = required("HOST");
28+const BACKEND_ORIGIN = required("BACKEND_ORIGIN");
19 const BACKEND_HTTP = BACKEND_ORIGIN.replace(/\/+$/, "");29 const BACKEND_HTTP = BACKEND_ORIGIN.replace(/\/+$/, "");
20 const BACKEND_WS = BACKEND_HTTP.replace(/^http/, "ws");30 const BACKEND_WS = BACKEND_HTTP.replace(/^http/, "ws");
21 const BACKEND_HOST = new URL(BACKEND_HTTP).host;31 const BACKEND_HOST = new URL(BACKEND_HTTP).host;