mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2026-09-02 22:56:13 +08:00
The pre-existing A record for demo.nginxui.com has been removed, so the hostname can now be attached as a custom domain rather than as a zone route overlaying someone else's record. This matters beyond tidiness: a route only works while a proxied DNS record happens to exist, and that record was outside this repository. A custom domain is created and maintained by wrangler from this config, so the whole routing setup is reproducible from a clean checkout instead of depending on manual dashboard state. The zone route created earlier has been deleted, so exactly one mechanism now serves the hostname. Verified after propagation: demo.nginxui.com resolves, serves the SPA, reports a healthy container, and still lets a base64url-encoded log path through to the application. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
76 lines
2.4 KiB
JSON
76 lines
2.4 KiB
JSON
{
|
|
"$schema": "./node_modules/wrangler/config-schema.json",
|
|
"name": "nginx-ui-demo",
|
|
"main": "src/index.ts",
|
|
"compatibility_date": "2026-07-01",
|
|
"compatibility_flags": ["nodejs_compat"],
|
|
|
|
"observability": {
|
|
"enabled": true
|
|
},
|
|
|
|
// Keep the workers.dev URL alive alongside the custom domain: it is the only
|
|
// way to reach the demo when the custom domain's DNS is being changed.
|
|
"workers_dev": true,
|
|
|
|
// A custom domain, so Cloudflare owns the DNS record for this hostname and
|
|
// wrangler recreates it from this config alone. This only works because the
|
|
// pre-existing A record was removed; with one present, Cloudflare refuses
|
|
// with "already has externally managed DNS records" and the deploy exits
|
|
// non-zero even though the Worker itself went out fine.
|
|
"routes": [
|
|
{
|
|
"pattern": "demo.nginxui.com",
|
|
"custom_domain": true
|
|
}
|
|
],
|
|
|
|
"containers": [
|
|
{
|
|
"class_name": "NginxUiDemo",
|
|
// Built and pushed to Cloudflare's own registry by `wrangler deploy`,
|
|
// rather than pulled from Docker Hub. That keeps the deployed image and
|
|
// this working tree in lockstep, and avoids Docker Hub pull limits.
|
|
//
|
|
// demo.Dockerfile expects a prebuilt linux/amd64 binary at
|
|
// nginx-ui-linux-amd64/nginx-ui; `bun run deploy` produces it first.
|
|
"image": "../demo.Dockerfile",
|
|
"image_build_context": "..",
|
|
"image_vars": {
|
|
"TARGETOS": "linux",
|
|
"TARGETARCH": "amd64"
|
|
},
|
|
// Measured: the container settles around 550 MiB with three nginx-ui
|
|
// instances plus nginx, so 1 GiB is the smallest tier that fits.
|
|
"instance_type": "basic",
|
|
// Not 1. The platform keeps a provisioned instance of its own, and with a
|
|
// cap of 1 that instance consumes the whole quota — the Durable Object's
|
|
// instance then sits 'inactive' forever and the container never starts.
|
|
// Routing is a singleton by instance ID, so only one is ever claimed.
|
|
"max_instances": 3
|
|
}
|
|
],
|
|
|
|
"durable_objects": {
|
|
"bindings": [
|
|
{
|
|
"name": "NGINX_UI_DEMO",
|
|
"class_name": "NginxUiDemo"
|
|
}
|
|
]
|
|
},
|
|
|
|
"migrations": [
|
|
{
|
|
"tag": "v1",
|
|
"new_sqlite_classes": ["NginxUiDemo"]
|
|
}
|
|
],
|
|
|
|
// Daily restore. The container is ephemeral, so stopping it is the restore.
|
|
// 19:00 UTC is roughly 03:00 in CST, the quietest window for this audience.
|
|
"triggers": {
|
|
"crons": ["0 19 * * *"]
|
|
}
|
|
}
|