From fa3cc6dc4d77b1bdc7af449eec2d138a727c3b2d Mon Sep 17 00:00:00 2001 From: Philippe Parage <69145356+pparage@users.noreply.github.com> Date: Tue, 18 Aug 2026 14:30:51 +0200 Subject: [PATCH] fix(deployer_ui): seed config.json with the node the workspace targets The bundle rendered "defaultNodeName" from PROXMOX_NODE_NAME, defaulting to the literal "pve". No scenario call-site passes it, so every deployment seeded "pve" regardless of the node it had just deployed to. On dev_deployer_ui_lab the backend registers node_name "pve01" while the SPA seeds "pve" beside it, and the operator still has to correct the node by hand in Settings -- the exact retyping config.json exists to remove. Resolve the default from the active workspace vault's `proxmox_node` instead, loaded with the same vars_files pattern vm.bootstrap, the cloud-init downloads and the template builds already use. An explicit PROXMOX_NODE_NAME still wins, and "pve" survives only as the last-resort fallback when neither is set. Fixing it here rather than at the call-site keeps the lab's node out of an open-source scenario file and fixes every other scenario at the same time. Verified against the real workspace vault: nothing passed -> "pve01" (was "pve"), -e PROXMOX_NODE_NAME=pve99 -> "pve99", output parses as JSON. Scenario syntax-check green. Refs #131 --- .../admin/software.install.deployer_ui/README.md | 2 +- .../bundle_parameters.json | 4 ++-- .../bundle_parameters.src.yml | 4 ++-- .../admin/software.install.deployer_ui/main.yml | 14 ++++++++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/bundles/admin/software.install.deployer_ui/README.md b/bundles/admin/software.install.deployer_ui/README.md index 1c0c9e2..97baf05 100644 --- a/bundles/admin/software.install.deployer_ui/README.md +++ b/bundles/admin/software.install.deployer_ui/README.md @@ -28,7 +28,7 @@ The upstream repo ships a multi-stage Dockerfile : | `REMOTE_PROJECT_DIR` | `/var/www/range42_deployer_ui` | | `UI_PORT` | `3000` | | `BACKEND_API_URL` | *(unset)* — when set, rendered into `public/config.json` so the SPA pre-registers this backend | -| `PROXMOX_NODE_NAME` | `pve` — paired with `BACKEND_API_URL` in `config.json` | +| `PROXMOX_NODE_NAME` | `proxmox_node` from the workspace vault, else `pve` — paired with `BACKEND_API_URL` in `config.json` | ## Call-site example diff --git a/bundles/admin/software.install.deployer_ui/bundle_parameters.json b/bundles/admin/software.install.deployer_ui/bundle_parameters.json index 796e5a9..7bf98ab 100644 --- a/bundles/admin/software.install.deployer_ui/bundle_parameters.json +++ b/bundles/admin/software.install.deployer_ui/bundle_parameters.json @@ -57,8 +57,8 @@ "type": "string", "required": false, "default_where": "bundle-inline", - "default": "pve", - "description": "Proxmox node the backend targets, paired with BACKEND_API_URL in config.json. Only consumed when BACKEND_API_URL is set." + "default": "proxmox_node from the workspace vault, else pve", + "description": "Proxmox node the backend targets, paired with BACKEND_API_URL in config.json. Defaults to the workspace vault's proxmox_node so a fresh lab seeds the node it actually deploys to; the literal \"pve\" is only the last-resort fallback. Only consumed when BACKEND_API_URL is set." }, { "name": "INSTALL_TAILSCALE", diff --git a/bundles/admin/software.install.deployer_ui/bundle_parameters.src.yml b/bundles/admin/software.install.deployer_ui/bundle_parameters.src.yml index 77d3584..0f099d3 100644 --- a/bundles/admin/software.install.deployer_ui/bundle_parameters.src.yml +++ b/bundles/admin/software.install.deployer_ui/bundle_parameters.src.yml @@ -53,8 +53,8 @@ params: type: string required: false default_where: bundle-inline - default: "pve" - description: Proxmox node the backend targets, paired with BACKEND_API_URL in config.json. Only consumed when BACKEND_API_URL is set. + default: "proxmox_node from the workspace vault, else pve" + description: Proxmox node the backend targets, paired with BACKEND_API_URL in config.json. Defaults to the workspace vault's proxmox_node so a fresh lab seeds the node it actually deploys to; the literal "pve" is only the last-resort fallback. Only consumed when BACKEND_API_URL is set. - name: INSTALL_TAILSCALE type: bool diff --git a/bundles/admin/software.install.deployer_ui/main.yml b/bundles/admin/software.install.deployer_ui/main.yml index 4722f3c..4f7771d 100644 --- a/bundles/admin/software.install.deployer_ui/main.yml +++ b/bundles/admin/software.install.deployer_ui/main.yml @@ -37,7 +37,10 @@ # Unset = no config.json rendered, operator configures # the backend by hand in the Settings modal. # - PROXMOX_NODE_NAME : Proxmox node that backend targets, paired with -# BACKEND_API_URL in config.json (default "pve") +# BACKEND_API_URL in config.json. Defaults to +# `proxmox_node` from the workspace vault, so the +# node is right without the call-site restating it ; +# falls back to "pve" only when neither is set. # # Source provenance (this bundle deploys the controller's WORKING TREE) : # The rsync below copies the controller's checkout as-is - branch, local @@ -133,10 +136,17 @@ - name: install deployer-ui - sync source + .env + docker compose up hosts: "{{ global_vm_ssh_name }}" become: true + vars_files: + # For `proxmox_node` — the node this workspace actually targets. Without it + # config.json would seed the literal "pve" on every deployment and the + # operator would still have to fix the node by hand in Settings, which is + # the exact retyping this file exists to remove. + - "{{ lookup('env', 'RANGE42_ACTIVE_CONFIG_DIR') }}/secrets/default_vault.yml" vars: LOCAL_CODE_PATH_RESOLVED: "{{ LOCAL_CODE_PATH | default(lookup('env', 'RANGE42_GITDIR__ROOT_DIR') + '/range42-deployer-ui/', true) }}" REMOTE_PROJECT_DIR_RESOLVED: "{{ REMOTE_PROJECT_DIR | default('/var/www/range42_deployer_ui') }}" UI_PORT_RESOLVED: "{{ UI_PORT | default('3000') }}" + PROXMOX_NODE_NAME_RESOLVED: "{{ PROXMOX_NODE_NAME | default(proxmox_node | default('pve', true), true) }}" tasks: - name: Install rsync on remote (required for synchronize) ansible.builtin.apt: @@ -232,7 +242,7 @@ content: | { "defaultBackendUrl": {{ BACKEND_API_URL | to_json }}, - "defaultNodeName": {{ PROXMOX_NODE_NAME | default('pve') | to_json }} + "defaultNodeName": {{ PROXMOX_NODE_NAME_RESOLVED | to_json }} } owner: root group: root