feat: settle on WARMBLY_NODE_REGION as the one region variable for every role, because the join script wrote it while the worker still read WORKER_REGION, so a joined worker reported no region and the placement geography term stayed dead for exactly the machines that had been given one

This commit is contained in:
Matthew Meszaros
2026-09-09 05:04:55 -07:00
parent de60bc3784
commit 704fecdcc0
6 changed files with 19 additions and 8 deletions
+1 -1
View File
@@ -468,7 +468,7 @@ BILLING_PROVIDER=none
# WORKER_STATE_DIR=/data/state
# WORKER_BIND_IP=
# WORKER_PUBLIC_IP=
# WORKER_REGION= # free-form egress location label, e.g. eu-central
# WARMBLY_NODE_REGION= # free-form egress location label, e.g. eu-central
# MAIL_TLS_INSECURE=false # skips cert verification on mailbox connections
#
# Set on the BACKEND: the image the remote installer pulls. The built-in default
+12 -1
View File
@@ -239,7 +239,7 @@ func newNodeAgent(workerID uuid.UUID, bindIP string) *nodeagent.Agent {
NodeID: workerID,
Role: models.NodeRoleWorker,
Name: os.Getenv("WARMBLY_NODE_NAME"),
Region: os.Getenv("WORKER_REGION"),
Region: nodeRegion(),
Address: reportedIP,
Version: buildVersion(),
BaseURL: os.Getenv("ENCRYPTED_KEYS_BACKEND_URL"),
@@ -249,6 +249,17 @@ func newNodeAgent(workerID uuid.UUID, bindIP string) *nodeagent.Agent {
})
}
// nodeRegion reads the sign-in geography hint. WARMBLY_NODE_REGION is what the
// join script writes and what every role uses; WORKER_REGION is the older
// worker-only name, kept as a fallback so a machine configured by hand before
// the join flow existed keeps reporting its region.
func nodeRegion() string {
if v := os.Getenv("WARMBLY_NODE_REGION"); v != "" {
return v
}
return os.Getenv("WORKER_REGION")
}
// buildVersion is the image tag this build reports. Set by the join script
// from the tag it pulled; empty means unknown, which the control plane must
// not read as "needs updating".
+1 -1
View File
@@ -483,7 +483,7 @@ services:
# so ids survive container recreates and --scale still works.
WORKER_ID: ${WORKER_ID:-}
WORKER_STATE_DIR: ${WORKER_STATE_DIR:-/data/state}
WORKER_REGION: ${WORKER_REGION:-}
WARMBLY_NODE_REGION: ${WARMBLY_NODE_REGION:-}
BOX_GOOGLE_CLIENT_ID: ${BOX_GOOGLE_CLIENT_ID:-}
BOX_GOOGLE_CLIENT_SECRET: ${BOX_GOOGLE_CLIENT_SECRET:-}
BOX_OUTLOOK_CLIENT_ID: ${BOX_OUTLOOK_CLIENT_ID:-}
+1 -1
View File
@@ -377,7 +377,7 @@ sudo tee /etc/warmbly/worker.env >/dev/null <<EOF
APP_ENV=prod
AWS_CONFIG_ENABLED=false
WORKER_ID=$(uuidgen)
WORKER_REGION=eu-central
WARMBLY_NODE_REGION=eu-central
EVENTBUS_PROVIDER=nats
NATS_URL=nats://127.0.0.1:4222
@@ -315,7 +315,7 @@ The variable must be set on the backend in every environment. The file itself is
| `WORKER_ID` | Stable uuid for this worker. Leave unset when running scaled replicas, which share one environment | derived, then random | yes |
| `WORKER_BIND_IP` | Source address to bind outbound connections to, and the seed for a derived `WORKER_ID` | unset | yes |
| `WORKER_PUBLIC_IP` | The address the worker reports to the control plane | detected | yes |
| `WORKER_REGION` | Free-form label for where this worker egresses from, e.g. `eu-central`. Placement prefers a worker near where a mailbox's provider expects sign-ins; unset scores neutral | unset | yes |
| `WARMBLY_NODE_REGION` | Free-form label for where this node egresses from, e.g. `eu-central`. Placement prefers a worker near where a mailbox's provider expects sign-ins; unset scores neutral. Written by the join script from `--region` | unset | yes |
| `WORKER_IMAGE` | Image the remote installer pulls. The built-in default does not match what CI publishes, so set it | built-in | yes |
| `ENCRYPTED_KEYS_BACKEND_URL` | Backend base the worker fetches organization keys from | unset | yes |
| `ENCRYPTED_KEYS_WORKER_TOKEN` | The worker's copy of `INTERNAL_API_TOKEN` | unset | yes |
+3 -3
View File
@@ -702,10 +702,10 @@ var table = []Entry{
Resolve: envValue("WORKER_ID"),
},
{
Key: "WORKER_REGION", Group: GroupWorkers, RuntimeChangeable: ChangeBootOnly,
Effect: "Where this worker egresses from, as a free-form label. Placement prefers a worker near where a mailbox's provider expects sign-ins; unset scores neutral.",
Key: "WARMBLY_NODE_REGION", Group: GroupWorkers, RuntimeChangeable: ChangeBootOnly,
Effect: "Where this node egresses from, as a free-form label. Placement prefers a worker near where a mailbox's provider expects sign-ins; unset scores neutral.",
DocsAnchor: docsWorkers,
Resolve: envValue("WORKER_REGION"),
Resolve: envValue("WARMBLY_NODE_REGION"),
},
{
Key: "MAIL_TLS_INSECURE", Group: GroupWorkers, RuntimeChangeable: ChangeBootOnly,