Infra
Infrastructure tree
This tree contains
infrastructure as code.
Each top-level project README must declare its creation date as
date: YYYY-MM-DD and a concise description of the project’s purpose in
front matter. The homepage and the Infra index at /infra/ list projects
newest first, and the index displays their descriptions. Routine edits
preserve the creation date.
Tracked source follows the repository’s public-source policy. Infrastructure
facts are not confidential merely because they are operational, generated, or
live. Reports may include them unless they contain credentials, other secrets,
or personal information. Inspect raw state, plans, inventories, and decrypted
configuration because those artifacts can contain prohibited content; do not
track the artifacts themselves.
Each infrastructure project owns its specifications and maintained changes
in <project>/openspec/. Use the pinned OpenSpec workflow
with that project selected. These specifications describe checked-in definitions;
they do not establish deployed state or authorize infrastructure operations.
Requirements
- Bazel targets MUST use repository-internal visibility.
- Infrastructure definitions MUST NOT be published as production artifacts.
- Infrastructure targets MUST NOT be dependencies of production build
targets.
- Public checked-in documentation MAY be included in the repository
documentation site, including non-secret, non-personal operational facts.
Transitive dependency enforcement
//infra:transitive_consumers allows internal infrastructure and developer
trees, website documentation, and the explicitly listed developer consumers.
The inherited Gazelle directive generates the package declarations. Ordinary
project packages, including projects/ansible_collection/roles/traefik, cannot
depend directly on infrastructure artifacts. Bazel 9.3.1 has an observed
indirect enforcement limitation
when an intermediary declares its own policy; do not treat this as a complete
transitive audit.
An exception grants access to every target in the consuming package; targets
sharing a package cannot have different transitive policies.
Shared AL helpers
infra_xo_login(name = ..., labels = ..., oidc_provider = ...) from
al_config.bzl declares a configuration target for the
Xen Orchestra login plugin with the shared XO and Vault endpoints. The caller
must supply the Vault OIDC provider name; the helper constructs its discovery
URL. The helper declares the
//infra/xcp_ng/cmd/xo_login executable dependency. Consumers select its labels
in their command wrapper. Registration does not authenticate until a matching
command selects the plugin.
Public target macros in al_config.bzl use the infra_ namespace, including
infra_dns and infra_ansible_keys. Backend calls use vault_tf_backend from
//tools/vault/tf_backend:defs.bzl, which owns their shared argument structure.
New project
The commands below are state-changing operator examples. An agent must use
bazel, apply the repository Terraform and secret-handling procedures,
and receive explicit authority for the exact operation and environment before
running an equivalent command.
- Create and apply the component’s standalone AppRole root.
See Grafana’s AppRole for an example.
- Add it to approles:
example
- Run apply:
bazel run //infra/vault/tf:tf.apply
- Update Yandex Cloud folders:
bazel run //infra/yandex_cloud/org1/tf:tf.apply
- Update Proxmox resource pools:
bazel run //infra/pve/tf:tf.apply
- Update Xen Orchestra AppRole resource sets:
bazel run //infra/xcp_ng/tf:tf.apply
- Set up al config:
example
- Configure the component’s Terraform state through the existing
Vault HTTP backend flow.
The
tf_backend plugin creates state and lock KV entries on first use.
1 - F-Droid
Android apps distributed through the Alwaldend F-Droid repository
In F-Droid, open Settings → Repositories, tap +, and scan the QR code
or enter the repository address.
https://fdroid.alwaldend.com/alwaldend/repo/

Apps
Repository signing
The publishing machine generates the F-Droid repository and builds the signed
index JARs. Vault Transit holds the private key and signs the index digests.
The download server serves the resulting files over HTTPS.


Provision the Transit signing identity
For the existing repository, an authorized Vault operator imports the original
RSA-4096 private key into transit/default/keys/src_infra_fdroid and retains
the original X.509 certificate. The certificate fingerprint must match the
repository setup link and the previously published index. The original
PKCS#12 keystore is in the existing repository_signing KV entry.
Use restricted, temporary storage on a trusted publishing machine for the
one-time extraction. Export the original leaf certificate and convert the
private key to unencrypted PKCS#8 DER, then base64-encode the DER for
Vault’s wrapped import.
From an authorized Vault session, pass the files by absolute path.
bazel run //:vault -- transit import transit/default/keys/src_infra_fdroid \
"@$key_base64_file" type=rsa-4096 exportable=false allow_plaintext_backup=false
bazel run //:vault -- kv put -mount=secrets -cas=0 \
alwaldend.com/vault1/approles/src_infra_fdroid/repository_signing_certificate \
"certificate=@$certificate_pem_file"
Apply the F-Droid AppRole policy through //infra/fdroid/approle:tf after
the key and public certificate are available. The release AppRole can sign
with the Transit key and read the public certificate. Access to the former
private-key entry is denied to that role. Remove the temporary import files
after verifying the imported identity and keep the repository certificate
stable across releases.
Collect signed APKs
For a production deployment, select the weekly releases/YYYY.W branch
using the repository release workflow.
Run al version show --format json to confirm the release channel and version
before building. For a follow-up update in the same week, use the next patch
on that release branch.
Build and sign Android Launcher and ActivityWatch Ingester through their
project-owned launcher
and ingester
targets. The apps attribute of the Bazel repository rule selects app metadata
targets. Their package names and the selected signed APKs supply the
packages entries in the generated index.
Sign a repository update
Pass a signed APK for each app being updated and a new output directory.
Use a JDK and Android SDK Build Tools as required by the
pinned F-Droid wrapper.
bazel run //infra/fdroid:sign -- \
--redeploy com.alwaldend.src.projects.android_launcher=out/release-apks/android_launcher.apk \
--output-directory out/fdroid-release
Repeat --redeploy to update more apps. The target fetches the deployed index
from repo_url in config.yml and verifies it with the repository’s
public certificate. It downloads and verifies the published APKs for apps
without a local replacement. A replacement must use the app’s existing
signing key and a higher version code, or be the exact APK published for
that code. Identical versions and metadata leave the output directory absent.
Use --previous-repo to override the URL, or pass --no-previous-repo to build
entirely from local artifacts. Supply a --redeploy for every app in local-only
mode.
Publish the public tree
The signing target publishes the v2 index format. It generates index-v2.json and its signed entry.jar
in out/fdroid-release/repo/. The repository configuration, selected app
targets, and app metadata are tracked in Git.
Each app owns its F-Droid metadata in the project’s fdroid/ directory.
Bazel renders the repository PNG from the
shared monogram SVG. The PNG is a
build output and is included in the signed repository under repo/icons/.
Publish the output directory to /srv/download/infra/fdroid/alwaldend/ on both
download hosts under the infrastructure publication root.
Before replacing a published tree, compare any previous index SHA-256 reported
by the target with the destination’s index under the publication lock. If the
digests differ, regenerate from the current published index.
Clients add https://fdroid.alwaldend.com/alwaldend/repo/.
To host another repository, publish its output in
/srv/download/infra/fdroid/<name>/ and configure its client URL as
https://fdroid.alwaldend.com/<name>/repo/. Keep the APKs, signed entry points,
and referenced files from the same signing run together.
2 - Airflow
Airflow workflow scheduling infrastructure in DC1
This project owns the Vault identity and DNS for airflow.alwaldend.com.
The AppRole root declares the component’s DNS access,
guest SSH signing role, Vault ACME role, and browser OIDC client. The
DNS declarations define the shared ingress name and
the DC1 guest address.
Deployment
- Apply
//infra/airflow/approle:tf.apply and reconcile shared Vault
memberships with //infra/vault/tf:tf.apply. - Apply
//infra/airflow/dns:tf.apply to configure the DC1 and global DNS
views. The ingress and guest serve the names when the Airflow service
is deployed.
2.1 - Airflow Vault AppRole
This root creates the Airflow AppRole, browser OIDC provider, DNS and
ACME permissions, and guest SSH signing role. See the
Airflow deployment order.
3 - MLflow
MLflow tracking and Vast.ai project execution
MLflow stores experiment metadata in SQLite and serves run artifacts over HTTPS
at https://mlflow.alwaldend.com. MLflow authenticates browser users through Vault OIDC.
The tracking API accepts bearer tokens for workload accounts.
External clients also need a client certificate trusted by shared ingress.


Shared ingress reaches the guest at dc1.mlflow.alwaldend.com. For sign-in,
MLflow redirects the browser to Vault and exchanges the authorization code
with Vault after the browser returns to MLflow.
Dotted connections show optional Vast.ai execution. A guest shell runs
mlflow run --backend vastai. The plugin creates the run and uploads the
project snapshot through guest Traefik before submitting the job to the
coordinator. The coordinator publishes terminal run status through the same
proxy. The rental fetches the project through shared ingress with a client
certificate and bearer token. The workload can use that connection to log
metrics and artifacts. The browser UI shows the run and its results.
The Xen Orchestra guest keeps service data on four dedicated persistent disks.
| Service data | Xen device | Size | Mount point |
|---|
| MLflow tracking database | /dev/xvdb | 10 GiB | /var/lib/mlflow-tracking |
| MLflow artifacts | /dev/xvdc | 40 GiB | /var/lib/mlflow-tracking/artifacts |
| Vast.ai coordinator | /dev/xvde | 5 GiB | /var/lib/mlflow-vastai |
| Traefik state | /dev/xvdf | 2 GiB | /opt/traefik |
The storage declaration supplies the disk order, sizes, and
mount points. Back up each volume. Ansible checks the attached disks before
formatting and refuses to mount a new volume over existing data. The services
require their data mounts at startup.
Bazel packages the pinned MLflow CLI, Python runtime, Vast.ai Projects plugin,
OIDC plugin, and coordinator. Ansible installs the package at /opt/mlflow/current.
The tracking process and the coordinator listen on loopback. The coordinator
assigns jobs to existing Vast.ai rentals and contacts their workers over SSH.
Credentials
The default deployment uses the Vault OIDC client and Terraform-generated
session key. It starts tracking and Traefik before any Vast.ai rental is
enrolled. The optional coordinator deployment uses mlflow-worker as its
configured rental label.
Vault’s MLflow OIDC provider admits members of global_admins. The
tf_setup root generates the session-signing key and stores it in Vault. The
tracking volume stores plugin accounts and sessions in auth.db.
Automation uses a token from an OIDC issuer that signs workload JWTs. Initialize
alwaldend.com/vault1/approles/src_infra_mlflow/workload using the component
AppRole, as in the coordinator example below. The JSON fields are issuer,
discovery_url, audience, and token. The discovery endpoint must advertise
a reachable JWKS URL. Tokens must carry the pinned issuer and audience and
an email or preferred_username claim.
In the MLflow UI, create external service accounts bound to the workloads
provider and each token’s subject. Grant each account access to its intended
experiments. The coordinator rereads
/var/lib/mlflow-vastai/tracking-token on every tracking request. Replace the
file atomically with a fresh token before expiration, or update the Vault
entry and rerun Ansible. Credential renewal belongs to the workload issuer
and operator.
Set MLFLOW_TRACKING_TOKEN for the CLI and rental worker processes. Refresh
the credential before it expires, including inside long-running MLflow
clients. External clients also need MLFLOW_TRACKING_CLIENT_CERT_PATH for
shared ingress. Direct guest clients can set
MLFLOW_TRACKING_SERVER_CERT_PATH to the trusted Vault CA bundle.
Initialize the coordinator KV entry from a task-private JSON file containing
these fields.
| Field | Value |
|---|
api_key | Vast.ai key with permission to inspect the configured existing rentals |
ssh_private_key | Dedicated unencrypted OpenSSH Ed25519 identity, with its trailing newline |
ssh_known_hosts | Verified OpenSSH host keys for the endpoint and port of every rental |
Authorize that key on the worker account, which defaults to root in
the inventory. Use bracketed
[hostname]:port known-hosts entries for non-default SSH ports. Write the
initial JSON object using the component AppRole and prevent replacement of
an existing entry with -cas=0.
bazel run //infra/mlflow:vault.kv_put -- -cas=0 \
alwaldend.com/vault1/approles/src_infra_mlflow/coordinator \
- < "$MLFLOW_COORDINATOR_JSON"
Deployment
The AppRole, shared Vault memberships, and DNS
records are deployment prerequisites.
- Apply
//infra/mlflow/approle:tf.apply to register the Vault OIDC client. - Synchronize the AppRole in Xen Orchestra using the
resource-set workflow. Apply the shared resource
set before running the guest setup.
- Apply
//infra/mlflow/tf_setup:tf_setup.apply to create the VM and the
OIDC session key. - Run
bazel run //infra/mlflow/ansible, then deploy the HTTPS route with
bazel run //infra/ingress/ansible. - Sign in with Vault.
To enable project execution, enroll a rental with the label mlflow-worker,
initialize the coordinator and workload KV entries, and run
bazel run //infra/mlflow/ansible:ansible.coordinator. Register the workload
accounts in MLflow before submitting runs. Use the coordinator target for
subsequent deployments that use the workload issuer.
Run a project
Prepare each existing rental with the worker binary, MLflow CLI, tracking
credentials, and project runtime. Ensure the worker service and the SSH user
use the same state directory and both can find the packaged binaries. Follow
the worker setup.
The packaged Linux runtime is available from
bazel build //infra/mlflow/runtime.
Create a backend file on the MLflow guest using the local coordinator.
{
"server": "127.0.0.1:50051",
"insecure": true
}
After loading a workload bearer token into the submitting shell, run:
export MLFLOW_TRACKING_URI=https://mlflow.alwaldend.com
/opt/mlflow/current/mlflow run /path/to/project \
--backend vastai --backend-config /path/to/backend.json --env-manager local
3.1 - MLflow Vault AppRole
This root creates the MLflow AppRole, its DNS access, guest SSH signing role,
and Vault ACME role. Apply it before reconciling the shared Vault memberships.
See the MLflow deployment order.
4 - Grafana
DC1 monitoring dashboards backed by VictoriaMetrics with Vault sign-in
Architecture


Bazel renders the Mermaid source in light and dark themes.
One Fedora VM in DC1 runs Grafana from the Fedora package under systemd.
Terraform provisions the XCP-ng guest through Xen Orchestra with two
vCPUs, 4 GiB of RAM, and a persistent 20 GiB disk. Grafana stores its
SQLite database at /var/lib/grafana/grafana.db. Ansible configures the
guest, installs Grafana through the alwaldend.main.grafana role, and sets
up Traefik. VictoriaMetrics scrapes Grafana’s native HTTPS metrics endpoint
and Traefik’s separate Prometheus listener.
Open Grafana from the DC1 network with
the Vault server CA trusted by your browser. Traefik serves Vault-issued
HTTPS, redirects HTTP, and proxies to Grafana on loopback. The firewall
allows administrative SSH from any routed source. Select Sign in with
Vault to sign in as a member of global_admins. Those users become
Grafana server administrators. The guest’s SELinux policy allows the Grafana
process to connect to Vault’s OIDC API on TCP 8200.
From outside DC1, use the same hostname with a trusted ingress client
certificate. Shared ingress verifies the guest’s Vault-issued certificate
and forwards traffic through the dedicated dc1.grafana.alwaldend.com
backend name. Grafana still requires application sign-in.
Manage the VictoriaMetrics data source and repository dashboards through the
Grafana Terraform root.
Deployment
Review and apply the Grafana Vault AppRole,
then reconcile shared memberships with //infra/vault/tf:tf.apply.
Synchronize the AppRole identity and resource set using the
Xen Orchestra workflow.
Store the local recovery password and a separate stable Grafana encryption
key in Vault. Generate both independently. The example reads protected
files containing the values.
bazel run //infra/grafana:vault.kv_put -- \
alwaldend.com/vault1/approles/src_infra_grafana/config \
admin_password=@"$grafana_password_file" secret_key=@"$grafana_secret_key_file"
Confirm the address in the DNS declaration is
available. Review the VM and DNS plans separately before applying them.
bazel run //infra/grafana/tf_setup:tf_setup.plan
bazel run //infra/grafana/tf_setup:tf_setup.apply
bazel run //infra/grafana/dns:tf.plan
bazel run //infra/grafana/dns:tf.apply
Wait for cloud-init, verify the guest SSH host key out of band, and check
that Vault resolves the DC1 DNS record. Deploy with
bazel run //infra/grafana/ansible.
With Traefik running, verify Vault can reach guest TCP 80 for ACME
HTTP-01. Check the HTTPS certificate and sign in through Vault to verify
the server administrator role.
Once Grafana DNS and the guest firewall are ready, deploy
shared ingress. Verify that ingress can reach
the guest over HTTPS and that the public route requires a trusted client
certificate.
Reapply the VictoriaMetrics playbook and
check that the Grafana proxy is up in the traefik_dc1 job.
When adding ingress to an existing Grafana VM, apply its AppRole and DNS
changes and rerun the Grafana playbook before deploying shared ingress.
Grafana uses the local admin password only when initializing an empty
database. Change an existing password through Grafana and update the
recovery value in Vault. Keep the encryption key with the database backups
to preserve access to encrypted data source settings.
4.1 - Grafana configuration
This Terraform root manages the VictoriaMetrics Prometheus data source and
repository dashboards through the Grafana API. It uses its own Vault HTTP
backend and requires DC1 access to the Grafana hostname.
Dashboards
Place dashboard JSON at dashboards/<section>/<project>/<dashboard>.json.
For example, dashboards under dashboards/infra/ingress/ appear in Grafana
under infra → ingress. Use a distinct, stable dashboard UID and the
victoria-metrics Prometheus data source UID. The relative file path is the
Terraform instance key. Preserve the UID and move the Terraform address when
renaming a file. Folder IDs derive from repository paths.
The dashboard under infra → victoria_metrics renders every panel in
VictoriaMetrics’ existing Monitoring overview. Its queries and layout come
from the VMUI dashboard source.
Deployment
- Apply the Grafana AppRole changes and deploy the Grafana Ansible playbook.
The playbook enables nested folders and allows the Grafana process to reach
the VictoriaMetrics HTTPS data source under SELinux.
- Review
bazel run //infra/grafana/tf:tf.plan, then run
bazel run //infra/grafana/tf:tf.apply. The Grafana AppRole supplies the
existing Grafana local administrator password and the VictoriaMetrics Basic
Auth credentials. Terraform stores the data source password in the protected
backend state. - Verify the data source and open the dashboards under infra. The Grafana
dashboard requires the collector’s native
grafana scrape job.
4.2 - Grafana Vault AppRole
This root owns the Grafana AppRole, DC1 DNS credential access, guest SSH
host signing, Traefik’s ACME enrollment, and the application OIDC client.
The OIDC client allows sign-in for global_admins and exposes its client
credentials to the deployment AppRole. The AppRole also has read access to
the VictoriaMetrics web credential used by the Grafana Terraform data source.
Provision the shared Vault mounts, administrator group, and OIDC scopes
first. Review this root using
bazel run //infra/grafana/approle:tf.plan. Apply the root
before reconciling shared Vault memberships and the Xen Orchestra resource
set. The Grafana runbook gives the deployment
sequence.
5 - VictoriaMetrics
Single-node metrics storage and scraping for DC1 services
Architecture


Bazel renders the Mermaid source in light and dark themes.
One Fedora VM on XCP-ng runs VictoriaMetrics single-node under systemd.
The guest starts with 2 vCPUs, 4 GiB RAM, and a persistent 40 GiB boot and
data disk. The database lives at /var/lib/victoria-metrics. Retention is
30 days, with an ingestion cutoff when free disk space falls below 5 GiB.
Bazel verifies the release archive and packages the executable for Ansible.
VictoriaMetrics scrapes its loopback endpoint every 15 seconds and the
Traefik proxies every 30 seconds. The traefik_ingress job uses active
ingress hosts from the WireGuard inventory. The traefik_dc1 job covers
Forgejo, dev1, Grafana, three OpenHands hosts, the 3x-ui control plane, and the
local download host. Each proxy firewall allows metrics traffic from the
VictoriaMetrics guest address. Cloud-only proxies need a private route
before they can join these scrape jobs.
The grafana job scrapes Grafana’s native Prometheus metrics over HTTPS
every 30 seconds using the guest’s Vault CA trust.
Add scrape jobs to the scrape YAML template.
Bazel packages the ingress inventory as an extra-vars file. Ansible renders
the active WireGuard targets from it.
Provisioning
- Provision the dedicated Vault AppRole, including its
DNS policy, SSH host certificate signer, and the Vault ACME role.
Run the web credential setup to generate
and store the dashboard login and verifier.
Reconcile Vault memberships and synchronize the OIDC identity and resource set
through the Xen Orchestra workflow.
- Verify that the address in the DNS declaration is
available on the DC1 VM network. Review the component’s DNS and VM plans
separately before applying them.
- Once SSH is available and cloud-init has finished, verify the guest’s host
key and run
bazel run //infra/victoria_metrics/ansible. The configured
SSH destination on DC1 is victoria-metrics.alwaldend.com. The deployment
also allows an explicit ansible_host override before DNS is available. - Verify Vault resolves the service hostname through DC1 DNS and can reach
guest Traefik on port 80 for ACME validation. Check that Traefik serves the
Vault certificate and shared ingress can reach the backend. Guest Traefik
renews the certificate automatically. Shared ingress uses Let’s Encrypt.
Dashboard
Open https://victoria-metrics.alwaldend.com/vmui/ with a trusted ingress
client certificate and the shared Basic Auth login. Members of Vault’s
global_admins group can read the credentials at
secrets/alwaldend.com/vault1/approles/src_infra_victoria_metrics/web_auth.
Ingress verifies the guest’s Vault-issued certificate.
On the DC1 LAN, use the same dashboard URL and Basic Auth login. DC1 DNS
points the service name directly at guest Traefik, so the browser must trust
the Vault server CA. HTTP redirects to HTTPS. Shared ingress alone uses the
dc1.victoria-metrics.alwaldend.com upstream name.
Select Dashboards → Monitoring overview for scrape health, Traefik traffic
and certificate expiry, and VictoriaMetrics disk and ingestion metrics.
The panels are defined in monitoring-overview.json.
For a table of targets that are down, run up == 0 in Query and select
Table.
The HTTP listener on guest loopback also remains available through SSH
local port forwarding to 127.0.0.1:8428 using the Ansible account.
This deployment has one failure domain. Guest or disk loss
can make the stored metrics unavailable. Off-VM backup storage is outside
this component.
5.1 - Vault AppRole
This Terraform root owns the AppRole for the
VictoriaMetrics deployment. Provision
the shared Vault prerequisites, apply this root, then reconcile the shared
AppRole and Ansible memberships before synchronizing its Xen Orchestra
identity.
Use bazel run //infra/victoria_metrics/approle:tf.plan to review the
AppRole and tf.apply to deploy it. The root uses the Vault infrastructure
credentials for its policies and HTTP state.
The AppRole can enroll Traefik through the component’s Vault ACME directory.
The PKI role allows the VictoriaMetrics service hostname.
The global_admins group inherits read access to the login through the
component’s readers group. The component AppRole manages the web_auth
entry in its own subtree. The separate
tf_setup package generates and stores the
credentials using these permissions.
5.2 - VictoriaMetrics DNS
The DNS declaration gives the service hostname two records:
a public CNAME to shared ingress and a DC1 A record for the guest. A third
record, the public dc1.victoria-metrics.alwaldend.com A record, lets shared
ingress resolve the guest’s private address through public DNS. Terraform
provisioning uses the same guest address.
Verify the address is available on the DC1 network before deployment.
Review DNS changes with bazel run //infra/victoria_metrics/dns:tf.plan.
5.3 - VictoriaMetrics web credential setup
Run bazel run //infra/victoria_metrics/tf_setup/web_auth:tf_setup.apply
after configuring the component AppRole and before running Ansible. The
component AppRole writes the dashboard login and bcrypt verifier to web_auth
in its own Vault subtree. Ansible injects the verifier file for Traefik.
The credential state uses an admin-owned backend because it contains the
generated password. Reapply the guest playbook after rotating the credentials
to load the updated verifier.
6 - OpenCanary
Network honeypot on XCP-ng with protocol decoys and SMB auditing
One Fedora VM on XCP-ng runs Thinkst OpenCanary natively under systemd.
Terraform provisions the guest through Xen Orchestra. The
OpenCanary Ansible role
installs the service and its optional read-only Samba decoy.
The profile is defined in group variables.
It enables all built-in protocol modules, including SMB auditing. The Fedora
profile leaves port-scan detection disabled because OpenCanary requires
legacy iptables for that module. Administrative SSH remains on TCP 22 and
the SSH decoy listens on TCP 2222. The role disables LLMNR in the guest
resolver so the LLMNR decoy can listen on UDP 5355.
Events appear in the guest journal under opencanary.service. No external
alert destination or dashboard is configured.
Network architecture


The Mermaid source shows public ingress and the local
access path labeled with the decoys in the guest profile.
Traefik requires a trusted client certificate and uses HTTPS over WireGuard
to reach the web decoy. Traefik verifies the Vault-issued backend certificate
for opencanary.alwaldend.com.
- Apply the standalone Vault AppRole,
reconcile its shared Vault memberships, then synchronize its identity through
the XCP-ng workflow.
- The Xen Orchestra resource set uses the regular VM network. The
DNS declaration owns the static IPv4 address and the
DNS root publishes the name in the site-local view.
- Management SSH accepts connections from any routed source. Decoy traffic
defaults to the guest subnet. The ingress WireGuard peer may also reach the
HTTPS decoy. Verify the guest SSH host key out of band before connecting.
bazel run //infra/opencanary/tf_setup:tf_setup.plan
bazel run //infra/opencanary/tf_setup:tf_setup.apply
bazel run //infra/opencanary/dns:tf.apply
bazel run //infra/opencanary/ansible
For an existing HTTP upstream, apply the AppRole changes, then use these
Ansible stages to switch the route without retiring its HTTP access early:
bazel run //infra/opencanary/ansible -- --tags opencanary_tls
bazel run //infra/opencanary/ansible -- --tags firewall --extra-vars '{"firewall_delete_rules":[]}'
bazel run //infra/ingress/ansible -- --tags traefik
bazel run //infra/opencanary/ansible -- --tags firewall
Verify the HTTPS listener from ingress before switching Traefik. The guest
keeps its private key. Run the opencanary_tls stage weekly to replace the
30-day certificate when fewer than seven days remain.
6.1 - OpenCanary DNS
This Terraform root manages the site-local address, upstream alias, and public ingress alias in
dnsconfig.json. The guest uses the same declared address.
Review with bazel run //infra/opencanary/dns:tf.plan.
7 - Image generation
Vast.ai ComfyUI rental with Vault-managed HTTPS credentials

This project owns one image-generation rental in tf_setup.
It uses the reusable ComfyUI module
in exposed mode: a single HTTPS proxy with a generated username/password login,
plus account-key SSH access managed by infra/vastai. The GPU must have at least 32 GiB VRAM.
The deployment configuration selects the model and hardware profiles.
The Qwen bundle includes ordinary edits, crop-composited keyframes, selected-frame
GIF assembly, both chained GIF variants and the existing RIFE engine.
The NoobAI profile includes a text-to-image App and the local Danbooru Tag
Search App. The NoobAI sequence App has a six-image, two-scene default, persistent references and
one combined GIF, with optional Canny structure guidance and RIFE interpolation.
Separate reference-sequence and scene-composer Apps expose the previous-image
and independent two-pass strategies; the composer uses shared descriptions and
an optional already-installed LoRA instead of image references.
Separate sketch-edit Apps
take a source image and an aligned desired-outline sketch, with a painted-mask
variant for restricted edits. They reuse the existing Canny weights; their GPU
edit quality remains unverified.
The Ansible deployment calls the reusable comfyui_tools
role to install all selected models, LoRAs, node packs, dependencies and native
workflows/Apps, including the pinned interpolation tool when selected.
Terraform provisions the rental and authenticated access. workspace_directory
in the configuration controls the shared workspace path for both stages.
MOSS-Image SFT/Base INT8, full Chroma1-HD, FLUX.2 dev 32B FP8, Juggernaut XL v9,
HiDream-I1 Full 17B, Illustrious XL v2.0-STABLE, FLUX.2 klein Base 9B FP8,
NoobAI XL 1.1 and Qwen-Image-Edit-2511 remain selectable profiles;
see model configuration.
Choose moss-image-heal with the Ansible model profile selector
to install the pinned INT8 ConvRot checkpoint, the shared MOSS encoder and VAE,
and the Heal workflows and Apps.
The MiniMax H3 Video profile installs
quantized H3 Base weights and saved workflows for text-to-video and
first/last-frame video generation with stereo audio.
The additional uso and umo-uno profiles provide native FLUX.1 subject/style
and multiple-identity conditioning respectively; both have prompt sequences.
Juggernaut includes the approved IP-Adapter Plus and CLIP vision weights for
several character/style references; NoobAI and Illustrious reuse that SDXL path.
NoobAI’s scene sequence, Canny and interpolated GIF pipeline have completed GPU
execution; precise pose edits and exact character identity remain limited.
Illustrious has offline packaging checks only. HiDream’s GIF
workflow completed the approved eval case, with poor motion/reference quality;
its other workflows remain unverified on a GPU.
Prompt Sequence uses the native multiline
editor; blank lines in line mode provide visual spacing without extra panels.
Identity and state
The component authenticates as src_infra_image_gen, declared by
Vault Terraform. Its own namespace
at mount secrets is alwaldend.com/vault1/approles/src_infra_image_gen:
| Entry | Owner | Purpose |
|---|
vastai | infra/vastai/alwaldend | Dedicated generated team key (api_key) |
web | This project’s tf_setup | Generated HTTPS username/password |
tf_backend/setup | This project’s backend | Rental Terraform state and lock |
huggingface | Operator or external IaC | Optional gated-model read token |
The existing team root creates and delivers the
key using its own issuer and Vault identity. Its delivery policy covers only
this component’s vastai entry. The rental reads that entry through its own
AppRole; it never reads the team’s operator seed or passes an API key to the
container. The operator can bootstrap the role and browse its KV entries through
existing Vault identity membership. No general infrastructure group is required.
Deployment status
Check remaining team credit before
renting or leaving an instance running.
The NoobAI XL 1.1 rollout used the 48 GB ComfyUI rental. The instance has
been released. See the
NoobAI deployment record
for the instance and verification results.
The previous MiniMax H3 Video rollout provisioned a 48 GB ComfyUI rental. See the
deployment record
for the instance and verification results.
The latest visible-motion trial created 48 GB Qwen instance 60921795 through
Terraform and installed it through the shared Ansible role. It completed the
owned trials and was retained under the operator’s instruction. Its
deployment record
owns the dated connection and cost observations. A later Vault authentication
failure prevented a fresh provider check during PR completion; the record is
not a live status guarantee. The preceding instance 60894930 was destroyed at
the operator’s request before this rental was created.
The preceding 48 GB Qwen trial completed four structural-reference still edits and
then released test instance 60886376. The hand outline guided the pose, but
contact, scene artifacts and duplicate anatomy prevented frame/GIF acceptance.
That trial’s connection outputs were cleared; its
deployment record
records installation, results and teardown.
An earlier rental used NoobAI on the 96 GB RTX PRO 6000 profile,
with retention requested. The original ten workflows were uploaded. Its endpoint
is now unavailable and the provider lookup no longer returns that instance;
the two additional App variants remain packaged for import. The
current deployment record
owns its instance identity, endpoint observations, in-place installation and
sequence/GIF results. Earlier rental observations follow.
The former personal stack was destroyed on 2026-11-10. The replacement AppRole,
scoped policies, dedicated team key, generated web login and component state
remain deployed. The earlier Flux, FLUX.2 dev, NoobAI and HiDream rentals were
destroyed at the operator’s request. The operator-requested deployment on
2026-11-13 created personal instance 60406482. It was subsequently destroyed at
the operator’s request; its connection outputs are cleared and no rental is
managed by this root according to that record. Component credentials remain deployed.
The requested MOSS-Image deployment created instance 60541185 on the named
48 GB RTX PRO 5000 profile. All twelve examples, including six sequence variants,
are staged; single-image SFT text-to-image and
Base layout-guided generation completed. Sequence and edit/control execution remain
unverified. See the historical MOSS deployment record.
USO and UMO-UNO remain source-only alternatives. The
earlier NoobAI record
documents deployment and its verification limits; the earlier Chroma acceptance
retains its historical workflow results. The component did not reuse personal state or credentials. Historical
Vault versions can remain protected; the shared team and operator seed remain.
Deployment is staged: authorize the component role and delivery policy through
Vault Terraform, create the dedicated key through the team root, then rent
through this project’s tf_setup, then install the selected application profile through Ansible. Each live apply requires its own reviewed
interactive plan. Building and testing the source performs none of these steps.
Privacy boundary
The configured Vast ComfyUI image runs ComfyUI on the rented host. It is not a separate hosted
inference API, and this configuration adds no prompt/image upload service or
access logging. ComfyUI can retain generated images and prompt metadata locally;
provisioning scripts and extensions can access those files and the internet.
The image is selected directly by tag in the rental Terraform. Review optional templates, scripts, models, and extensions before use.
Vast’s privacy policy covers its account and website
processing; it does not establish a blanket no-retention or no-training promise
for this stack. Vast’s security FAQ
describes tenant isolation and recommends Secure Cloud providers for sensitive
workloads. The module requests datacenter/verified offers and checks returned
hosting_type=1 and verification=verified, rejecting absent tier metadata.
This selects Vast’s certified datacenter tier; it does not establish
confidentiality against the host administrator. SSH and HTTPS
protect transport, not a workload from its machine’s administrator.
Gated Flux downloads require a read-only Hugging Face token. The operator or
external IaC stores it in the huggingface entry as field token; this component only reads
it. The authenticated Ansible entry point receives it through AL injection for the gated profile and supplies it to the publisher download request.
The token is visible to rental processes and the host administrator. No Vault or
Vast account key is passed to the rental.
Keep wanted images locally and export them before releasing the rental. Stopping
retains billable storage. Destruction removes the contract’s local storage but
this project cannot verify physical erasure or exclude host-made copies.
Generated login credentials also remain in the Vault-backed Terraform state
and may remain in historical Vault secret/state versions. There are no public
password outputs. Destroying the rental does not revoke copies already disclosed.
Command-line access
For agent-run acceptance tests, finish local implementation and offline checks
before renting. Keep test rentals only while provisioning, generating or
retrieving results; treat roughly three minutes without active test work as
idle. Destroy the rental through the owning Terraform workflow before coding,
review or other local work, and clear its connection outputs with refresh-only
apply. Personal rental creation and release remain manual reviewed operations.
The separate evals composition automates only its labeled evaluation rentals. An instance being used by the
operator is outside this disposable-test rule.
Use the authenticated target for manual work on an existing rental. By
default it reads the HTTPS URL from the owning Terraform output target and
retrieves the web login through the component Vault AppRole.
First NoobAI render
From the repository root, build the packaged workflows and render the
included sample. If the rental URL has yet to be recorded in Terraform, set
COMFY_HTTPS_URL to the rental’s root HTTPS URL before running render.
bazel build //projects/comfyui_tools/workflows:workflows
workflows="$PWD/bazel-bin/projects/comfyui_tools/workflows/noobai"
output="$PWD/out/comfyui/images"
mkdir -p "$output"
bazel run //infra/image_gen:comfy -- render \
--workflow "$workflows/noobai-text-to-image.json" \
--output-dir "$output" > "$output/text-to-image.json"
The render downloads the image into $output and records the prompt ID and
file paths in text-to-image.json. Native NoobAI workflows default to Euler
ancestral, CFG 5.5, and 25–30 steps. Text-to-image starts at 1024 × 1024.
Scene Composer starts at 832 × 1216. Sketch edit follows the source image
dimensions. Other model-card sizes (width × height) are 768 × 1344,
896 × 1152, 1152 × 896, 1216 × 832, and 1344 × 768. To render the
packaged text-to-image workflow in portrait, append
--slot 4.width=832 --slot 4.height=1216 to its render command.
The default prompts use the model card’s quality prefix and negative tags.
NoobAI XL 1.1 model card
Render with a reference
Reuse the first render as a reference. Leave the default prompt in place or
change it with --slot '2.text=YOUR PROMPT'.
reference=$(jq -er '.files[0]' "$output/text-to-image.json") &&
bazel run //infra/image_gen:comfy -- render \
--workflow "$workflows/noobai-image-to-image.json" \
--image "8.image=$reference" \
--output-dir "$output"
For an exported
native workflow, supply repeatable --slot 'NODE_ID.input=value' options for
prompt or sampler inputs, or --image 'NODE_ID.image=/absolute/path.png' to
upload a reference and select it in the same command. For example, the
packaged noobai-image-to-image workflow uses 2.text for its positive
prompt and 8.image for its reference. In the packaged
noobai-prompt-sequence workflow, 8.prompts takes one panel per line.
Use workflow slots /absolute/path/workflow.json to find addresses in other
native workflows. Text-to-image and prompt-only sequences can omit
--image. The source workflow stays intact.
Search tags locally before composing a prompt. This command uses the pinned
Danbooru vocabulary and works independently of the rental.
bazel run //tools/comfyui:tags -- 'blue hair' --limit 10
Troubleshooting
If you already have the managed rental’s HTTPS URL, set COMFY_HTTPS_URL
in the environment for the authenticated target. Supply the root URL, such as
https://192.0.2.10:36378, with no credentials, path, query, or fragment.
The override skips the Terraform output lookup. The Bazel target still
initializes its Vault and Terraform backend plugins, needs the Vault web
login, and verifies TLS with the pinned Vast CA and endpoint hostname.
Run these commands with write access to the host’s configured Bazel output
base. In a managed sandbox that mounts it read-only, Bazel can fail with
Output base directory ... must be readable and writable. Use the host
Bazel environment with approved access to that output base. See the
al-bazel troubleshooting guidance.
Use bazel run //infra/image_gen:comfy -- --json system-stats to check the
connection. For a job submitted separately with run --workflow /absolute/path/workflow.json,
use jobs status PROMPT_ID when you need progress and
download PROMPT_ID -o /absolute/path/outputs to retrieve its files. URLs in
job status point at the temporary loopback bridge and expire when that
invocation exits. Use //tools/comfyui:cli for upstream help or
unauthenticated local use.
Manual galleries
Download the images into a task directory under ignored out/. Put
gallery.html in that directory and reference each downloaded image with a
path relative to the HTML file, such as images/sample.png. Open the gallery
as a local file. When handing off a gallery requested as a file, link its
absolute path and keep the HTML and images together. Reserve html_render
for in-conversation previews. The file uses downloaded images and opens
independently of the bridge or rental.
Reusable nodes and workflow files belong to
ComfyUI tools. For several panels, open
the selected profile’s prompt-sequence workflow and follow its
panel instructions.
For scene-aware NoobAI generation, use
noobai-image-sequence.
It opens as a native ComfyUI App with persistent references, previous-image edits
and explicit fresh-scene breaks. Its node is staged only with that workflow.
One combined GIF is generated for the selected sequence. Live deployment
observations belong to the maintained deployment record.
Automated evaluations
The separate evals composition configures parallel temporary
workloads, result collection and namespace-wide final/manual cleanup. Its code
and cases belong to ComfyUI tools. It does not use this personal rental’s
Terraform state and does not rent during source validation.
Architecture diagram
The diagram source is docs/architecture.mmd. It uses the
shared Alwaldend dark palette and typography, composed with the existing Mermaid
actor artwork for the requested browser actor. The local template derives both
from their owners. Build the WebP with
bazel build //infra/image_gen/docs:architecture_dark_webp. The documentation
consumes the rendered target directly; generated images are not checked in.
The diagram describes the configured
architecture, not an active rental. The simplified certificate label refers to
Vast’s non-public instance trust chain; see the base module’s certificate guidance.
7.1 - Image generation provisioning
Generate a Vault-backed login and rent one HTTPS-protected ComfyUI instance
This Terraform root generates a 48-character random alphanumeric password,
stores {username, password} at mount secrets, path
alwaldend.com/vault1/approles/src_infra_image_gen/web, and then rents
one ComfyUI instance with that login. A failed Vault write prevents rental creation.
The backend stores state under the component AppRole’s tf_backend/setup namespace.
The rental credential is injected as VAST_API_KEY; Vault provider authentication
is injected separately through AL. No account API key is passed to the container.
Rent and connect
First deploy the src_infra_image_gen AppRole and exact-path team-writer
policy through Vault Terraform.
Then run team credential setup to generate
and store a fresh key in this component’s namespace. The component credentials
are deployed; the previous Flux rental and its Base replacement were destroyed at the operator’s request. These remain operator instructions. The
acceptance record
owns the observed rental and workflow results.
The module uses
the direct Vast ComfyUI/CUDA 12.9 image tag declared in deployment settings,
without inheriting stock template options. The root selects an explicit published release tag. Update that one image reference to select a newer build;
there is no registry lookup or helper executable during Terraform planning.
Changing the tag produces a reviewed replacement plan for an existing rental.
The component’s deployment settings define the image, HTTPS username,
default model profile and hardware profile definitions. Set
TF_VAR_hardware_profile to a profile name from that registry to select rental
hardware at invocation time. Use the same selection for operations on that rental.
Ansible selects the model independently.
Other model profiles remain available
as chroma-hd, flux2-dev, juggernaut, hidream-i1-full, illustrious, flux,
qwen, noobai, uso and umo-uno. Selecting a profile does not rent until an explicitly authorized apply.
Application installation is a separate Ansible stage.
Every profile’s complete workflow catalog, models, LoRAs and approved nodes are
installed by the shared role after the existing image initializes ComfyUI.
workspace_directory in deployment.json is passed to this module and the role.
Terraform does not carry those asset payloads in startup or state. Account-wide
SSH access is managed by infra/vastai, using the
host user’s Vault metadata. Deploy that policy and registration before relying
on the host key to run Ansible; no private key is copied to the rental.
export TF_VAR_hardware_profile=48gb
bazel run //infra/image_gen/tf_setup:tf.plan
bazel run //infra/image_gen/tf_setup:tf.rent
rent displays the interactive plan; review it before approving. The selected
48gb hardware profile requires RTX PRO 5000 Blackwell, at least 47 GiB reported
VRAM, 100 GB disk and a USD 1/hour ceiling. The optional 96gb profile requests
at least 95 GiB reported VRAM, 150 GB disk and a USD 3/hour ceiling.
The optional standard profile requests one GPU with at least 32 GiB VRAM, 100 GB
disk and a USD 1/hour ceiling including disk. The module selects the cheapest
qualifying Secure Cloud offer. The ceiling is not a total budget and market
availability is not guaranteed.
Model and hardware selections are independent. The named GPU filter applies
only to 48gb; other profiles retain automatic GPU selection.
Creation acknowledges a contract; boot and provisioning take longer. Refresh
through the same owner after boot, reviewing its interactive plan:
bazel run //infra/image_gen/tf_setup:tf.refresh
bazel run //infra/image_gen/tf_setup:tf.output
https_url remains absent until a refresh reports the public IP and mapped port.
Verify the Vast instance certificate before entering credentials; follow the
module’s certificate guidance.
Retrieve the login through an authorized Vault client using the reference above;
do not paste it into logs or command arguments. ssh_forward_command provides
an alternative for account SSH keys. Export images before release:
bazel run //infra/image_gen/tf_setup:tf.release
Changing the password or access settings replaces the instance; export files
first. Destroy removes all versions of the managed web-login entry. Protected historical
Terraform state versions can still retain credentials. The root has
no automatic expiry or spend cutoff. See the privacy boundary.
Offline validation
bazel test //infra/image_gen/tf_setup:all
The checks omit the live backend, validate the actual module/provider schema,
and exercise password generation and Vault persistence with a mocked Vault and
overridden rental module; the separate CLI E2E suite covers the actual rental module. They do not write Vault or rent
capacity. The provider’s Terraform CLI acceptance suite emits separate SSH and
HTTPS lifecycle artifacts. The ComfyUI module checks cover alternate workspace
paths, empty application provisioning and the 16 KiB startup limit. The separate
Ansible role fixture verifies model destinations, source installation, workflow
preservation and safe repeat application using disposable local inputs. Neither
check downloads real weights or evaluates generated images. Actual image startup and TLS/authentication require
a separately scoped live acceptance run.
Download models
model_profile in deployment.json selects matching model downloads and saved workflows.
Every saved name uses <profile>-<purpose>, matching its generated JSON filename:
Juggernaut also stages juggernaut-multi-reference and
juggernaut-multi-reference-prompt-sequence, with three shared character/style
references through IP-Adapter Plus. The two additional public safetensors files
add about 3.4 GB: the SDXL Plus adapter in models/ipadapter and its CLIP-ViT-H
encoder in models/clip_vision. Their publisher revisions are fixed in the model catalog.
NoobAI provides noobai-image-sequence and its first-party image_sequence module.
The Ansible deployment installs the module, every
selected native workflow/App, approved Canny checkpoint and pinned RIFE engine.
All profiles use the same installation role; no workflow is embedded in startup.
This native ComfyUI App reuses original IP-Adapter
references across scenes, starts each scene from fresh noise and edits the preceding
image for subsequent actions. A line containing --- starts a new scene. The
App instructions
cover uploads, change strength, continuation and one combined GIF. The
default includes three related poses in each of two scenes. GPU and reference
quality acceptance belongs to the current deployment record.
The separately named reference-sequence and scene-composer Apps compare that
carry-forward approach with independent two-pass sampling, fixed shared prompt
fields and optional installed LoRA weights. Both retain scene boundaries and
individual PNGs, and neither publishes per-scene GIFs.
| Profile | Bundle | Native workflows |
|---|
juggernaut | Juggernaut XL v9 all-in-one SDXL checkpoint | juggernaut-text-to-image, juggernaut-image-to-image, juggernaut-prompt-sequence, juggernaut-style-reference, juggernaut-style-prompt-sequence |
noobai | NoobAI XL 1.1 all-in-one SDXL checkpoint, SDXL Plus adapter and CLIP vision | Seven purposes as Juggernaut, plus img2img prompt sequence; prefixed noobai- |
illustrious | Illustrious XL v2.0-STABLE SDXL checkpoint, SDXL Plus adapter and CLIP vision | Seven purposes as Juggernaut, prefixed illustrious- |
hidream-i1-full | HiDream-I1 Full 17B FP16, four local text encoders, FLUX VAE | Eight purposes: txt2img, img2img, their prompt sequences, style and its sequence, and both GIF paths; prefixed hidream-i1-full- |
chroma-hd | Full Chroma1-HD, FP16 T5 encoder, FLUX VAE | chroma-hd-text-to-image, chroma-hd-image-to-image, chroma-hd-style-reference, chroma-hd-prompt-sequence, chroma-hd-style-prompt-sequence, chroma-hd-image-to-image-gif |
flux2-dev | FLUX.2 dev 32B FP8, local Mistral FP8 encoder, FLUX.2 VAE | flux2-dev-text-to-image, flux2-dev-single-reference, flux2-dev-single-reference-prompt-sequence, flux2-dev-multi-reference, flux2-dev-multi-reference-prompt-sequence |
flux | FLUX.2 klein Base 9B FP8, Qwen3 8B mixed FP8 encoder, Flux small-decoder VAE | flux-single-reference, flux-character-style, flux-prompt-sequence |
qwen | Qwen-Image-Edit-2511 mixed FP8, Qwen 2.5 VL 7B FP8 encoder, Qwen VAE | qwen-single-reference, qwen-character-style, qwen-prompt-sequence |
uso | FLUX.1 dev FP8 all-in-one checkpoint, USO LoRA/projector and SigLIP vision encoder | Subject reference, style reference and combined subject/two-style references, each with a sequence; prefixed uso- |
umo-uno | Same FLUX.1 dev FP8 checkpoint and UMO-UNO LoRA | Single and three-identity references, each with a sequence; prefixed umo-uno- |
All files are fixed to publisher revisions in the model catalog.
The full Chroma bundle totals about 28 GB. The optional 32B and HiDream
bundles each total about 55 GB of model files. Model and hardware selections
are independent: choose sufficient disk/VRAM for the bundle; 48gb provides
100 GB disk and 96gb provides 150 GB. No new model is deployed by these additions.
The shared Ansible role downloads them inside the rental using built-in modules.
The image profiles install the first-party Prompt Sequence from its packaged source. Full Chroma and HiDream additionally stage
the first-party chained img2img GIF node, using only ComfyUI’s existing Torch,
NumPy and Pillow packages. Both first-party nodes are whitelisted for those profiles.
Chroma1-HD, HiDream and all three SDXL profiles restore
RES4LYF
at the previously approved revision and the unchanged
hash-locked requirements. Ansible installs them
at those pins using the image’s existing Python environment. The SDXL profiles additionally stage the explicitly approved
ComfyUI_IPAdapter_plus pack at revision a0f451a5113cf9becb0847b92884cb10cbdec0ef;
only those two packs and Prompt Sequence are whitelisted for those profiles.
The general SDXL Plus path uses the existing image environment and requires no
FaceID/InsightFace installation. Flux, FLUX.2 dev and Qwen retain only Prompt Sequence.
The workflow definitions
are compiled from Libsonnet during the Bazel build; the rental receives native
JSON and does not require Jsonnet. The archived Chroma Flash examples remain
available separately and are not staged by the full Chroma profile.
Chroma1-HD stages the already approved RES4LYF pack and its unchanged locked
requirements alongside Prompt Sequence. Native graphs start at 40 Euler/beta
steps and CFG 3; style graphs use 40 RES 2M/beta57 steps and CFG 3 with the
Chroma model patcher. Img2img preserves some reference composition, while the
style path starts from fresh noise and guides style. Neither path guarantees
character identity. Both sequence graphs share their negative prompt across
all nonempty panel lines. This full checkpoint is distinct from the archived
Flash model; additional VRAM alone does not establish better image quality.
Flux uses a publisher-hosted model. Its checkpoint requires the user’s
Hugging Face account access and a read-only model token. The operator or
external IaC supplies the
Vault token entry. The authenticated Ansible entry point injects
it through AL for a profile marked hugging_face_auth, then supplies it to the
Hugging Face request with task output hidden and redirect forwarding disabled.
Missing access must be resolved before creating paid capacity; Juggernaut and Qwen’s public
bundles need no token. All profiles retain at least 32 GiB VRAM and Secure Cloud.
Juggernaut’s all-in-one checkpoint goes in models/checkpoints and supplies
its own CLIP encoders and VAE. Its text-to-image and prompt-sequence graphs
start with a fresh 1024-square latent. The img2img graph resizes and center-crops
the reference to 1024 square, then samples at denoise 0.65. Raise denoise for
larger changes, or lower it to retain more reference structure. All three use
30 DPM++ 2M SDE/Karras steps and CFG 6.5 as starting settings. Describe the
wanted style in the positive prompt. Img2img also carries over composition;
these native graphs do not isolate only a reference’s style or character.
For a reference image’s style with a new scene, use
juggernaut-style-reference. It routes the VAE-encoded reference through
RES4LYF’s style guide and the SDXL model patcher, starting generation from
fresh noise. Describe the scene and broad medium in the positive prompt.
The guide’s weight controls influence; zero disables it. Start at 1 and
compare at the same seed. juggernaut-style-prompt-sequence reuses that guide
for every nonempty prompt line. These are style-guided workflows,
not guarantees of style isolation or character preservation. Their sampler
starts at 30 RES 2M/beta57 steps, CFG 6.5 and full denoise; its controls differ
from the native KSampler graphs. All seven Juggernaut workflows completed with
neutral fixtures on the selected runtime; see the
GPU acceptance record.
Execution does not guarantee reference fidelity or scene adherence. The adapter
workflows give more direct character/style conditioning; lower adapter weight
when references overpower the requested scene.
For FLUX.2 dev, use three Load Image nodes as combined character/style
references. Its native sequence uses the same three reference latents for
every prompt. Start at 1024 square, batch one, 28 Euler steps and FluxGuidance 4.
It uses BasicGuider with distilled positive guidance, so a negative prompt has
no sampling effect in this family. The matching Mistral encoder runs inside the
rental; no remote text-encoding API is configured. The official ComfyUI FP8
bundle is public and does not receive the gated Klein profile’s Vault HF token.
For Flux Base and Qwen, select images in Load Image: image 1 supplies character and output aspect;
image 2, when present, supplies style. Describe the new action/scene and the
reference roles in the positive prompt. Flux uses native reference latents on
both conditioning branches, an encoded empty negative prompt, fresh Flux2 noise, 50 Euler steps and CFG 4.
Qwen retains native vision-language and reference-latent conditioning,
index_timestep_zero, shift 3.1, CFG normalization, 40 Euler/simple steps,
CFG 4 and denoise 1. These are reference-guided generation workflows; they do
not guarantee exact style isolation or character continuity.
Additional model options
MiniMax H3 Video
Select minimax-h3-video with the
application playbook’s model override.
The 48gb hardware profile supplies the RTX PRO 5000 Blackwell and a 100 GB disk.
The H3 bundle uses about 42.5 GB of disk for the pruned INT8 FL2VA denoiser,
NVFP4 text encoder, and standard video and audio VAEs. Check free disk and
system RAM for offloading when installing alongside existing models.
Open either saved workflow from the ComfyUI workflow library. Both come with
the installed weights selected and generate MP4s with stereo audio.
The workflow guide
lists the files and keyframe inputs. MiniMax’s official 2K regeneration stage
is available through its hosted API.
MOSS-Image examples
The selected moss-image profile downloads about 21.4 GB from
Comfy-Org/MOSS-Image:
SFT and Base INT8 denoisers, Qwen3.5 9B INT8, the small FLUX.2 VAE, and the
edit and color/depth LoRAs. Files use immutable publisher URLs in the model catalog. All downloads are
public; no model token, extra node pack or Python requirement is configured.
The six single-image examples cover SFT/Base text-to-image, SFT/Base layout guidance,
image editing and prepared color/depth maps. The Base model is selected only by
the moss-image-base-* examples; the other examples use SFT. The six original
examples have prompt-sequence counterparts with shared negative text, progress
and grouped ordered filenames. Ansible installs those workflows and the
50-step Euler Base and two-reference image-edit variants. See
workflow instructions
for inputs and sampling defaults. The existing ComfyUI v0.44.0 runtime provides
their native nodes. The examples omit optional prompt enhancement and automatic
MoGe depth estimation. GPU acceptance is recorded separately in the
MOSS deployment record.
Other profiles
USO and
UMO-UNO are optional
native ComfyUI profiles. USO downloads about 18.6 GB, including its FLUX.1 dev
FP8 checkpoint with local text encoders and VAE, a LoRA, a style projector and
SigLIP vision weights. UMO-UNO downloads about 19.2 GB, sharing that checkpoint
and adding its own LoRA. All five registry files are fixed to publisher
revisions. Both use the existing runtime image and Prompt Sequence node;
neither installs another custom-node pack or Python requirement. These model
options have only offline packaging/graph validation, without GPU or
reference-quality acceptance.
For USO, uso-single-reference uses one subject; uso-style-reference uses
one style image; uso-character-style uses one subject and two style images.
Use the same image in both style inputs when only one style reference is
needed. Each has a sequence counterpart. Subject references are resized with
aspect preserved, starting at a 1024-pixel longest side. Style images use the
native SigLIP crop control. UMO-UNO offers a single-reference or ordered
three-reference path; its publisher’s starting reference size is 512 pixels
on the longest side. Repeating one subject in multiple inputs is not a
substitute for separate identities. It has no USO style-projector branch.
Describe reference roles and the wanted scene in natural language.
Both families start from fresh noise, with editable 1024-square output size,
Euler/simple sampling and CFG 1. USO starts at 20 steps and FluxGuidance 3.5;
UMO starts at 25 steps and FluxGuidance 4. The zeroed negative branch has no
effect at CFG 1, including the sequence node’s negative output. Sequences reuse
the same original reference inputs per panel, showing progress and unique
grouped filenames. These are independent reference-conditioned panels, not
joint attention across the sequence. No reference workflow guarantees exact
style isolation or identity continuity.
The profiles below remain selectable; later rental and acceptance observations
belong to the linked deployment record. Model size alone does not predict
comic quality or reference adherence.
- NoobAI XL 1.1 is an SDXL
illustration fine-tune. Its publisher recommends Euler ancestral, 25–30
steps and CFG 5–6. The starting preset uses 30 steps and CFG 5.5.
- Illustrious XL v2.0-STABLE
is another SDXL illustration model. Its matching starting preset is
provisional, not a measured quality recommendation.
- HiDream-I1 Full is a 17B
alternative. The denoiser is FP16; its published Llama 3.1 8B encoder is FP8.
The bundle also reuses the existing FP16 T5 and FLUX VAE, plus model-specific
CLIP-L/G. Native sampling follows the
official workflow:
50 UniPC/simple steps, CFG 5, shift 3.
The 48 GB option can rely on ComfyUI’s model offloading for the larger bundle;
peak VRAM, speed and style-patcher compatibility remain unmeasured. Several
models can be stored on disk and loaded as needed. Two 9B FP16 denoisers alone
need about 36 GB before encoders, activations and runtime overhead; three need
about 54 GB and cannot all remain resident on 48 GB. Quantization changes that
calculation, and ComfyUI may unload models between jobs.
The downloads registry owns each immutable publisher URL and destination kind;
the custom_nodes registry owns approved pack revisions. Each model profile’s
downloads array lists registry filenames, and custom_nodes lists pack names.
HiDream’s components map assigns its four text-encoder roles explicitly.
Add or select registry entries to change a profile’s files. An
empty array disables configured downloads; workflows still require matching
files. URLs must contain no credentials. Source and acceptance assets remain
neutral; private prompts, uploads and generated images do not belong in Git.
Changing model/profile assets is an Ansible update and does not replace the rental.
Image, workspace and access bootstrap changes remain Terraform provisioning changes.
The retired personal rental was destroyed. The new component credentials and
Qwen rental were subsequently deployed under separate user authorizations.
The Base replacement was created and then destroyed at the operator’s request, retaining component credentials. Base GPU workflow acceptance was superseded by that release. Connection coordinates
come from the owning Terraform outputs. Implementation,
teardown and acceptance evidence is recorded in the
owning change.
7.2 - Image-generation application installation
The playbook loads the profile registry and runtime declaration, translates them
into ordinary role variables, then calls the shared
comfyui_tools role.
It installs every selected workflow/App, model file (including LoRAs and
ControlNet), approved Git node pack, first-party node, hash-locked Python
requirement and optional pinned Video2X/RIFE engine. The existing image supplies
ComfyUI and its Python environment. Both fresh installation and updates use
this same role; Terraform only provisions the rental and secured access.
The model catalog defines the profiles.
Deployment settings select the default profile and workspace_directory.
The playbook combines that directory with the application name from the
shared runtime declaration. The same workspace setting is passed to Terraform’s
native bootstrap. Changing it is not an in-place migration of existing data.
The role preserves inputs, outputs and unselected files. It waits for aggregate
idle counts before installation, loaded-code changes and restart; it never
reads job prompts, history or queue entries. Changed application inputs notify
one restart. Coordinate an idle maintenance window because another client can
still submit work during installation. Workflows can be copied without restart.
After separately authorized account SSH registration and rental creation, use
the observed Terraform SSH host/port outputs and the corresponding local host
identity. The account registration reads its public key from Vault metadata;
it neither transfers nor creates a private key. Pin the server host key in
operator-owned storage before strict SSH checking.
export IMAGEGEN_SSH_HOST=PROVIDER_REPORTED_HOST
export IMAGEGEN_SSH_PORT=PROVIDER_REPORTED_PORT
export IMAGEGEN_KNOWN_HOSTS="$PWD/out/TASK/known_hosts"
bazel test //infra/image_gen/ansible:ansible.syntax
bazel run //infra/image_gen/ansible:ansible
Pass -- --extra-vars imagegen_model_profile=moss-image-heal to select a
registered model for one installation. Without this argument the playbook uses
the model selection in deployment.json.
Pass -- --skip-tags workflows to preserve later App/workflow edits. The syntax
entry point does not authenticate or connect to hosts. Public profiles need no Vault model-token entry. For a gated profile, use
bazel run //infra/image_gen/ansible:ansible.huggingface: the existing AL injector
reads the optional model token through the component identity and exports only
COMFYUI_HUGGING_FACE_TOKEN to Ansible. The role requires it when the selected
profile declares hugging_face_auth and has model downloads. Workflow-only runs
need no token. No Vault or Vast API credential is exported to Ansible or installed
on the rental.
The local role acceptance fixture verifies installation and update safety
without a rental. No deployment is implied by source validation. Changing a
retained instance’s Terraform startup can replace it; use this Ansible target
for application updates instead.
7.3 - Image-generation evaluations
Bounded parallel ComfyUI evaluation configuration and cleanup

Default cleanup is shown; --cleanup=false retains rentals and skips the final sweep.
This subproject instantiates the reusable evaluator in projects/comfyui_tools.
It owns the run matrix, credential references and deployment targets. All
executable code, cases and references stay with that project. Personal rental
resources and Terraform state remain independent.
The matrix in config.json compares Juggernaut, NoobAI, Illustrious, Chroma and
HiDream on the approved thorn-landscape case, with text-only and reference-guided
workflows. Chroma, HiDream and Qwen also run the plush-petting GIF case. Two fixed seeds
are configured for still images. Hardware and publisher pins come from the parent
config.json. Configuration is not evidence of GPU quality.
Compatible matrix groups cross hardware_profiles, model_profiles, workflow
purposes and case_ids, then apply shared seeds and optional sampling controls.
A purpose such as text-to-image resolves to -text-to-image.json.
Separate groups express compatibility without a second workflow catalog. Unknown
files, unsupported bindings, duplicate axis choices/seeds and expansions above
128 workloads fail locally before allocation. The current matrix expands to
eighteen workflow/case/settings combinations and twenty-eight seeded queue entries, pooled
onto six hardware/model rentals. Add another hardware profile to a group to
compare that rental configuration too.
All workflows, cases, settings and seeds sharing a hardware/model pair reuse one
rental, including across matrix groups. Each worker allocates only when a rental
concurrency slot is available, waits for its own ComfyUI endpoint and immediately
starts submitting native queue entries. A bounded lookahead overlaps submission
with completion waits and downloads, so later jobs can render while earlier
outputs are retrieved. After all its assigned outputs are downloaded, the worker
destroys that rental before local media inspection. If another eval worker
holds the available capacity, an unallocated worker waits and can reuse that
offer after confirmed release. Failed or uncertain reservations stay excluded. A failed workload cancels
further submissions and releases the rental. Confirmed provider exit, removal or
ownership change also cancels active work promptly; transient control-plane
observation errors retain the existing workload deadline. In failure cases, already downloaded artifacts remain.
Maximum parallelism is three rentals. Each has a 45-minute lifetime for its
entire assigned workload, a five-minute readiness deadline and a separate cleanup deadline. The standard hardware profile selects any GPU with at least 32 GiB VRAM,
100 GB disk and a $1/hour reported offer-price ceiling. Offers are ordered by
lowest reported hourly price among offers satisfying both transfer-rate caps;
no GPU model is pinned. The canonical shared offer declaration caps incoming
and outgoing bandwidth at USD 0.04/GB each. This rejects the expensive-transfer
hosts used in the first experiment without disabling any host requirements. Datacenter and verification are
mandatory in both the query declaration and returned tier metadata. The explicit
minimum_reliability value of zero removes only the inherited 99-percent floor;
architecture, CUDA and port requirements remain. The hardware profile caps the
reported hourly offer price. Network fees and delayed
provider operations mean this is not a guaranteed account spend cap. No timer or
persistent service is deployed.
With automatic cleanup enabled (the default), the final step and standalone cleanup use the same rule: destroy every instance
whose label starts with imagegen-eval:image_gen:, regardless of run or age.
They preserve normal rental labels and verify that no matching instances remain
by enumerating all pages of the current Vast v1 instances API.
Run one controller per namespace. A shared per-OS-user cache lock excludes local
controllers with the same namespace even when their output directories differ;
coordinate this operationally across machines or OS accounts. Manual cleanup deliberately terminates matching test rentals too; stop an active
controller before manual cleanup so it cannot allocate more queued jobs. Forced termination or host failure can skip the final
step; invoke the standalone cleanup target to recover.
The existing Vault-owned team key and web login are injected through the parent
component. Only the web login reaches ComfyUI access. The runner never writes
Vault or reads the personal Terraform backend. Startup uses the existing
hardening template, compiled by the pinned Terraform expression evaluator in an
empty directory. Terraform manages no evaluation resources or state.
Results, journals, effective inputs and credential-masked CLI failure diagnostics
are written under ignored
out/imagegen/evaluations/results. Automatic checks cover lifecycle, decodable
media, frame count, timing, looping metadata, distinct frame colors and boundary
pixel difference. Pixel change does not establish a correct petting gesture. Subject adherence, style, reference
following, natural motion and artistic quality have explicit review criteria
and remain unscored until reviewed. Live runs require an explicit operator
invocation; offline checks never rent capacity.
Commands
bazel run //infra/image_gen/evals:check
bazel run //infra/image_gen/evals:run
bazel run //infra/image_gen/evals:gif
bazel run //infra/image_gen/evals:cleanup
For a diagnosed capacity failure, run -- --group GROUP --exclude-offer ID
selects only the requested group and skips that offer for this invocation.
For example, append those arguments to bazel run //infra/image_gen/evals:run.
The IDs must be unique and positive; mandatory host filters remain enforced.
The final report records exclusions. Cleanup still destroys the full namespace.
Only check is offline. Run rents the configured matrix; gif selects only the
three plush groups (Chroma, HiDream and Qwen), producing eight experimental
clips on three reused rentals. Cleanup destroys all
matching evaluation instances. Both live targets require an explicit operator
invocation. Run supplies its final cleanup automatically, including failures
and ordinary interruption. Append -- --cleanup=false to the run target to
retain all allocated rentals after success or failure instead. Both per-rental
destruction and the final sweep are skipped, and run.json records
cleanup_skipped=true and cleanup_confirmed=false. The journal identifies each
retained rental; invoke the standalone cleanup target when debugging is finished. Source validation builds the live targets without
executing them.
To iterate on those retained installations, pass their completed run directory:
bazel run //infra/image_gen/evals:run -- --cleanup=false \
--reuse-run /absolute/path/to/results/RUN_ID
Select the desired groups or supply revised case/workflow paths as usual. Every
selected hardware/model pair must match exactly one retained installation,
including its declared image, asset/extension pins and hardware configuration.
The journal’s installation fingerprint must also match installed first-party
source, selected requirements contents, runtime settings and startup template.
The source report must belong to the same namespace and provider endpoint.
Live instance labels and running state are checked before work; missing,
released, foreign or incompatible installations fail without new allocations.
Reuse never reinstalls models or restarts services. New iterations get separate
reports and media, preserving prior outputs and original rental identities.
The first run must record provider_endpoint and installation fingerprints;
older retained runs are rejected rather than assumed compatible.
Per-run deadlines bound active work, not continued billing of retained rentals.
Explicit cleanup still destroys the whole eval namespace.
Edit config.json to select matrix groups, profiles, cases, workflow purposes,
seeds and limits. Optional per-group sampling controls include steps, cfg, denoise,
adapter_weight, adapter_end and style_weight. Omitted controls retain the
selected workflow defaults; overrides must apply to every workflow in their
group. Effective workflows and expanded rental/workload identities are saved
with the results. queue_and_generation_seconds includes time spent in the
native queue and CLI polling overhead; retrieval_seconds measures downloads.
completion_observed_at is captured by an independent bounded CLI observer for each
submitted trial, so preceding downloads do not inflate later completion observations.
It is not an authoritative GPU execution timestamp.
Each trial has a forty-minute absolute budget, bounded by the rental’s 45-minute lifetime. The trial retains that deadline across upload, submission, native queue
residence, generation and download. Frame lists use the node’s JSON mode so
multiline entries remain one frame; empty entries fail before uploading.
GIF controls frame_source and frame_seed_mode select original-reference
sampling or feedback and fixed noise or incrementing seeds. The selected
comparisons use fixed noise with feedback at denoise 0.45, original-reference
sampling at denoise 0.65, and a masked version of that original-reference path.
Qwen compares full-image and masked edits at its native denoise 1. The case uses
static hand-pose instructions with identical first/last prompts. Its edit_region
owns the hand rectangle and soft boundary. These are experiments, not a motion
quality guarantee; the previous two-clip baseline is recorded below.
The masked and Qwen GIF graphs are generated repository assets submitted by the
evaluator. They are not added to the personal rental’s startup workflow bundle,
which must stay inside Vast’s compressed startup-size limit. Load the generated
JSON manually when using these experimental graphs outside the evaluator.
The first matrix compares model/workflow combinations with their model-specific
starting settings, not isolated model architectures under an identical sampler.
bazel test //infra/image_gen/evals:configuration_test \
//infra/image_gen/evals:workload_e2e_test \
//projects/comfyui_tools/test/evaluation:evaluation_test
The first check validates the actual packaged matrix and canonical startup
template using public dummy login values and no API client. The lifecycle
fixture uses a loopback Vast server and verifies matrix pooling, offer reuse,
namespace locking, early rejection and cleanup; the workload fixture uses the real pinned
CLI through an isolated HTTPS ComfyUI API, including queued image/GIF retrieval
and cancellation of a stalled CLI descendant. These checks cannot evaluate image
quality or establish new GPU/model compatibility.
GIF acceptance
The authorized 2026-11-11 run completed both configured GIF workloads on verified
datacenter CMP 170HX 40 GiB rentals. Both outputs decode as eight 1024-by-960
frames with 170 ms delays and infinite looping. Chroma’s native queue and
generation took 278 seconds; HiDream’s took 410 seconds. These timings include
model loading after submission. Each rental was destroyed after its own
download, and the final paginated sweep confirmed the eval namespace empty.
Media validity passed; convincing petting motion did not. Chroma preserves the
scene with little readable hand motion. HiDream changes more but drifts in
the plush’s appearance and the background. Results remain in ignored local
output, with the detailed evidence in the owning OpenSpec change. The evaluator
recorded successful execution and cleanup; the wrapping Vault plugin separately
reported a token-revocation error during shutdown, so the overall command exited
nonzero. No successful whole-matrix or still-image quality claim follows.
GIF experiment outcome
The subsequent eight-variant comparison retrieved six Chroma/HiDream clips.
Fixed-noise feedback still accumulates severe noise or appearance drift.
Original-reference sampling prevents that accumulation and repeats the initial
frame at the loop boundary, but Chroma barely moves the hand. The masked HiDream
variant produces more localized movement while retaining malformed fingers.
None passes the case’s natural-petting criterion.
Qwen produced no clip: its first rental missed readiness, and a different
verified datacenter offer reached readiness but returned a generation execution
error. The retained CLI summary does not identify the model exception; no cause
is asserted. These Qwen graphs remain experimental, without live GPU acceptance.
All four rentals across the initial comparison and isolated retry were destroyed;
final account enumeration found no instances. Billing and downloaded outputs
remain local, with failed attempts included in the operator’s cost report.
Qwen’s generated GIF workflows now encode each previous decoded image through
the native image-edit encoder for both conditioning branches, and encode those
same pixels for sampling. Their new node must be loaded before these graphs
are used. On the retained rental, an explicitly authorized ComfyUI restart
loads the updated first-party source; saving workflow JSON alone does not.
For an explicitly authorized retained-rental update, the packaged SSH client is
bazel run //infra/image_gen/evals:ssh -- -p PORT root@HOST COMMAND. Supply the
current instance’s provider-reported endpoint and existing account SSH identity.
The target keeps batch authentication and strict host-key checking enabled;
bootstrap a task-owned host-key pin before first use. It never selects or
discovers user jobs.
The later native-decoder retry retrieved both Qwen clips. After the operator
authorized a service update, both corrected decoded-image feedback variants
also completed, producing eight-frame GIFs. Full-image feedback still drifts
and deforms fingers; the masked variant remains almost static. Neither passes
the petting criterion. The operator subsequently requested destruction, and
account-wide enumeration confirmed zero rentals. The selected NoobAI personal
configuration is source-only and has not been rented.
8 - Printers
Printer DNS and network access in dc1
This project owns printer DNS declarations and network access. The
DNS root publishes the canonical declaration.
The service configuration permits Wi-Fi access to printer1.
The MikroTik accounts root owns its RouterOS
account and Vault credential. Printer firmware and print queues are unmanaged.
The existing printer records and firewall rule have been adopted into this
project’s state. The migration receipt records their
preserved identities and the owning validation commands.
Network
The diagram source describes the checked-in topology.
The printer connects to the router over the wired LAN; its DNS name resolves
directly to the printer. Wi-Fi access uses the printer-only firewall exception.


8.1 - Docs
8.1.1 - Printer1 state migration
Completed on 2026-11-07. The existing DNS records and firewall rule are now
owned by the printers project, with unchanged live identities and matches.
The deployment receipt
records the operations and verification evidence. No printer record or
firewall rule was destroyed or recreated.
Current ownership
//infra/printers/dns owns both printer DNS views through the printers
AppRole’s tf_backend/dns backend.//infra/printers/tf owns the Wi-Fi exception through its tf_backend/tf
backend and dedicated RouterOS credential.//infra/mikrotik/accounts owns the printers account and generated Vault
credential, using the operator-supplied MikroTik administrator secret.//infra/mikrotik/tf retains router, switch and bare-metal DNS records.
It no longer owns printer DNS. The former firewall backend has no bindings.
The MikroTik AppRole no longer has the ingress-secret read policy. The
printers identity cannot read the administrator credential. Do not restore
old deployment jobs or run the former source revision against its old state;
that source would attempt to recreate objects whose bindings have moved.
Verification
With explicit authority for live review, use the normal text plans:
bazel run //infra/printers/dns:tf.plan
bazel run //infra/printers/tf:tf.plan
bazel run //infra/mikrotik/accounts:tf.plan
bazel run //infra/mikrotik/dns:tf.plan
All should report no resource changes. Check the existing firewall rule still
precedes the enabled terminal forward drop. Its place_before attribute is
creation-only and cannot be reconstructed by import; source ignores updates
to that attribute while retaining guarded insertion for newly created rules.
Rollback
A rollback requires separate authority and a reviewed plan. Freeze both
writers, restore declarations in the intended owner, remove only the exact
current bindings, and import the verified existing objects into that owner’s
backend. Never delete live records or the rule merely to move ownership, and
never keep two active state bindings for one object. If an import fails, keep
writers stopped and restore the binding before allowing an apply.
Use an owning state-only wrapper authenticated by the appropriate owner
AppRole; the old firewall backend is still available for controlled recovery.
Do not revive an ingress-credential dependency to access it. Its temporary
migration target and selector were removed after the empty-state check.
Keep credentials in Vault and retain only sanitized summaries of any recovery.
8.2 - Printer DNS
This DNS-only root manages the canonical printer declaration
through the shared DNS module. Printer1 retains printer1.dc1.alwaldend.com,
its private IPv4 address, and both dc1 and global DNS views. Public resolution
does not provide a route to the printer. Records remain unproxied.
The tf=dns wrapper selects src_infra_printers, the shared DNS provider
credentials, and the owner’s tf_backend/dns Vault HTTP backend. It does not
use the printers firewall account. DNS management defaults to enabled to
preserve the existing records adopted through the completed
state transfer. Both views retain their original
provider identities.
Run offline formatting, pinned-provider schema validation and declaration checks:
bazel test //infra/printers/dns:tf_tests.fmt_test \
//infra/printers/dns:tf_tests.validate_test //infra/dns:config_test
Operational targets use //infra/printers/dns:tf.<operation> and require explicit
live authority. Expected reconciliation after adoption is no DNS changes.
8.3 - Printer network access
This root defines the printer1 IPv4 forwarding exception on router1. Clients
in 192.168.2.0/24 arriving on Wi-Fi bridge2 may reach the printer through
wired bridge1. The destination comes from printer1_a in the canonical
declaration. All IPv4 services on that host are included;
other wired destinations do not match. The printer needs stable addressing
and a return gateway through 192.168.1.1.
The rule precedes the enabled forward drop with comment drop forward.
Planning fails unless exactly one such drop matches. The existing rule’s
tf[infra/mikrotik/firewall] comment is retained as its deployed identifier,
avoiding an incidental router update during state adoption. No router export
or unrelated firewall rule is applied. Existing connection tracking handles
replies; manual rule reordering requires another order check.
place_before is creation-only in the pinned provider and is not returned by
RouterOS on import. Its updates are ignored after creation so adopting an
existing rule does not replace it. New rules still use the guarded insertion
point; verify actual ordering after adoption or manual firewall changes.
Credentials and state
The tf=main wrapper uses the src_infra_printers AppRole and its
tf_backend/tf backend. It injects the RouterOS endpoint from shared infra AL
configuration and the dedicated mikrotik_username and mikrotik_password
fields from secrets/alwaldend.com/vault1/approles/src_infra_mikrotik/printers.
The MikroTik accounts root owns account
creation and rotation; the printers AppRole has only read access to that secret.
Its Vault definition also
grants the DNS credentials used independently by the DNS root.
The state transfer is complete; the existing rule
retains its provider identity.
Operational targets are //infra/printers/tf:tf.<operation> and require explicit
live authority.
The shared injection helper supplies MIKROTIK_HOST, MIKROTIK_USER, and
MIKROTIK_PASSWORD directly to the default RouterOS provider. DNS retains
its separate aliased provider inputs.
Verification
bazel test //infra/printers/tf:tf_tests.fmt_test \
//infra/printers/tf:tf_tests.validate_test
These checks validate formatting and provider schema offline, excluding only
the backend. They do not execute the live drop lookup or verify connectivity.
After an authorized migration, expect a no-change plan and verify the existing
rule still precedes the terminal drop. From a real Wi-Fi client, run:
nslookup printer1.dc1.alwaldend.com 192.168.2.1
curl --connect-timeout 5 --max-time 10 --location --output /dev/null \
--write-out '%{http_code}\n' http://printer1.dc1.alwaldend.com/
Confirm the declared address resolves and the printer page opens, then submit
a test job through its supported print protocol. Retain sanitized acceptance
evidence. Routed access does not relay mDNS or AirPrint discovery across subnets.
9 - Vast.ai
Account, team, and rental infrastructure with Vault authentication
This project manages Vast.ai through three independent Terraform roots:
| Root | Credential | Owns | State suffix |
|---|
| Account | Personal account key | Team identities, account settings and SSH keys | tf |
| Alwaldend | Operator-provided alwaldend key | Full-access team keys and team settings | alwaldend |
| Rental test | Generated alwaldend rental key | One test GPU contract | rental_test |
config.json defines environment settings once. The account and
alwaldend roots both read that section because teams do not inherit account
variables. ENABLE_HTTPS, WEB_ENABLE_HTTPS and WEB_ENABLE_AUTH are all true.
The account root currently declares only alwaldend. Two former imported teams
remain tracked pending credential recovery for deletion; the managed test team
and its test objects have been deleted. See the live evidence.
Authentication
Check remaining credit
Image-generation rentals charge the alwaldend team. Read its current prepaid
credit without printing the rest of the account response:
bazel run //infra/vastai/alwaldend -- --raw show user |
python3 -c 'import json, sys; print("USD {:.2f}".format(json.load(sys.stdin)["credit"]))'
The credit field is the remaining prepaid amount in USD; the separate balance
field is not that amount. The command reads live data through the existing Vault
injection and does not rent capacity or change the account. Use the team target
above for these rentals; //infra/vastai selects the personal account instead.
Retained instances continue to consume credit until released.
Credential ownership
The component uses the src_infra_vastai Vault AppRole declared in
Vault Terraform. Secret references use
the secrets mount and its existing component namespace. Credentials are
injected into process environments; they are not command-line arguments or
persistent CLI key files.
Vault path below alwaldend.com/vault1/approles/src_infra_vastai/ | Owner |
|---|
vastai | Operator-provided personal account key |
vastai/alwaldend | Operator-provided root team key |
vastai/alwaldend/rentals | Team root’s generated rental key |
The existing alwaldend root also declares a
dedicated token into the src_infra_image_gen/vastai component namespace.
The existing team Vault writer has an exact-path delivery permission for that
entry. The infrastructure rental reads it with its own AppRole and uses the
generated team key to provision the instance.
Each entry stores field api_key. The team root preserves its own seed key.
New API keys inherit the issuer’s current account. The pinned CLI has no team
selector for create api-key; its team help directs operators to select an
existing team in the console and create its initial key there. Configure each
provider with the appropriate credential rather than switching API-key context.
The following one-time bootstrap command writes only the root team key and
keeps it out of shell history and process arguments:
(
set +x
unset vastai_team_key
IFS= read -r -s -p 'Alwaldend team key: ' vastai_team_key || exit 1
printf '\n'
[ -n "$vastai_team_key" ] || exit 1
printf '%s' "$vastai_team_key" |
bazel run //infra/vastai:vault -- kv put -mount=secrets \
alwaldend.com/vault1/approles/src_infra_vastai/vastai/alwaldend api_key=-
)
The user authorized this operator bootstrap; IaC contains only its reference.
The pinned CLI can verify each context:
bazel run //infra/vastai -- show user
bazel run //infra/vastai/alwaldend -- show user
The HTTP backend stores each root’s lock and state under its configured
tf_backend/STATE_SUFFIX entry. The image-generation token and its component Vault entry are owned by the existing
team backend without reusing the destroyed personal key.
Building or testing these targets does not authenticate or change live infrastructure.
9.1 - Alwaldend team configuration
Full-access team keys and shared team environment settings
This separate Terraform root uses the operator-provided alwaldend team key
from Vault as its default provider credential. It configures the shared
environment_variables map from ../config.json and creates the full-access
keys listed in teams.alwaldend.api_keys. Each generated key is stored at
secrets/alwaldend.com/vault1/approles/src_infra_vastai/vastai/alwaldend/KEY_NAME.
Secret values are sensitive and are not outputs.
The dedicated image-generation key name comes from teams.alwaldend.image_gen_api_key_name.
The existing alwaldend Vast credential generates that key. The existing
src_infra_vastai Vault identity writes its value directly to
alwaldend.com/vault1/approles/src_infra_image_gen/vastai, using the
default Vault provider. Its delivery policy
is limited to this exact entry. The infrastructure rental reads the stored key with
its own AppRole. The writer can delete metadata for this exact entry so its
managed key delivery is removed completely during teardown.
The former personal key and its delivery entry were destroyed on 2026-11-10.
The fresh component key has been created and delivered to its own namespace.
The component receipt
records its reviewed creation without a rental. No state handoff or import is needed. The
change record
retains the previous handoff history and current teardown evidence.
The root seed key at the parent vastai/alwaldend path is operator-owned.
This root neither replaces nor deletes it. The account root owns team creation;
this root owns no teams, rentals or credit transfers. Its Vault-backed backend
is tf_backend/alwaldend, independent of the account and rental states.
bazel run //infra/vastai/alwaldend -- show user
bazel run //infra/vastai/alwaldend:tf.plan
bazel run //infra/vastai/alwaldend:tf.apply
Verify that the seed selects alwaldend and review the interactive apply before
approving it. Do not save plans or use automatic approval. The component AppRole owns team credentials/state and the exact-path token
delivery permission. The owning Vault workflow manages that narrow permission. The
acceptance record
records the legacy grant; the component receipt above records the new deployment.
Rent and release compute through the separate rental test,
which reads the generated rentals key. Running this root does not rent compute.
9.2 - Vast.ai account configuration
Account settings and protected team identities
This root uses the personal account credential to manage account environment
settings and the team names in ../config.json. The configuration currently
retains only alwaldend. Its identity is protected against deletion and its
funded account must not be recreated or replaced.
The account root creates no project API keys or rental contracts. The separate
alwaldend root uses its operator-provided team credential
to manage team keys and settings. Both roots read the same environment_variables
section: ENABLE_HTTPS, WEB_ENABLE_HTTPS and WEB_ENABLE_AUTH are true. Teams do
not inherit the account settings, so the team root applies the same map.
bazel run //infra/vastai/tf:tf.plan
bazel run //infra/vastai/tf:tf.apply
Review the interactive apply plan. Reject changes to alwaldend ownership,
account identity or credit. Never save plans or use automatic approval.
The prior live test root’s three objects, the test_vastai_provider team, its
generated credentials, and its Vault entry were deleted through their original
states. The two imported teams projects_vastai_terraform_prov and
test_vastai_terraform_provider remain tracked pending deletion: the provider
refuses destruction because their management credentials were not recovered.
They are absent from desired configuration; they have not been detached from
state or reported as deleted.
The existing alwaldend identity and three account variable addresses were
reconciled within the same state. Completed migration blocks were removed.
No resource was transferred between states.
//infra/vastai/test/catalog:catalog_test exercises both actual roots with mock
providers, verifies shared settings and full-access key declarations, and rejects
invalid key names. It also verifies public-key metadata rotation and refusal of
missing or invalid SSH metadata. It uses no live credentials or infrastructure.
Host SSH access
The account root manages vastai_ssh_key.host for each ssh_key_entities entry
in the shared configuration. It reads the entity’s sshpubkey from Vault at
identity/entity/name/<entity>. The component AppRole has an exact-path metadata
read for the configured host user; the root contains no public-key literal or
private material. The same Vault identity is injected alongside the account
credential through the existing AL configuration.
This is account-wide registration, explicitly requested by the operator.
Vast owns propagation to instances; verify access before running deployment.
An already registered key must be imported into its matching resource before
apply rather than duplicated. Updating this source does not apply policy,
register a key or modify an existing instance. Review the owning interactive
Vault and account applies separately when deployment is authorized.
9.3 - Vast.ai rental test
Rent the cheapest on-demand GPU in alwaldend and release it
This flat Terraform root owns one test contract, independently of account and
team IaC. The provider reads VAST_API_KEY, injected from the generated team
key at secrets/alwaldend.com/vault1/approles/src_infra_vastai/vastai/alwaldend/rentals.
The alwaldend root owns that key. The backend retains
the existing tf_backend/rental_test path.
bazel run //infra/vastai/rentals_test:tf.plan
bazel run //infra/vastai/rentals_test:tf.rent
bazel run //infra/vastai/rentals_test:tf.release
bazel run //infra/vastai/rentals_test:tf.state -- list
bazel run //infra/vastai/alwaldend -- show instances
Review both interactive applies. Start release immediately after rent returns,
including after a failed creation apply, and approve destruction promptly.
There is no boot wait or workload. Confirm empty Terraform state and absence of
the contract in the CLI inventory. Release destroys the contract and local disk;
stopping a contract alone retains storage charges.
The search takes one rentable, unoccupied on-demand GPU offer ordered by total
hourly price. It includes the 3.5 GB disk allocation used by ubuntu:24.04 and
rejects prices above USD 1 per hour. Network charges are separate. There are no
model or verification filters and no creation retries. An existing contract
retains its original offer; selected_offer describes the current marketplace.
Destroy mode releases the recorded contract without searching for another offer.
Building or testing the package does not rent compute. The offline catalog test
validates this root with the packaged provider. Provider acceptance tests cover
the Terraform rental lifecycle against a local API fixture.
10 - Local inference
Independent GPU provisioning, DNS, and local coding host configuration
This component owns independent GPU provisioning, DNS, and host configuration
for llama.cpp, Codex CLI, and T3 Code. These definitions do not establish
deployed state or service health. Deployment requires separate authorization.
Layout
tf_setup/ owns the GPU VM, encrypted storage, rotating KMS key, network
and Yandex child DNS zone. Its stage-local AL configuration selects only
Yandex credentials and the provisioning state backend. Its
change record
records provisioning source acceptance and allocation outcomes.dns/ owns the public Cloudflare delegation and CNAME with independent
state and DNS-only credentials. Its change record
records verified DNS ownership.ansible/ installs checksum-pinned Codex, llama.cpp, and the approved
CUDA 12.8 runtime; stages a checksum-verified model; and configures
local Codex inference and tools. It also runs T3 Code behind Traefik mTLS.
Bazel owns runtime pins in third_party/; the deployment packages the
verified archives for Ansible. The shared llama role owns inference.BUILD.bazel wires the component’s Vault AppRole and signed Ansible SSH key.openspec/ records the component contract and implementation evidence.
There is no service-side tf/ stage: llama.cpp and Codex configuration lives
in host files managed by Ansible, rather than a separately provisioned API.
Prerequisites for a later deployment
The provisioning stage supplies the VM address.
The host deployment consumes its VM address; it does not create cloud resources
or load Yandex credentials. Ansible requires the VM address, a
controller-side GGUF, and its SHA-256 digest, as described in
host configuration. No model is selected or downloaded
implicitly, and no cloud inference credential is needed. The documented
provisioning uses Fedora, while the current Ansible stage requires Ubuntu
24.04; host configuration needs adaptation before deployment.
Inference and access
Codex connects to the local Responses bridge at 127.0.0.1:8080/v1.
The project-owned bridge
translates function namespaces for llama.cpp on port 8081 and
restores their identities in replies. It performs no inference or tool execution.
Root-owned requirements constrain
its provider and disable OpenAI-hosted search, apps, plugins, image
generation, and remote control. T3’s authenticated loopback MCP is allowed;
unapproved MCP identities remain blocked. Local shell/edit tools remain
enabled. Accounts retain normal networking; Codex’s command permissions
govern their tool use.
T3 Code and direct Codex sessions share an ordinary coding account. T3
initially selects local-coder with Auto approval review through local inference. Full access
remains selectable. Seed settings preserve subsequent UI changes. Traefik
exposes https://t3code.local-inference.alwaldend.com using Vault ACME and
requires a trusted client certificate plus native T3 pairing/session authentication.
T3 and llama.cpp listen only on loopback. The canonical dnsconfig.json is
consumed by Vault’s exact-hostname PKI role and the independent
DNS Terraform root. Provisioning retains only the Yandex
child zone and VM address.
Local means inference runs on the VM. Browser interactions reach that VM, and Yandex
Cloud operates its hardware. Encryption protects persistent storage at rest.
Source validation
Formatting, packaged Ansible syntax, rendered configuration, and
backend-disabled Terraform validation can run without deploying. Never use
the normal Ansible target or a Terraform plan as an offline check.
The maintained change records the actual source-validation evidence and
the GPU, fresh-session tool-call, approval, mTLS, and reboot checks required
after separately authorized deployment.
The checked-in protocol acceptance target is
//projects/llama_responses_bridge/test/protocol:protocol_test. It starts the actual bridge
against a deterministic function-only backend and checks JSON/streaming routing,
replayed calls, and explicit rejection of unsupported tools. See
protocol acceptance for the pinned Codex round trip.
10.1 - Local inference configuration
Local llama.cpp, Codex, and T3 Code behind Traefik mTLS
This stage configures the dedicated Ubuntu 24.04 GPU VM. The image must
already supply a proprietary V100-compatible NVIDIA driver at least 570.26.
The approved CUDA 12.8 runtime is installed from llama.cpp’s checksum-pinned
archive. Bazel owns runtime versions and integrity digests under
third_party/com_github_ggml_org_llama_cpp, com_github_openai_codex, and
com_github_pingdotgg_t3code. The deployment packages all four archives;
Ansible transfers and extracts them without downloading release assets on the VM.
The shared alwaldend.main.llama role owns the account, runtime, model, unit,
restart handler, and readiness. This deployment owns the V100 image checks
and Codex-specific policy and bridge.
Set LOCAL_INFERENCE_HOST from Terraform’s ansible_host output. Supply
LOCAL_INFERENCE_MODEL_SRC as an absolute controller-side GGUF path and
LOCAL_INFERENCE_MODEL_SHA256 as its SHA-256 digest. No model is downloaded
implicitly. The default context is one 32k conversation; reduce
llama_context_size when the model’s memory requirements demand it.
The prepared Vault server PKI role, component AppRole, DNS permissions, and
public delegation must be deployed separately before certificate enrollment.
No production token or certificate is created by source validation.
T3 Code runs as its ordinary unprivileged t3code account on
127.0.0.1:3773. The complete checksum-pinned official standalone bundle
is installed before startup. Traefik exposes
https://t3code.local-inference.alwaldend.com, requires a certificate from
the repository’s client CA, and obtains its server certificate through
Vault ACME. Port 80 serves ACME validation and HTTPS redirection. T3’s native
pairing/session authentication remains enabled. The standalone CLI is
/opt/t3code/releases/standalone/t3; use its full path as the service
account to create pairing grants after deployment. Treat
pairing codes and startup URLs as secrets. This release does not consume the
legacy T3CODE_AUTH_TOKEN variable.
Initial T3 settings select the existing Codex executable, its dedicated
service-account home, the local-coder model, and Auto mode. They seed only
an absent settings file, preserving later UI changes. Auto uses Codex’s
selected local provider for approval review. Full access remains selectable
and removes the command sandbox when chosen. The actual local model must
support tool calls and approval review; fitting in VRAM does not establish
agent reliability.
Root-owned /etc/codex/requirements.toml pins Codex to
the Responses bridge at 127.0.0.1:8080/v1 and disables OpenAI-hosted search, apps, plugins, image
generation, and remote-control capabilities. The MCP allowlist permits only
t3-code at http://127.0.0.1:3773/mcp; its port follows t3code_port.
T3 supplies per-session authentication. A changed URL or another MCP name
remains blocked. Local shell/edit tools, hooks, and subagents remain available.
Accounts retain normal networking, including network access from commands
allowed by Codex. This configuration does not add an outbound
firewall or custom restrictions to T3’s other normal functions.
The packaged first-party bridge runs as llama in responses-bridge.service.
It translates namespaced function schemas, call history, and JSON/SSE replies
for the pinned llama.cpp server on 127.0.0.1:8081. Unsupported tool schemas
fail explicitly instead of disappearing from the model’s tools. The bridge
has a fixed loopback upstream and no authentication state. Readiness checks
reach llama.cpp through the bridge. Archive comparison repairs incomplete
runtime extraction on subsequent Ansible runs.
T3 and direct Codex sessions share the same unprivileged coding account,
home, and workspace. An administrative SSH session can run Codex directly:
sudo -iu t3code codex -C /opt/t3code/work
Build the package without connecting to a host:
bazel build //infra/local_inference/ansible:ansible_bin
The normal //infra/local_inference/ansible target deploys and requires
separate authorization. Future live acceptance must verify GPU model loading,
a fresh Codex response and tool follow-up, local Auto review, Full selection,
T3 MCP discovery, mTLS rejection/acceptance, application authentication, and
reboot persistence.
Keep non-secret verification artifacts under ignored out/ and record
model/runtime revisions with the results.
10.2 - Local inference DNS
Independent Cloudflare DNS root for the local inference service
This Terraform project owns the public delegation and T3 Code CNAME declared
in dnsconfig.json. It uses the pinned Cloudflare provider, the component
AppRole and DNS credentials, and its own Vault HTTP state backend at
alwaldend.com/vault1/approles/src_infra_local_inference/tf_backend/dns.
It has no dependency on GPU provisioning inputs, Yandex login, or VM state.
Use //infra/local_inference/dns:tf.plan to save a private plan, inspect it
with :tf.show, and apply the reviewed file with :tf.apply. Source checks
use :tf_tests.fmt_test and affected Bazel lint/tests. Live operations require
explicit authorization.
10.3 - Local inference provisioning
Encrypted Yandex Cloud Cascade Lake V100 VM
This stage owns the VM, network, security group, encrypted SSD, KMS key,
and the delegated Yandex DNS zone. Providers are pinned
by the repository’s shared Terraform toolchain. The Vault HTTP backend
and Yandex credentials arrive through this stage’s BUILD.bazel.
The component AppRole is owned by infra/vault/tf. Prepare the Yandex folder
and service-account credentials through infra/yandex_cloud/org1/tf after
that identity is available. These are separately authorized prerequisites.
Required inputs are image_id and admin_ipv4_cidrs; folder_id is injected.
The authorized provisioning uses Fedora 43 image fd8iku26nnkveh8s4di1, already
used by infra/download and infra/threexui. No image family is resolved
implicitly. This standard OS image does not establish NVIDIA driver readiness;
GPU driver installation and Fedora host configuration remain host-stage work.
The current host candidate in PR #233 still requires Ubuntu and must be adapted
before it can configure this Fedora VM.
Defaults are ru-central1-a, one preemptible A100 with 80 GB VRAM, 28 vCPUs,
119 GiB RAM, and a 200 GiB network SSD. The disk uses AES-256 KMS encryption
and annual key rotation. Key, disk, and instance have destruction guards;
the instance does not auto-delete the disk. The boot disk explicitly uses legacy
BIOS with PCI topology V1, matching the last applied compatibility trial.
Ingress allows TCP 22 from administrator CIDRs and public TCP 80/443 for
Traefik’s ACME validation, HTTPS redirect, and mTLS application route.
T3 Code and inference listen on loopback. Accounts retain normal outbound
networking, and no service account is attached to the VM. Zone and hostname
inputs come from ../dns/dnsconfig.json; the VM’s dynamic address is maintained
in the delegated Yandex zone.
Offline formatting check:
bazel test //infra/local_inference/tf_setup:tf_tests.fmt_test
After separate authorization, operators can use :tf_setup.plan and
:tf_setup.apply. These commands contact Vault and Yandex Cloud and must
not be used for offline validation. Export the ansible_host output as
LOCAL_INFERENCE_HOST for the Ansible stage.
Public delegation and CNAME ownership are extracted into the independent
infra/local_inference/dns Terraform root and backend. This provisioning root
contains no Cloudflare resources, credentials, or DNS-only command variants.
Its Yandex child zone and VM address still consume the canonical component
DNS document. DNS has independent ownership and state. Host configuration is delivered
separately in PR #233.
The operator explicitly selected public SSH for this deployment using
admin_ipv4_cidrs = ["0.0.0.0/0"]; cloud-init disables password authentication
and root login. Other deployments can supply narrower IPv4 CIDRs.
Creating a VM starts it automatically. This provider does not manage a desired
power state; stopping the VM after provisioning is a separate control-plane
operation. The authorized deployment’s final state must be verified explicitly.
On 2026-11-03, the approved folder/account prerequisite completed with nine
additions. The provisioning apply created the six supporting resources,
including the encrypted disk, but Yandex rejected VM creation because the
memory quota was exceeded in ru-central1-a, with one further unspecified
quota violation. No VM was created or booted.
The operator then requested another availability zone and authorized replacement
of unused component resources. The ru-central1-b attempt replaced the subnet
and deleted the old unused disk, but Yandex rejected the new disk with
ResourceExhausted: Resource allocation is restricted. That left five resources:
the subnet, network, security group, KMS key and child DNS zone. The boot disk
and VM were absent; disk destruction protection was restored.
The indexed incident listing described zone b as unavailable. A later live
zone-status read reports b UP, while the cloud’s b CPU, RAM and SSD allocation
quotas remain zero. The platform support table
does not support either V100 platform in zones d/e.
The operator then selected a return to ru-central1-a with a smaller VM.
gpu-standard-v2 retains one 32 GB V100 and eight vCPUs while reducing host RAM
from 96 GiB to 48 GiB. Provisioning remains subject to cloud quotas and capacity.
The smaller attempt created the disk and replaced the subnet in ru-central1-a,
but VM creation still exceeded the memory quota, with one additional unspecified
quota violation. No VM was created or booted. A subsequent read with the cloud
management identity verified the correct target cloud and showed sufficient
published RAM, CPU, GPU and dynamic-IP headroom for the 48 GiB configuration.
Those later values do not establish the second earlier violation or prove that
a quota increase was necessary. The component identity cannot read cloud-level
quotas; the cloud-management identity can.
After the operator reported increased quota, a fresh 48 GiB retry passed the
initial quota check but failed during allocation with Not enough resources.
Operation fhmvss42r60r4mrqmcp7 completed with error code 8 and no further
details; no VM was created or booted. The operator then authorized restoring
the original 96 GiB Broadwell configuration after increasing RAM quota.
That original-size retry also failed allocation with Not enough resources,
in operation fhmk1pqi4vth1k6f4oj6. Both V100 configurations have therefore
failed their tested regular-capacity requests in zone a. Six supporting
resources remain, including the encrypted disk; no VM exists. Further attempts
need a changed allocation condition or a selected alternative.
A preemptible V100 retains the requested GPU and VM size but may be stopped
by Yandex at any time, with a maximum 24-hour run. The larger Gen2 option in
zone d provides 80 GB VRAM and requires at least 144 GiB host RAM, additional
quota and a compatible UEFI image. Those alternatives require an operator
choice before changing the current regular V100 configuration.
The operator selected the preemptible V100 alternative after both regular
configurations failed allocation. This keeps the original GPU, eight vCPUs,
96 GiB RAM and encrypted disk while setting preemptible = true. Yandex may
stop it at any time and each run lasts at most 24 hours. The initial creation
must still be followed immediately by a verified stop. Preemptible mode does
not establish available capacity or GPU-driver readiness.
The 96 GiB preemptible attempt also failed allocation, in operation
fhmp4c79geskjtismueq. The next retry uses the earlier approved 48 GiB
Cascade Lake shape with the same preemptible policy, GPU capacity and disk.
The 48 GiB preemptible attempt also failed with Not enough resources, in
operation fhmljpjc6622s8uo7jlk. No VM exists. The configuration remains
preemptible Cascade Lake V100 in zone a, ready for a fresh authorized retry
after allocation conditions change. Kazakhstan’s region-specific platform
limits list only the 24 GB T4i GPU, below the requested 32 GB VRAM; no
Kazakhstan VM was attempted.
The subsequent larger-GPU trials tested A100 80 GB in zone a and Gen2 80 GB
in zone d. After the operator increased zone-a CPU quota, A100 requests
reached allocation but failed with Not enough resources in both regular
and preemptible modes, including with legacy PCI topology V1. The Gen2
attempt was rejected by zone-d memory quota plus another unspecified quota;
its published GPU quota was also zero. These errors do not identify which
physical resource was unavailable.
The current candidate retains the last attempted preemptible A100 shape in
zone a. No VM was created or booted. The six supporting resources remain;
all three destruction guards are restored. The
change evidence
records the exact configurations and operation IDs.
11 - Host security maintenance
Repeatable security scans and package updates without automatic reboot


Run and copy label Ansible actions; report data returns to the controller.
The security playbook composes the existing owner inventories, runs the pinned
Lynis audit, updates all installed packages, and enables native automatic
security updates. OSTree hosts stage complete deployments for a later boot.
Immediate and automatic reboots are disabled. The playbook verifies unchanged
boot identities; it does not claim that an audit proves absence of compromise.
The default host pattern excludes the legacy Vault VM group and the XCP-ng/XOA
appliance groups. Access failures are reported and excluded from execution;
failed access is not evidence that a machine is inactive. The inventory mapping
contains source labels only. Correct host membership in the owning inventory.
Owner deployment group variables are intentionally not imported: this workflow
needs only inventory identities and explicit connection overrides.
Create a private controller report directory before running:
umask 077
mkdir -p out/security/reports out/security/tmp
TMPDIR="$PWD/out/security/tmp" bazel run //infra/security/ansible:ansible -- \
--extra-vars "lynis_audit_report_directory=$PWD/out/security/reports"
Use --limit for a subset. The security_audit tag performs the audit only;
update_all_packages updates packages and reconciles automatic updates after
separately reviewed audit evidence. Full execution performs both, sequentially
per host. Audit-only runs may set security_serial=3. An explicit additional
inventory may supply connection overrides, including a local connection for
Host Bot when running on that exact machine. Never apply a fleet-wide local
connection override.
Authentication uses the existing operator AppRole, temporary signed SSH keys,
and the public SSH host CA. It does not inject unrelated deployment secrets.
The SSH target uses the same boundary:
bazel run //infra/security:ssh -- ansible@host1.ingress.alwaldend.com uname -r
Lynis reports and logs are private operational artifacts. Review warnings before
maintenance; the role never applies scanner hardening suggestions. Distribution
updates can restart services despite preserving the host boot. Installed kernel
fixes can remain inactive until a separately authorized reboot.
ClamAV scans
//infra/security/ansible:clamav runs the shared native streaming scan role
against the existing fleet inventories. It is independent of the maintenance
playbook. //infra/security/appliances:clamav uses the appliance authentication
boundary and defaults to XOA only. XCP-ng remains unscanned because the official
native payload requires a newer glibc; its Lynis and update workflows are unchanged.
Both callers import one shared three-play lifecycle: prepare the controller,
scan selected hosts, and clean up before reporting accumulated failures. The
thin callers retain their separate host defaults and connection variables;
packaging retains each inventory and authentication boundary.
The controller uses the pinned official ClamAV engine in a temporary private
directory and a bounded transient systemd user unit. Endpoints stream files to
its private Unix socket through the shared role’s SSH transport; they do not
load the signature database. Scans install no persistent service and perform
no reboot, deletion, or quarantine.
Startup verifies native signature metadata and daily freshness, then uses one
bounded daemon VERSION polling task to require the verified daily version and
a server response shape. The client’s local-version fallback is rejected.
signatures.json owns signature metadata; lifecycle evidence records the
actual server version without duplicating it in a separate engine.json.
Remote scans require reverse Unix-socket forwarding permission for the SSH
account. The workflow preserves server SSH policy and stops before scanning
when forwarding is denied. Review any required exception through the owning
SSH configuration; the scanner does not relax login or forwarding restrictions.
Create private report and temporary directories, and retain one signature cache
across runs. For example:
umask 077
mkdir -p out/security/clamav/reports out/security/clamav/database out/security/clamav/tmp
TMPDIR="$PWD/out/security/clamav/tmp" \
ANSIBLE_LOCAL_TEMP="$PWD/out/security/clamav/tmp" \
bazel run //infra/security/ansible:clamav -- \
--extra-vars "clamav_scan_report_directory=$PWD/out/security/clamav/reports" \
--extra-vars "clamav_database_directory=$PWD/out/security/clamav/database"
Run one controller workflow at a time. Preserve the cache, including cooldown
state; do not create a new cache to retry a download failure. Every --limit
must include localhost, for example --limit 'localhost,host1.ingress.alwaldend.com'
or --limit 'localhost,xoa'. For a local scan of Host Bot, explicitly exclude
the entire task scratch directory through clamav_scan_exclude_paths, including
controller files, signatures, and reports. Only Host Bot should receive a local
connection override.
The controller must have a working systemd user manager, at least 4 GiB available
RAM, and at least 5 GiB free disk. Its unit runs at Nice 19 with idle I/O priority
and a 6 GiB memory ceiling. clamav_controller_timeout_seconds bounds its total
lifetime (default 172800); clamav_scan_timeout_seconds bounds each endpoint
(default 86400). If Ansible is interrupted, the unit can remain until that
maximum runtime; the recorded unique unit can also be stopped explicitly.
Host failures are retained while later selected batches continue. The final play
attempts controller cleanup before reporting accumulated failures; host-failure
reporting still runs if cleanup fails. Inspect native scan logs and each role
receipt: completion, detections, read errors, exclusions, and
size/parser limits are distinct outcomes. Successful execution is not proof of
complete coverage or absence of compromise. The
controller documentation describes signature verification,
engine limits, lifetime, and private evidence.
SSH policy
The shared SSH role
supplies the forwarding default for ansible. Apply SSH configuration through
the owning host deployment with --tags ssh and --limit; this is normal SSH
setup, including certificate handling and the upstream restart handler.
The completed one-time maintenance playbook and helper are retired. Their
historical rollout evidence remains in the change’s validation record; normal
owner deployment does not expose that retired reload-only or rollback workflow.
The scanner does not apply server configuration.
11.1 - Appliance security maintenance
Private XCP-ng and XOA audits with separately selected no-reboot updates
The default target audits the XCP-ng and XOA groups from
//infra/xcp_ng/ansible:inventory. It reuses the owner’s xcpng_host and
xcp_ng_ansible credential selectors. SSH uses the controller’s existing
~/.ssh/known_hosts, requires an ED25519 match, and never adds keys. The
Host Bot configuration owns approved key provisioning and provenance.
XOA’s existing firewall limits new SSH connections, so its transport reuses
one authenticated connection. The controller control socket uses a per-run
mode 0700 /tmp/appliance-ssh.* directory: the workspace’s absolute path
exceeds Linux’s 108-byte Unix-socket limit. The playbook closes the connection
and removes this temporary directory. An unreachable host can prevent Ansible’s
cleanup; ssh-control-directory.txt records the exact controller path for
operator cleanup. Audit evidence remains in the requested workspace directory.
Both appliances use alwaldend.main.lynis_audit with an already installed
Ansible-compatible interpreter. XCP-ng’s host-level interpreter declaration
and earlier manual bootstrap exception belong to the
owner inventory. Ansible reports runtime
failures directly; the audit installs no interpreter or scanner package.
Audit
Create an existing controller-owned mode 0700 report directory. The default
audit uses the pinned Lynis archive:
umask 077
mkdir -p out/security/appliances/tmp
TMPDIR="$PWD/out/security/appliances/tmp" \
ANSIBLE_LOCAL_TEMP="$PWD/out/security/appliances/tmp" \
bazel run //infra/security/appliances:ansible -- \
--extra-vars "appliance_report_directory=$PWD/out/security/appliances"
Use --limit xcpng or --limit xoa for one appliance group. Use separate report
directories to compare runs. Each host gets a unique private Lynis result
directory containing scanner reports and the caller’s boot identities.
Files are mode 0600. Scanner exit codes
0 and 78 mean the scan completed; 78 includes warnings. They are not a
finding that a host is uncompromised.
:ansible.status performs only a boot-ID and uptime
probe with one SSH connection per appliance and retains connection failures.
The shared Lynis role
owns archive extraction, the audit profile, private evidence collection, failure
handling, and remote scratch cleanup for both appliances. Its unique result
directory is directly under appliance_report_directory; there is no second
appliance audit lifecycle. Set lynis_audit_timeout_seconds to change the
shared role’s default bound. The caller records before/after boot identities
and the XOA connection recovery path there after the role returns, including
scanner failures. An interruption can prevent these final observations; it
does not establish an unchanged boot or a completed audit. Raw status and boot
checks remain available without the audit’s Python runtime.
Run the :ansible.syntax, :ansible.status.syntax,
:ansible.update_xcpng.syntax, and :ansible.update_xoa.syntax tests to check
the playbooks locally without authentication or a host connection.
Package updates
Auditing never selects an update playbook. The separate
:ansible.update_xcpng and :ansible.update_xoa targets require
appliance_report_directory and explicit operator authorization for the
selected mutation. Both preserve and compare boot IDs.
The XCP-ng path permits only a single-host XCP-ng 8.3 pool coordinator with
HA off, no active XAPI tasks, no XOSTOR, no attached CD media, and no
unreviewed yum-cron. It records the host’s enabled state, temporarily disables
new VM placement, and runs yum update using only the stable
xcp-ng-base and xcp-ng-updates repositories with signature/TLS verification
intact. After successful package installation it invokes the vendor
xe-toolstack-restart, waits for XAPI readiness, and restores the original
enabled state. Existing guests are not evacuated, stopped, or rebooted.
Restoration is also attempted after failure when XAPI responds; failure to
recover XAPI is reported rather than claiming restoration. Kernel and
hypervisor fixes can remain inactive until a separately authorized host reboot.
This vendor yum workflow remains on raw transport. A newer Ansible interpreter
does not provide the vendor Python’s yum module bindings or replace its
maintenance procedure.
If the selected download mirror fails, set
appliance_xcpng_use_origin_mirror=true to select the vendor’s documented
https://updates.xcp-ng.org origin for this transaction. The override applies
only to the same stable 8.3 repositories and preserves signature and TLS
verification; it does not change installed repository configuration. See the
vendor mirror documentation.
The XCP-ng vendor procedure
documents the disable, yum update, control-plane restart, and enable sequence
without a host reboot. It requires pool coordinator ordering and HA precautions.
Its Rolling Pool
Update procedure reboots hosts and therefore cannot satisfy a no-reboot run.
The CLI reference
directs package maintenance to yum instead of xe update-*. Multi-host and
XOSTOR maintenance require a separately reviewed coordinated workflow.
The XOA path verifies Debian and invokes the shared package-update role using
the existing interpreter and APT bindings. Missing bindings fail rather than
being installed implicitly. The role installs the
authorized standard unattended-upgrades component if needed and configures
native OS automatic updates with immediate and automatic reboots disabled.
The XOA application updater is
separate from Debian OS maintenance. Its installed version and unattended
reboot semantics must be verified before application automation is changed.
This workflow does not claim or enable application automatic updates. Native
unattended XCP-ng updates meeting the pool and no-reboot constraints have not
been established; appliance_automatic_updates=true fails before mutation.
ClamAV scans
The independent :clamav target reuses the appliance inventory and authentication
but defaults to XOA only. XCP-ng remains unscanned because the official native
ClamAV payload requires a newer glibc. This does not change either appliance’s
Lynis or package-update workflow.
Follow the ClamAV invocation instructions, selecting
//infra/security/appliances:clamav and including localhost in any limit, such
as --limit 'localhost,xoa'. The shared native role streams endpoint data to
the private controller; its signature cache and bounded transient unit are
owned by the controller package. :clamav.syntax checks
this playbook locally without authentication or live scanning.
11.2 - ClamAV controller lifecycle
The fleet and XOA callers import one shared Ansible lifecycle playbook, passing
their host patterns and connection variables while retaining separate inventory
and authentication packaging. Native tasks and configuration templates prepare
an unprivileged controller. The official pinned payload is extracted into a
mode 0700 invocation directory; it is not installed as a host package. No custom
controller helper or database parser is used.
The playbooks require clamav_scan_report_directory and
clamav_database_directory as existing operator-owned mode 0700 absolute paths
under ignored task scratch. Paths use ASCII letters, numbers, underscores,
periods, slashes, and hyphens. Preparation requires a working systemd user
manager, native tar/flock/timeout tools, at least 4 GiB available RAM, 5 GiB free
disk on both paths, and writable directories.
One native freshclam invocation preserves the existing database cache and its
cooldown state. An exclusive nonblocking flock prevents overlapping update
commands. Use one controller scan workflow at a time against the cache. The
relocated tools receive LD_LIBRARY_PATH=prefix/usr/local/lib and
CVD_CERTS_DIR=prefix/usr/local/etc/certs; freshclam/clamd configuration and
sigtool’s command also specify the certificate directory. The environment is
needed by freshclam’s database-test subprocess as well. TLS, code-signature
verification, and TestDatabases yes remain enabled.
Native sigtool --info verifies daily/main/bytecode containers. Ansible filters
retain their versions, signature counts, build times, and ages. Daily signatures
may be at most 72 hours old by default (clamav_daily_max_age_seconds=259200).
Main and bytecode ages are recorded without a daily-age limit because their
release cadence differs; future timestamps beyond five minutes are rejected.
A successful freshclam return code alone is not evidence of freshness.
systemd-run --user starts foreground clamd as a uniquely named transient unit
with RuntimeMaxSec (default 172800 seconds), TimeoutStopSec=15,
KillMode=control-group, UMask=0077, and default Nice=19, IOSchedulingClass=idle,
and MemoryMax=6G. clamav_controller_memory_gib selects the integer memory
ceiling in GiB (default 6, range 1–64), mapped to systemd’s MemoryMax.
The shared caller boolean clamav_scan_background defaults to true;
false selects Nice=0 and IOSchedulingClass=best-effort. Supply booleans through
JSON/YAML extra variables, for example
--extra-vars '{"clamav_scan_background": false}'. Controller preparation
supplies the default before the endpoint role is loaded. Select overrides only
after checking controller headroom; the existing RAM/disk minimums remain.
The unit owns the process group, its private working directory, and native log
output. One native clamdscan --version polling task waits for a daemon response
containing the engine version, verified daily version, and database timestamp;
the client’s local-version fallback is rejected. One outer timeout bounds the
whole loop, including a stalled client, with a 15-second forced-stop grace.
The archive pin owns the engine version; the actual server version is retained
in lifecycle evidence. Real clean-file and EICAR validation remain separate
acceptance steps.
The daemon binds a mode 0600 Unix socket inside a mode 0700 native
RuntimeDirectory, under the operator’s XDG_RUNTIME_DIR. Systemd owns its
creation and removal with the transient unit. This gives clients a short
absolute path without process/cwd aliases. Reports, logs, extraction and the
signature cache stay under ignored workspace scratch. The native runtime
root must be operator-owned mode 0700. SSH controls use separate private
runtime subdirectories, retained until authenticated recovery is finished.
clamav_controller_threads selects native MaxThreads (default 2, integer range
1–32); MaxQueue is four times that value (default 8). Thread and memory inputs
accept integers or decimal digit strings; invalid values fail before engine
execution. Lifecycle receipts retain the selected resources and explicit
scheduling settings in their controller object.
The fixed engine policy uses no concurrent reload, a 100 MiB file limit,
matching client/server stream limits of 100 MiB plus one byte,
400 MiB aggregate scan size, 10,000 archive members, recursion
17, and 120,000 ms scan time. Heuristic alerts, encrypted-content alerts, and
limit alerts are enabled; heuristic precedence is disabled. ClamAV 1.5.4 has no
ScanEncrypted option. Encrypted content and limit alerts are limitations or
heuristics, not confirmed malware. Neither deletion nor quarantine is configured.
The extra stream byte makes oversized inputs produce an explicit file-limit
alert instead of accepting a truncated prefix or aborting directory traversal
at the protocol limit.
The first play prepares the controller; the selected-host play invokes the shared
role and retains failures while continuing later serial batches; the final play
attempts controller cleanup before reporting accumulated failures. Host-failure
reporting still runs when cleanup fails. Every --limit must include localhost.
Startup failure stops the named unit before failing the first play. If Ansible
is killed or cleanup is otherwise skipped, RuntimeMaxSec is the
fallback: shutdown is bounded, not immediate on parent-process exit. The private
lifecycle receipt records the exact unit for systemctl --user stop UNIT recovery.
No process-name search or unverified PID signal is used. The unit is transient;
no permanent user service or host configuration is installed.
Mode 0600 configuration, signature, freshclam, clamd, and lifecycle artifacts
remain in the invocation directory. Signature metadata is owned by
signatures.json; lifecycle evidence retains the actual server version without
duplicating signature metadata. The initial receipt is incomplete before engine
execution. Cleanup confirmation is not an endpoint scan verdict.
Native role reports must be checked for detections, read errors, exclusions, and
coverage limits. For a local Host Bot scan, the caller explicitly excludes the
whole task scratch tree, including the database cache and controller extraction.
Build //infra/security/ansible:clamav_bin and
//infra/security/appliances:clamav_bin to check packaging. Their separate
:clamav.syntax tests parse playbooks locally without AL authentication or
engine/host execution. The parent owns real-engine, clean/EICAR, and fleet
validation. The appliance scan defaults to XOA; XCP-ng is unscanned because of
the native payload’s glibc requirement.
12 - Archived infrastructure
Historical architectures without maintained component projects
This project preserves the archived Harvester, Opencode, and Hermes diagrams.
They describe historical source documents, not current inventory or service availability.
Archived diagrams with existing projects remain with those owners:
Proxmox and Harbor.
Archive/Harvester
This archived diagram preserves the historical source topology.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Archive/Opencode
This archived diagram preserves the historical source topology.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Archive/Hermes
This archived diagram preserves the historical source topology.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


13 - Download
Public static files and websites on XCP-ng and Yandex Cloud


One VM per environment runs the shared Traefik service in front of native
Nginx. Clients connect directly on ports 80/443; Nginx listens only on
127.0.0.1:8008. Public DNS selects Yandex and dc1 DNS selects XCP-ng.
These are independent stores with explicit local-to-public content sync;
there is no automatic replication, failover, or backup.
The diagrams describe checked-in configuration and operator procedures;
they do not establish current deployment or service health.
Content and publication
Each VM has a 100 GiB Btrfs content disk mounted at /srv/download:
projects/<project>/releases/<version>/<uploaded files>
third_party/<name>/releases/<version>/<uploaded files>
infra/<component>/<uploaded files>
sites/alwaldend.com/releases/<version>/<extracted website>
sites/alwaldend.com/current -> releases/<version>
staging/
state/
download.alwaldend.com/ returns a JSON index of projects/, third_party/,
and infra/. All three namespaces return JSON listings for directories.
Publish assembled public output to /srv/download/infra/<component>/ using
the publisher account. This directory is a content-disk publication root,
separate from repository source. alwaldend.com serves the selected
extracted website. www.alwaldend.com redirects permanently to the apex,
preserving the path and query. Staging and service state have no public route.
Directory listings never use a release’s index.html as an index page.
fdroid.alwaldend.com follows the download hostname in both DNS views.
Its document root is /srv/download/infra/fdroid/. Each repository has its
own publication directory and a client URL at /<name>/repo/.
The public host redirects ordinary HTTPS requests from git.alwaldend.com
to github.com in Traefik, preserving the path and query string. Requests
with go-get=1 instead reach Nginx and receive static Go discovery metadata
for git.alwaldend.com/alwaldend/src and its descendants, identifying the Git
repository https://github.com/alwaldend/src.git. Unknown discovery paths
return 404. The metadata keeps Go vanity module paths usable through this
public hostname.
Yandex obtains its certificate through the existing Let’s Encrypt resolver.
The redirect is disabled locally, where the Forgejo-owned DNS record continues
to select Forgejo. Its public CNAME also remains owned by infra/forgejo.
The download account owns content and staging; Ansible does not configure
its authorized_keys. Administrators use existing SSH access and sudo to run
publication as this account. The host role installs rsync. Nginx reads content
and cannot write it. The host-configuration playbook never publishes or selects a release.
The release tool and component publishing targets are available in this tree.
Their commands and transfer behavior belong
to the release tool documentation. The
website browser change
also remains separate implementation work.
Deduplication
A daily download-deduplicate.timer runs duperemove over projects/, third_party/,
infra/, and sites/ on each VM. It shares identical extents while retaining independent
files, paths, permissions, and copy-on-write behavior. Repeated website assets
can share storage; separately compressed archives may have fewer identical
extents. Savings are workload-dependent and stay within each environment.
A private hash database under state/deduplication/ makes subsequent runs
incremental. Staging, ACME state, and the database are outside the scan roots.
The job runs with one I/O and one CPU thread, idle I/O priority, a half-core
CPU limit, and a 512 MiB memory limit. Systemd serializes runs; the timer makes
up a missed run after downtime. The service requires the content mount.
The job never deletes or activates releases. Its result is available through
systemctl status download-deduplicate.service and the service journal.
btrfs filesystem du reports shared/exclusive allocation; ordinary file sizes
and download responses remain their logical sizes. The declared filesystem
setup does not force formatting over an existing filesystem.
Operations
The content disk is optional for OS boot (nofail, ten-second device timeout),
while Nginx and deduplication require it. SSH and Traefik remain on the system
disk. Deployment installs the declared TCP 22 management rule before deleting
the inherited SSH/mDNS rules listed in firewall_delete_rules, including
multicast destinations. Other rules remain. Retiring an allow requires an
explicit deletion entry; removing its declaration alone does not revoke it.
Shared role behavior and the isolated security-fix evidence are recorded in
deployment hardening.
The canonical package-update role owns native automatic updates and reboot
detection. Immediate and automatic reboots are disabled by default; set
update_all_packages_reboot_enabled: true only for an explicitly approved
maintenance reboot.
The 2026-10-26 local rollout
records the complete playbook, reboot persistence, serving checks, and an
unchanged firewall/Nginx/Traefik rerun. The
Yandex rollout
records the completed download-only deployment after moving to ru-central1-a,
trusted public HTTPS, and firewall/service persistence across reboot. The
website rollout
records publication and mirroring of version 2026.44.0. Public apex/www routing
is enabled; the DNS owner
records the completed cutover and trusted HTTPS checks.


Use ssh.local or ssh.yandex for operator access through the shared
ssh_binary rule. Each invocation authenticates
with the component AppRole, injects a temporary Vault-signed client key, and
connects as ansible to the selected inventory FQDN. It verifies the host
certificate against the repository-owned SSH server CA, scoped to
*.download.alwaldend.com, with strict checking enabled. Client configuration
and SSH-agent identities are excluded; no persistent SSH configuration or
known-hosts file is changed. AL removes temporary keys and trust files on exit.
For example, inspect the local services without changing the host:
bazel run //infra/download:ssh.local -- \
systemctl is-active nginx traefik download-deduplicate.timer
bazel run //infra/download:ssh.local -- \
findmnt /srv/download
Invocation arguments follow the fixed SSH destination and form the remote
command. Omitting them opens a shell. Select ssh.yandex explicitly for cloud
access. The target supplies authentication, not authority to change a host.
Artifact publication explicitly selects publish.local or publish.yandex.
Website extraction uses website.extract.local or website.extract.yandex;
activation uses website.activate.local or website.activate.yandex. These
wrappers inject the same temporary key, signed certificate and scoped host CA
as the SSH targets. --namespace third_party selects versioned upstream
artifacts; project publication remains the default. Publication only uploads
artifacts. Website extraction creates a retained site, and activation selects it.
Publication stages and verifies every namespace
before promotion. Identical retries succeed; changed bytes require a new version
or explicit deletion of an inactive release. Activation retains earlier extracted
sites for rollback by running the activation command with another retained
release’s bundle. For example, after publishing the selected website archive:
bazel run //infra/download:website.extract.local -- \
--release_dir "$PWD/out/site-release" --site_archive website.tar.gz
bazel run //infra/download:website.activate.local -- \
--release_dir "$PWD/out/site-release"
Use the matching .yandex targets to select the public environment. Each website
target forwards --dry-run for metadata-only preview; it does not inspect remote
readiness or mutate content. The wrapper still starts its configured credential
plugins before invoking AL, so the wrapper itself is not an offline operation.
A dry run rejects --receipt; an actual operation can write its own receipt. The AL owner documents
commands and failure behavior.
Publish and inspect locally, then mirror that published content to Yandex:
bazel run //infra/download:sync.yandex -- --check
bazel run //infra/download:sync.yandex
Local is the source of truth: differing public content is replaced and
public-only files, releases, and site selections are removed. This explicit
infrastructure mirror is separate from immutable AL publication. The target runs
ansible/playbook_sync.yaml with the existing inventory and temporary Vault
SSH credentials. Host trust remains strict and both content mounts are required.
Check mode reports changes and deletions without changing published content.
The playbook captures only projects/ and sites/ on the controller and
validates paths, current links, and site indexes before destination writes.
Credentials stay on the controller. Source and destination publishers must
remain idle throughout capture and selection. Each run needs controller space
for all source content; the private capture is removed afterward.
Native ansible.posix.synchronize stages changed trees privately, checksums
content, normalizes directories to 0755 and files to 0644, and reuses identical
destination files through rsync hardlinks. A transfer failure leaves public
content unchanged. The native mv --exchange --no-copy -T command atomically
replaces each complete project under a synchronization lock. It requires
support from the destination’s GNU coreutils. Projects change independently;
a failure during selection may leave some updated and others unchanged.
Rerunning converges. The always cleanup removes only this run’s capture and
staging; interruption or an unreachable host can prevent cleanup.
Configuration, certificates, private state, and DNS are excluded. Copying the
site does not enable disabled ingress routes. The playbook does not build
releases or run host configuration. It preserves the locally selected website
and all locally retained release archives. This is a mirror, not a backup.
The manual //infra/download/test/sync:sync_test target runs the packaged
playbook and release CLI against isolated directories through real OpenSSH
and rsync. It uses a private user/mount namespace to verify that explicit deletion refuses
mounted release directories without deleting private state. It checks trust
and layout refusals, authoritative replacements and
deletions, failed staging, repeated execution, and retained-site rollback. Its sync-receipt.json contains repeatable hashes, modes, and links.
On the selected host, inspect systemctl status nginx traefik,
systemctl list-timers download-deduplicate.timer, and
journalctl -u download-deduplicate.service. Check the mount with
findmnt /srv/download, free space with btrfs filesystem usage /srv/download,
and sharing with btrfs filesystem du on the published trees. Verify DNS,
certificate trust, website assets, JSON listings, downloads, and www redirects
from each DNS view. Extracted sites and archives remain available until explicit deletion.
Deduplication never deletes releases. Retained disks and earlier releases provide no
backup against disk loss.
Infrastructure ownership
Terraform provisioning, provider assignments, and DNS declarations are merged
through PR #108. Host configuration
connects by unique inventory FQDNs and needs no packaged DNS inputs. The shared
AL configuration selects provisioning or host credentials by stage. DNS
snapshots are regenerated only on manual request.
local, yandex, and dns are separate Terraform roots directly under this
project. Their separate state keys are
alwaldend.com/vault1/approles/src_infra_download/tf_backend/<stage>.
Selecting one root cannot plan deletion of another root’s resources, and no
root reads another root’s complete Terraform state.
local owns the XCP-ng VM and two disks. prevent_destroy blocks
VM replacement because the pinned provider cannot retain and reattach its
data disk separately. Replacement needs a future reviewed storage workflow.yandex owns the cloud VM, network, firewall, reserved public
address, retained content disk, and its Yandex DNS zone and host record.
VM replacement reuses the content disk and reserved address.dns owns only this component’s Cloudflare/RouterOS aliases and
delegation. Each stage has its own Vault HTTP state key.infra/dns retains apex, mail, and www ownership. Its public apex follows
download.alwaldend.com. The public
download.alwaldend.com name follows the component’s Yandex host.
Its local apex A record is the canonical VM address consumed by
Terraform. The unique local host CNAME and download alias follow that local
apex. Endpoint changes therefore have one maintained input per environment.
Ansible connects by inventory FQDN, without parsing DNS source.
Old Pages A/AAAA records are removed through staged owner cutovers;
unrelated mail and staging records remain.ansible mounts storage, configures SSH and service access, labels static
content for SELinux, and deploys the shared Traefik and Nginx roles.
The local address 192.168.10.66 comes from the apex DNS declaration and is
assigned to the managed XCP-ng VM. The cloud image defaults to the immutable Fedora 43 image
already used by infra/threexui; local provisioning uses Fedora 44.
Credentials and bootstrap
The merged infra/vault/approles/src_infra_download root owns the component
identity. Its applied identity and core memberships are documented by the
Vault owner. infra/xcp_ng/tf owns the XO resource-set assignment;
infra/yandex_cloud/org1/tf owns the folder and its standard folder-scoped
admin service account.
AL selects only the chosen stage’s provider credentials and state backend.
AL reads the existing Cloudflare/RouterOS credentials for DNS provisioning,
and the component Yandex account from Vault. Traefik uses
HTTP-01 in both environments: Let’s Encrypt on Yandex, and the existing Vault
ACME service with role-scoped EAB on XCP-ng. The component’s Vault PKI role
permits only the apex, download, and www names. Local clients must trust the
repository CA; neither environment requires a client certificate or login.
Traefik configuration and private ACME state stay on the system disk under
/opt/traefik, independent of the content mount. DNS provider credentials
are not installed on either host.
The shared host role installs the CA needed to reach Vault. Each inventory key
is the unique host FQDN used for connection and SSH host-key checks. The
shared SSH role includes inventory_hostname when signing keys; no host-key
alias or address override is needed.
Deployment sequence


Download the dark WebP. Publisher denotes the
controller-side release or synchronization workflow; administrators use SSH
to run it as the content account. The site path abbreviates the selected
release under sites/alwaldend.com/current. The GitHub edge represents a
browser redirect, not a proxy connection.
The following are operator entry points, not evidence of a deployed service.
Confirm the local address, named XO inventory, template disk/interface
layout, and cloud image before deployment. Each live operation requires its
own approved scope.
Complete the Vault prerequisite and ensure the existing XO OIDC service is
configured through its owner. Obtain explicit
authorization for the first-login bootstrap of src_infra_download:
it creates the external XO identity/groups. Run the existing
bootstrap target and record its result:
XO_BOOTSTRAP_APPROLE=src_infra_download bazel run //infra/xcp_ng/cmd/xo_login:bootstrap
After that login, review/apply the XO resource-set assignment through
infra/xcp_ng/tf to reconcile the identity’s bindings in IaC. Confirm the
AppRole is absent from approles_pending_oidc_login and its resource set
has the intended subject before planning the local VM. Review/apply the
Yandex folder assignment through infra/yandex_cloud/org1/tf as well.
Review and apply //infra/download/local:tf.plan/tf.apply and
//infra/download/yandex:tf.plan/tf.apply independently.
Prepare the dc1 apex A record through infra/dns/tf while preserving
public Pages records, following the local DNS procedure.
Apply //infra/download/dns:tf.plan/tf.apply to establish cloud delegation
and host/service aliases. Verify both inventory FQDNs before Ansible. The
local website is in maintenance until host configuration and publication.
Run //infra/download/ansible:ansible.local or :ansible.yandex. There
is deliberately no unqualified command that configures both environments.
Bootstrap host-key trust through the existing SSH procedure before the
first connection; subsequent host certificates use the component role.
Publish the site content and verify HTTP routing with address overrides.
Follow the two-phase apex cutover
through //infra/dns/dns:tf.plan/tf.apply.
HTTP-01 requires public DNS/port 80 to reach Yandex and Vault’s DNS view/port
80 to reach XCP-ng before either issuer can validate the three names.
Exercise Let’s Encrypt staging with an explicit directory override and
separate ACME storage, then select production; test Vault issuance locally.
This sequence has a certificate-bootstrap interval after DNS cutover.
Verify both trust chains, renewal, www redirects, downloads, and reboot
persistence. Keep the previous deployment available for a reviewed recovery.
Use bazel run <target> for these commands. Provider credentials
and backend state are injected by AL; no host-installed Terraform or Ansible
is required. See the acceptance matrix
for isolated checks and the remaining live acceptance cases.
Provisioning evidence
retains the Terraform validation and review history.
Third-party namespace deployment
//infra/download/ansible:ansible.local and :ansible.yandex accept
-- --tags download_publication for mounted-storage checks, publication roots,
SELinux labels, deduplication units and Nginx. --tags nginx restricts a routing
update to the shared Nginx role. Both paths retain strict host-CA verification
with the component injector. Deployment requires explicit host scope.
13.1 - Download DNS
Cloudflare and RouterOS aliases for static hosting
Owns the component’s dnsconfig.json through the shared DNS module. Public
download requests follow the delegated Yandex host. The local host CNAME
follows the apex owner’s canonical local A record. The apex and www keep
their existing owner; DNS cutover is a separately reviewed live operation.
This root selects only DNS credential injection and its own state backend.
It does not authenticate with either VM provider or require either VM’s state.
Local DNS preparation
Before configuring the local host by its inventory FQDN, prepare and commit a
reviewed intermediate infra/dns/dns/dnsconfig.json revision that installs the
final download_dc1 A record in the dc1 view and removes the old dc1 Pages
A/AAAA members. Keep the old public Pages A/AAAA records and all unrelated
records unchanged; split prior dsp: ["all"] declarations by view as needed.
Plan and apply that exact revision through infra/dns/tf, after separately
authorizing this local DNS change. Review that only the intended dc1 apex
records change and verify the local answer before continuing.
Apply this component’s aliases after that preparation, then confirm
host1.dc1.download.alwaldend.com resolves to the address used by the VM.
Ansible connects using that unique hostname. The local website is in a
maintenance interval until host configuration and content publication finish;
the public website continues using Pages during this local preparation.
The local VM consumes the same apex A value from source. The host CNAME and
local download alias follow it, so renumbering has one maintained address.
The dc1 apex also declares the unusable AAAA address ::ffff, following
RouterOS’s documented override.
An A record alone does not suppress upstream AAAA answers: while public DNS
still points to Pages, IPv6 clients would reach that site instead of the local
VM. This local override keeps clients on the configured IPv4 endpoint without
changing public DNS or relying on a guest’s temporary IPv6 address.
The public apex follows download.alwaldend.com through its configured CNAME,
which follows the component-owned Yandex host. The former GitHub Pages A/AAAA
records were removed during the authorized cutover. Renaming the Yandex host
requires no copied endpoint edit in the apex owner. The staged procedure below
records that cutover sequence.
Staged public apex cutover
The apex belongs to infra/dns/tf, separately from this component DNS root.
Its old GitHub Pages A/AAAA records and the new public CNAME have different
Terraform instance keys. Applying the final declaration directly can race
CNAME creation against address-record deletion. Cloudflare rejects that
coexistence; use two sequential, reviewed IaC revisions and saved plans.
Before either phase, complete the DNS owner’s
adoption procedure, verify both
hosts and content using address overrides, configure certificate issuers, and
authorize the apex cutover explicitly.
Record the prior source revision and recovery plan. Schedule a maintenance
window: the public apex has an intentional address gap between the phases,
and resolver caches can extend that interval.
- Prepare and commit a reviewed intermediate
infra/dns/dns/dnsconfig.json
revision with the old public apex A/AAAA members removed from the global view and
records.download_global absent. Keep local records, www, mail, TXT,
and unrelated records at their prior values. Through
//infra/dns/dns:tf.plan, save and review a plan that deletes only the old
public apex A/AAAA instances and creates no apex CNAME. Apply that exact
saved plan through //infra/dns/dns:tf.apply. Verify completion and the
authoritative Cloudflare inventory shows those A/AAAA records are gone. - Only after phase 1 succeeds, select the reviewed final declaration from
this change, including
records.download_global. Create a fresh saved
plan through the same owner; review the CNAME creation and intended local
apex changes while preserving mail/TXT/www and unrelated records. Apply
that plan, then verify authoritative records and both DNS views, website
responses, and redirects.
Keep all source/input files unchanged between each saved plan and its apply.
If a phase fails, stop and inspect the actual record/state inventory before
planning recovery. Restore the recorded prior declaration only through a
reviewed owning-root plan; remove any conflicting CNAME first if returning
to the old A/AAAA records. Never begin phase 2 based only on a planned deletion.
13.2 - Host configuration
Shared native Traefik and Nginx deployment
Build :ansible_bin to package the playbooks and shared collection. The host play
uses alwaldend.main.download_host
for storage, the publisher account, rsync, service setup, and deduplication.
The role does not configure publisher authorized keys; administrators use their
existing SSH access and run publication through sudo as download. Inventory,
Vault injection, and routing templates belong to this deployment. Both inventories connect
using their unique host FQDNs, with the same names for SSH host-key checks.
Host DNS must resolve before configuration; no IP override or HostKeyAlias
is configured. The wrapper reuses the SSH injector’s temporary known-hosts file with the same
repository server CA and hostname scope as the operator SSH targets. Strict
verification stays enabled; client configuration and SSH-agent identities are
excluded. AL removes the temporary trust file on exit.
Run :ansible.local or :ansible.yandex only with explicit live
authorization. Before configuring the host, Ansible requires the content path
to resolve to a block device. The role creates the filesystem without forcing
an overwrite and mounts it before enabling the services. The shared roles
manage the service units. Traefik keeps its configuration and ACME data on the
system disk at /opt/traefik and has no content-mount dependency. The role creates
publication roots, including third_party/; publishers create individual artifact/site directories and
select releases. It never uploads or selects releases.
nginx_config_template supplies the complete configuration to the reusable
Nginx role. JSON listings allow credential-free cross-origin reads and normal
HEAD/range downloads. Site requests follow the current link. Port 8008 is
loopback-only and uses the Fedora SELinux HTTP port type. Public content has
read-only HTTP labels; the SSH publisher needs readable file modes and must
preserve those labels when activating staged content.
Yandex uses Let’s Encrypt HTTP-01 without EAB; XCP-ng uses the existing Vault
HTTP-01 directory with EAB generated by the shared Traefik role. Local browsers
need the repository CA. Neither host stores a DNS provider credential.
For a newly created Yandex VM, authenticate the initial host public keys using
its serial-port output
through the component’s provider identity. Match the instance ID and public
address to the applied Terraform result and use the SSH HOST KEY KEYS
section, not the authorized client keys. Put the verified keys in a temporary
known-hosts file scoped to the exact inventory FQDN. Pass it to the first
Ansible invocation through --ssh-common-args, retaining StrictHostKeyChecking=yes,
-F /dev/null, IdentityAgent=none, IdentitiesOnly=yes, and
GlobalKnownHostsFile=/dev/null. The SSH role installs signed host certificates;
subsequent runs use the default CA trust. A timeout happens before host-key
verification and is not a reason to disable that verification.
download_site_enabled controls the apex site and www redirect routers in
both Nginx and Traefik. It is enabled in both environments after the authorized
public cutover. For a new deployment, configure Nginx and verify content before
changing DNS, then activate Traefik when public DNS reaches the host. This
avoids premature HTTP-01 requests. The download router obtains its own certificate.
When download_git_redirect_enabled is enabled, the higher-priority
Traefik git_discovery router sends go-get=1 requests to Nginx. Its static
HTML identifies git.alwaldend.com/alwaldend/src as the prefix for the Git
repository https://github.com/alwaldend/src.git, at the repository root and
all slash-delimited descendants. Other discovery prefixes return 404. The
lower-priority git router redirects ordinary requests to GitHub. Both
routers and the metadata virtual host are disabled for the local inventory,
and discovery is independent of download_site_enabled.
For public ACME staging, override both download_acme_directory and
traefik_data_dir (for example a separate acme-staging directory under the
Traefik root). Switching back preserves separate staging/production accounts
and prevents staging certificates from becoming the production selection.
The content filesystem is Btrfs. The native duperemove package and daily
systemd timer share duplicate extents across published files and extracted
sites. Its private hash database lives outside both scan roots. The maintenance
service waits for the mount and has bounded CPU/memory and low I/O priority;
a failed run leaves the release layout and active website selection intact.
The play forces notified handlers after later task failures. Successfully
installed configuration therefore still triggers its pending handlers if a
later task fails. Unreachable hosts can still prevent handler execution.
Nginx configuration validation before installation is unchanged. See Ansible’s handler failure behavior.
The Ansible wrapper reuses the component SSH injector for the private key,
certificate and scoped host CA. It disables agent and user-configuration identity
selection and keeps strict host verification enabled. download_publication
selects only publication directories, labels, maintenance units and Nginx;
nginx selects only routing deployment.
Content synchronization
playbook_sync.yaml mirrors the local store to Yandex using the same inventory
and credential injection. Invoke it through //infra/download:sync.yandex;
append -- --check for a preview. It does not run the host role. The
component runbook owns the transfer, retention, and failure
contract. Tasks under tasks/sync_*.yaml validate roots and captured content,
stage transfers, and select complete project directories.
13.3 - XCP-ng
Protected local static-hosting VM
Provisions one Fedora 44 VM in src_infra_download, using named inventory
from the existing XCP-ng deployment: two CPUs, 2 GiB RAM, a 20 GiB boot disk,
and a 100 GiB content disk. The local address comes from the apex DNS owner, whose local A record is
also the target of the unique host CNAME.
The cloud template must have one boot disk and the expected enX0 interface;
Ansible formats and mounts the second disk at /srv/download without force.
prevent_destroy rejects replacements and destruction because the pinned XO
provider owns disks with the VM. There is no automatic retained-disk replacement
workflow on XCP-ng. Do not remove that guard as a routine upgrade step.
tf.plan and tf.apply are live operations. tf_tests.fmt_test and the
offline entry point with backend-disabled initialization validate source.
13.4 - Yandex Cloud
Static-hosting VM with retained local content storage
Provisions one Fedora VM in ru-central1-a by default, in its component folder:
two CPUs, 2 GiB RAM, a 20 GiB boot disk, and a separate 100 GiB content disk.
The disk and reserved IPv4 address have destruction guards and survive
replacement of the VM.
The instance firewall permits TCP 22/80/443; Nginx has no public listener.
The delegated Yandex DNS zone’s A record follows the reserved address.
Cloudflare delegation and service aliases belong to the sibling DNS root.
AL injects the folder ID and folder-scoped service account; no credentials
or allocated addresses are copied into checked-in variables.
14 - Nexus
Planned native Nexus Repository deployment on XCP-ng
This component currently contains a proposal and its OpenSpec validation
scaffolding. It contains no service implementation and establishes no deployed
state. See the deployment proposal
for the agreed scope and design
for architecture, dependencies, and remaining deployment inputs.
infra/nexus owns the deployment-specific configuration and documentation.
Its planned boundaries are tf_setup for the VM and DNS, ansible for native
service deployment, and tf for Nexus API configuration. Reusable service and
database behavior belongs to projects/ansible_collection; Vault identities
and XO grants remain with infra/vault and infra/xcp_ng. Traefik owns ingress.
The current Bazel targets package documentation and OpenSpec sources only.
Run bazel test //infra/nexus/openspec:validate_test to validate this workspace.
Implementation and live infrastructure operations require later user requests.
15 - GitLab
GitLab groups, memberships, repository imports, and forks
This project owns GitLab groups, memberships, repository imports, and forks
through the Terraform module. Organization membership and
repository definitions come from the shared repository catalog.
15.1 - GitLab Terraform
GitLab groups, memberships, repository imports, and forks
This module manages the GitLab groups, memberships, repository imports, and
forks declared in the shared repository catalog.
Its catalog module supplies names, source URLs,
and repository settings. Provider versions and checksums are recorded in the shared
provider declarations.
Catalog administrators receive the Owner role; catalog users receive the
Developer role. Group defaults permit Maintainers and Owners to push and
merge into default branches, with force pushes and developer initial pushes
disabled. Developers can read repositories, create feature branches, and
open merge requests. Existing higher direct or inherited grants must be
reviewed separately because GitLab retains a user’s highest access level.
GitHub copies use one-time Git imports, preserving their source default
branches. They have no ongoing synchronization. GitLab forks retain their
upstream fork relationship and target upstream when opening merge requests.
The catalog owns destination names and upstream identities.
AL configuration authenticates with the
src_infra_gitlab AppRole,
injects the gitlab_token field as GITLAB_TOKEN, and supplies the existing
Vault HTTP state backend.
The configuration owns the Vault paths and plugin labels.
The provider uses GitLab.com by default. For another instance, set
GITLAB_BASE_URL to its API endpoint with a trailing slash, such as
https://gitlab.example.com/api/v4/; see the
provider configuration.
The BUILD file exposes the standard tf.* commands and
tf_tests.fmt_test; a plan uses live Vault and GitLab access.
Import and apply
The import blocks adopt existing catalog groups, projects, and their direct memberships.
Membership discovery reads the catalog’s existing group IDs independently of
the managed group resource, allowing a newly added member to be created.
GitLab.com top-level groups must exist before Terraform can manage them.
Group, membership, and project resources have prevent_destroy enabled.
For an existing destination project, record its observed numeric ID as
gitlab.id in its catalog file. The project import block adopts that identity,
and a postcondition rejects an unexpected ID. Do not create a replacement for
an existing project or fork. Review the full plan for deletions and replacements
before every apply; either requires explicit authorization for that scope.
Adopt default-branch protections in two phases:
- A new project starts without
gitlab.id. Apply the reviewed full plan for
groups, memberships, and projects. Wait
for each repository import or fork to finish, then verify its default
branch and effective protection against the catalog and group defaults. - Record the observed project ID in the catalog after verifying its protection.
The existing protection declarations select only projects with recorded IDs
and import
<project-id>:<default-branch>. This keeps new project creation
independent of import IDs that are unknown until creation finishes.
Review and apply the full plan that imports or updates those protections.
Existing protections must never enter the provider’s Create operation:
it can unprotect and recreate an existing default-branch rule.
Keep the original protection in place if it cannot be imported or its access
levels need a replacement. The pinned provider supports in-place
allowed_to_push and allowed_to_merge updates on GitLab.com; its scalar
push_access_level and merge_access_level fields can require replacement.
See the provider’s protection behavior.
Confirm that no overlapping project or group rule grants developers access
to a default branch. A restrictive rule does not override a more permissive
matching rule; see GitLab protected branches.
16 - Repositories
Shared organization, repository, and access configuration
This project owns the organization and repository catalog consumed by
GitHub, GitLab, and
Forgejo. Named organization administrators and
developers belong in this catalog. Root configuration owns
the schema version and defaults. Each organization owns
orgs/<organization>/org.json and one
orgs/<organization>/repos/<repository>.json file per repository. Vault
continues to own Forgejo login identities and service-specific access.
First-party means owned by us, regardless of forge. Our repositories retain
their chosen names across GitHub, GitLab, and Forgejo: alwaldend/src stays
alwaldend/src, including when copied or synchronized between those forges.
Forks and mirrors of external repositories must belong to an organization in
the catalog. Their names use the original upstream hostname in reverse order,
followed by its full owner and repository path, in lowercase with punctuation
replaced by underscores. For example, https://gitlab.com/fdroid/fdroiddata
becomes alwaldend/com_gitlab_fdroid_fdroiddata. Copies on another forge keep
that name; they do not add a prefix for our intermediate copy. This naming
rule also applies to external repositories imported once for later syncing.
The Terraform module owns this derivation. A forge key opts a
repository into that consumer. GitLab import_from refers to the corresponding
catalog source; fork_from identifies a GitLab upstream. External origins
belong in the repository’s upstream_url. Forge-specific overrides preserve
settings such as Pages sites and repository descriptions during adoption.
Consumers retain their own providers, state, and Vault authentication. They
adopt existing remote resources by import and preserve managed resource
addresses or declare explicit moves. Named developers can read repositories,
write feature branches, and open pull or merge requests; protected default
branches restrict pushes and merges to administrators and any separately
owned existing service grants. Catalog GitHub repositories permit merge
commits only: the shared defaults disable squash merges and rebase merges, and
a catalog precondition rejects any repository record that enables them. Merging
therefore keeps the reviewed feature commit as a parent of the default-branch
commit instead of replacing it. GitLab and Forgejo merge methods are not owned
here. Dedicated per-project landing repositories are retired: the main site
publishes every project landing at /projects/<name>/, so the catalog carries
no landing repository. The apex site repository keeps the Pages configuration
that serves it.
Catalog targets are repository-internal infrastructure inputs. They are not
production build dependencies or published artifacts.
GitLab receives one-time repository imports and the configured upstream fork.
Each repository’s forgejo.push_mirrors map declares its destinations.
The catalog projects the entries by repository and forge for the
Forgejo mirror Terraform root.
16.1 - OpenSpec
16.1.1 - repository-catalog Specification
Purpose
Define shared organization, repository identity, naming, and named access
configuration for the GitHub, GitLab, and Forgejo infrastructure consumers.
Requirements
Requirement: Authoritative organization and repository inventory
The repository catalog SHALL store shared defaults and schema version at its
root, one configuration file per organization, and one configuration file per
repository beneath its organization. Those records SHALL own the configured
organizations, repositories, named administrators, and named developers.
Each forge consumer SHALL use
that catalog for its selected repositories and named roles, preserving
forge-specific settings without maintaining another copy of the inventory.
Authentication and service-specific grants SHALL remain with their existing
owners.
Scenario: Consume one organization definition
- WHEN an organization assigns named administrators and developers and
selects repositories for multiple forges
- THEN each selected consumer uses the same catalog assignments and
repository identities
- AND forge-specific settings and service identities remain with their
declared owners
Requirement: Stable names follow ownership and original upstream
First-party repository names SHALL remain the same across forges, including
when copied or synchronized. External forks and mirrors SHALL belong to a
catalog organization and use a name derived from the original upstream’s
reversed hostname followed by its full owner and repository path, in
lowercase with punctuation replaced by underscores. Cross-forge copies of
external repositories SHALL retain that name rather than naming the
intermediate copy as their upstream.
Scenario: Copy an organization-owned repository
- WHEN the first-party
alwaldend/src repository is copied from GitHub to
GitLab or Forgejo - THEN its destination remains
alwaldend/src
Scenario: Fork an external repository
- WHEN
https://gitlab.com/fdroid/fdroiddata is forked into alwaldend - THEN its organization-owned name is
alwaldend/com_gitlab_fdroid_fdroiddata - AND subsequent copies on another forge retain that name
Requirement: Named developer access excludes protected default writes
Consumers SHALL grant catalog administrators administrative access and
catalog developers repository reads, feature-branch writes, and pull or
merge request creation. Catalog developers SHALL NOT receive direct push
or merge access to protected default branches through their named roles or
overlapping retained grants. Existing service-specific permissions SHALL be
preserved and distinguished from named developer assignments.
Scenario: Develop on a feature branch
- WHEN a catalog developer accesses a selected repository
- THEN the developer can read its contents, create a feature branch, and
open a pull or merge request
- AND the developer cannot push or merge to its protected default branch
Requirement: Adopt existing resources without recreation
Consumers SHALL adopt existing remote resources through imports and preserve
their remote identities. Existing managed resource addresses SHALL remain
stable or use explicit state-preserving moves. Existing GitHub repository
settings and Pages configuration SHALL remain intact, except for the
catalog-owned GitHub merge-method settings, which the catalog owns and may
change in place on existing repositories. Default branches SHALL remain
unchanged. No deletion or replacement SHALL execute without separate user
approval for its concrete scope.
Scenario: Adopt an existing repository
- WHEN a catalog repository already exists remotely or in Terraform state
- THEN its import or state move preserves the existing remote repository
ID and contents
- AND the reviewed plan does not recreate it to resolve a name collision
Scenario: Encounter a destructive plan
- WHEN any reviewed plan proposes a deletion or replacement
- THEN execution of that operation stops pending the user’s explicit
approval for the identified operation and scope
Scenario: Apply owned merge settings to an existing repository
- WHEN an adopted repository’s merge settings differ from the catalog’s policy
- THEN the reviewed plan updates those settings in place without deleting
or replacing the repository
- AND settings the catalog does not own remain unchanged
Requirement: GitLab copies and fork preserve their source identity
GitLab SHALL receive a one-time Git import of every catalog-selected GitHub
repository and an organization-owned fork of the selected F-Droid metadata
upstream. Imports SHALL preserve the source default branch, and the fork
SHALL retain its upstream fork relationship. This change SHALL configure no
ongoing synchronization.
Scenario: Complete the initial GitLab population
- WHEN the GitHub default-branch migration completes and the initial
GitLab imports and fork finish
- THEN every selected GitHub repository has its intended GitLab copy and
source default branch
- AND the metadata repository retains its F-Droid upstream fork identity
- AND later upstream changes are not promised to synchronize
Requirement: Adopt GitLab default-branch protections without removal
GitLab default-branch access SHALL be established through group defaults
before new repositories are populated. Existing automatically created
protections SHALL be verified and imported before standalone protection
management is applied. Adoption SHALL preserve the existing protections;
provider limitations SHALL be reported rather than bypassed by unprotecting
or recreating them.
Scenario: Adopt an automatically protected default branch
- WHEN an imported GitLab repository has an existing default-branch rule
- THEN Terraform adopts that rule by import before applying permitted
in-place access changes
- AND adoption does not invoke unprotect-and-recreate behavior
Requirement: Catalog GitHub repositories permit merge commits only
The catalog SHALL permit merge commits on its GitHub repositories and SHALL
disable squash merges and rebase merges. The shared defaults SHALL express
this policy, and each GitHub repository record SHALL inherit or restate it
without contradiction. A repository record SHALL NOT enable squash or rebase
merges. This policy SHALL NOT change GitLab or Forgejo merge settings, which
remain outside this catalog’s ownership.
Scenario: Apply the shared merge policy
- WHEN the catalog projects its GitHub repositories for a consumer
- THEN every projected repository permits merge commits
- AND every projected repository disables squash merges and rebase merges
Scenario: Reject a contradicting repository record
- WHEN a GitHub repository record enables squash merges or rebase merges
- THEN catalog validation fails before any consumer plan is produced
- AND the reported error identifies the repository and the disallowed method
Scenario: Preserve the reviewed commit through a merge
- WHEN a reviewed feature branch is accepted into a protected default branch
- THEN the default branch records a merge commit whose parents include the
reviewed feature commit
- AND the reviewed feature commit remains reachable and unmodified
16.2 - Repository catalog module
This provider-free Terraform module reads the catalog files, merges
forge defaults, and projects organization-owned repository names and settings
for each consumer. It creates no resources and uses no credentials.
Fork and mirror names follow the catalog naming contract.
Output keys retain the organization and catalog key, independently of the
derived destination name. The consumers retain their existing state addresses
where resources were already managed.
The catalog test runs without network access or provider initialization:
bazel test //infra/repos/tf:tf_tests.catalog_test
17 - OpenHands
Hosting for Agent Canvas, the OpenHands agent server, and automations
OpenHands deploys as separate components because each owns a distinct
responsibility and trust boundary:
| Component | Responsibility |
|---|
| Agent Canvas | Browser client for conversations, files, settings, backends, automations |
| Agent Server | Runs conversations, agents, tools, and workspace operations |
| Automation Server | Stores schedules and triggers, tracks runs, dispatches conversations |
The agent server runs directly on the host with the service account’s
permissions. Its workspace is a working directory; operating-system account
permissions define its access to the host. Treat the agent server host as
trusted infrastructure.
Layout
tf_setup creates the Agent Canvas, secured agent server, and automation
server VMs in the src_infra_openhands Xen Orchestra resource set.ansible deploys the three VM components. The
host-bot project owns and
deploys its unsecured agent server.dnsconfig.json owns the component hostnames and static addresses.BUILD.bazel authenticates with the src_infra_openhands Vault AppRole, signs
host keys for Ansible, and injects the component secrets.
There is no tf package: these components keep their state in files and
SQLite on their own hosts, so no API-side resources exist to declare.
Canvas serves the packaged browser assets through its
static-server service
on loopback. Configure the browser’s backend with the canvas origin as its
host and the agent server session key as its credential.
Traefik and TLS
Each component host runs Traefik from the shared role with certificates issued
by src_infra_openhands_pki_server. The canvas origin proxies /api/*,
/api/automation, /sockets, and /server_info to the agent server and
automation server, so the browser talks to one origin and issues no
cross-origin request.
The public canvas.openhands.alwaldend.com record is a CNAME to
ingress.alwaldend.com, and infra/ingress forwards it to
dc1.canvas.openhands.alwaldend.com. That ingress keeps its
RequireAndVerifyClientCert client-auth policy, so reaching canvas from
outside still requires a client certificate.
Secrets
agent_server holds session_api_key and secret_key; automation holds
kv_secret. The session API key is shared by the agent server, the automation
server, and the browser because all three authenticate the same
X-Session-API-Key value.
The unsecured host-bot server has a separate secret_key reference owned by
its host’s AL configuration.
Prepare one private JSON input for each path through the
secret-handling workflow.
Set OPENHANDS_AGENT_SERVER_JSON, OPENHANDS_AUTOMATION_JSON, and
OPENHANDS_HOST_BOT_JSON to those input file paths. Each JSON object contains
the fields listed above for its path. Initialize the paths through standard
input; -cas=0 prevents overwriting existing data:
bazel run //infra/openhands:vault.kv_put -- -cas=0 \
alwaldend.com/vault1/approles/src_infra_openhands/agent_server \
- < "$OPENHANDS_AGENT_SERVER_JSON"
bazel run //infra/openhands:vault.kv_put -- -cas=0 \
alwaldend.com/vault1/approles/src_infra_openhands/automation \
- < "$OPENHANDS_AUTOMATION_JSON"
bazel run //users/simeonwarren:vault.kv_put -- -cas=0 \
alwaldend.com/vault1/approles/user_simeonwarren/openhands \
- < "$OPENHANDS_HOST_BOT_JSON"
Deployment
bazel run //infra/openhands/tf_setup:tf_setup.plan
bazel run //infra/openhands/tf_setup:tf_setup.apply
bazel run //infra/openhands/ansible
The component AppRole must first exist in Vault. Follow the
XO authentication and resource-set workflow to
synchronize its OIDC identity and apply its resource-set assignment before
tf_setup runs. The assignment in
resource_set_inventory supplies the template,
storage, and network by name. Component secrets must be written to Vault
before Ansible runs. State and locking use the repository’s tf_backend
plugin, which stores them as Vault KV entries and creates the entries on first
use, so no separate state bucket is required.
17.1 - Ansible
OpenHands deployment
Deploys the OpenHands components. The inventory has three hosts in three
groups, and the playbook applies one component role per group:
| Group | Host | Component |
|---|
openhands_canvas | host1.canvas.openhands.alwaldend.com | Agent Canvas |
openhands_server_secure | host1.server.openhands.alwaldend.com | Agent server (secured) |
openhands_automation | host1.automation.openhands.alwaldend.com | Automation server |
The three XCP-ng VMs exist only for the secured agent server and for the
components that must not share a trust boundary with host-bot. The secured
group sets openhands_server_session_api_key and hands the same value to the
automation server so the automation dispatcher can authenticate its
dispatched conversations.
Every component applies host and traefik. Canvas runs the published
package’s static server directly on loopback. The operator configures the
browser backend with the canvas origin and the shared session key.
The canvas host routes /api/automation to the automation host and the agent
server API prefixes to the secured agent server. These routes take precedence
over the frontend route, so the configured browser reaches one origin.
Downstream routers accept the original canvas Host header.
The unsecured agent server runs on host-bot and is deployed by
the host-bot project, which
owns that host entirely. It omits OH_SESSION_API_KEYS_0 and binds to loopback
without a session API key. Access is local to host-bot; its Traefik and firewall
configuration add no route for this server.
The group variables read the session key, secret key, and automation KV secret
from the environment the AL Vault injector populates.
17.2 - OpenHands DNS
Owner-local DNS Terraform
This root manages the records in dnsconfig.json using
//infra/openhands/dns:tf.<operation>. Follow the
shared transfer procedure
before operating this root.
17.3 - OpenSpec
17.3.1 - Specifications
17.3.1.1 - Infra openhands
17.3.1.1.1 - OpenHands infrastructure
Purpose
Describe the checked-in OpenHands component deployment, host boundaries,
ingress routing, and Vault secret references. These requirements describe desired
configuration and do not establish live deployment or service health.
Requirements
Requirement: Separate components by responsibility and trust boundary
The deployment SHALL run Agent Canvas, the agent server, and the automation
server as distinct components, because each owns a different responsibility.
The agent server SHALL run natively with its service account’s host
permissions. The deployment documentation SHALL identify those permissions as
the execution boundary and the workspace as its working directory.
Scenario: Inspect the component set
- WHEN a reader inspects the deployment
- THEN the canvas serves the browser client, the agent server runs
conversations and workspace operations, and the automation server stores
schedules and dispatches conversations
- AND the documentation states that the agent server acts with its
service account’s permissions on its host
Requirement: Scope Vault access to the component AppRole
infra/vault/tf SHALL declare the src_infra_openhands AppRole through a
module under infra/vault/tf/approle_src_infra_openhands/, including its
entity, group, SSH host-key signing role for openhands.alwaldend.com, and
server PKI role for the component hostnames. The AppRole SHALL receive only the
secrets, SSH, and certificate policies it needs, and the component SHALL
authenticate with it rather than a shared or administrative identity.
Scenario: Inspect the AppRole scope
- WHEN the Vault configuration is evaluated
- THEN the AppRole, SSH role, and server PKI role are declared in the
AppRole module and referenced by the shared identity groups
- AND the component’s
al.lua selects that AppRole by name
Requirement: Provision hosts separately from deployment
tf_setup SHALL create the canvas, secured agent server, and automation server
VMs in the src_infra_openhands Xen Orchestra resource set. Each VM SHALL
derive its hostname, address, and MAC from one record in dnsconfig.json.
Ansible SHALL deploy the components natively, without containers.
Scenario: Add a component host
- WHEN a new component is added
- THEN one record in
dnsconfig.json owns its name and static address - AND the provisioning
vms map references that record prefix
Requirement: Own ingress outside the component roles
Component roles SHALL install and run their services on loopback and SHALL NOT
declare their own ingress. The deployment SHALL expose them through the shared
Traefik role with per-component dynamic configuration.
Scenario: Expose a component through Traefik
- WHEN a component host is deployed
- THEN the shared
traefik role writes its dynamic configuration - AND the component role itself declares no router, entry point, or
certificate resolver
Scenario: Start the canvas frontend
- WHEN the canvas service starts
- THEN the package’s static server serves the packaged browser assets on
the declared loopback address
- AND it starts no agent server, automation server, or additional proxy
Requirement: Keep the browser on one origin
The deployment SHALL document configuring the browser backend with the canvas
origin and shared session key. The canvas origin SHALL proxy the backend API
paths to the agent server and automation server ahead of the frontend route.
Backend targets SHALL use site-local hostnames, and downstream routers SHALL
accept the forwarded canvas Host header.
Scenario: Serve the browser client
- WHEN the browser uses the canvas origin as its configured backend and
requests an automation or agent server API path
- THEN Traefik forwards it to the matching backend service
- AND the browser issues no cross-origin request
- AND the inter-service hop selects the downstream router without
traversing the public ingress
Requirement: Preserve the public ingress client-authentication policy
The component SHALL declare the public canvas.openhands.alwaldend.com CNAME
and the site-local canvas backend address consumed by its ingress service
entry. Canvas integration SHALL satisfy the existing
ingress routing and client-authentication requirements.
Scenario: Inspect public canvas routing
- WHEN the OpenHands DNS and ingress service declarations are inspected
- THEN the public canvas CNAME selects the shared ingress and the service
entry selects the component’s site-local backend address
- AND the integration uses the ingress owner’s existing TLS policy
Requirement: Inject secrets through the component’s Vault flow
Secret values SHALL be stored in Vault and referenced only by path, environment
variable name, or plugin label. The component al.lua SHALL inject them through
the repository’s injector plugin, and tasks that could reveal them SHALL use
no_log. The session API key SHALL be shared by the agent server, the
automation server, and the browser because all three authenticate the same
X-Session-API-Key value.
Scenario: Deploy with injected secrets
- WHEN the deployment reads the session key, secret key, or automation KV
secret
- THEN it receives them from the injected environment rather than committed
files
- AND the environment file that receives them is written with
no_log
Requirement: Deploy the unsecured agent server within its host’s owner
The unsecured agent server SHALL be owned and deployed by the host project that
owns its host, not by the OpenHands VM package. It SHALL bind to loopback,
receive no session API key, and add no ingress or firewall exposure of its own.
Scenario: Review the unsecured server deployment
- WHEN a reader inspects the unsecured agent server deployment
- THEN the host project’s inventory, playbook, group variables, and secret
injection declare it
- AND the OpenHands Ansible inventory contains only the three VM components
17.4 - Tf setup
Terraform setup
This package creates Xen Orchestra VMs in the src_infra_openhands resource
set for the three OpenHands components that run off host-bot: Agent Canvas,
the agent server, and the automation server. infra/openhands/BUILD.bazel
authenticates with OpenHands’ own Vault AppRole and the packaged XO OIDC login
plugin. The plugin supplies a temporary XO token and revokes it on shutdown;
no infrastructure administrator token is loaded. The setup HTTP backend
remains owned by the same OpenHands config.
Before running VM setup, bootstrap the AppRole’s XO OIDC user and apply
its resource-set membership through infra/xcp_ng/tf. Subjects are matched by
immutable Vault entity UUID under the configured OIDC issuer, not by login
name or AppRole group membership. See
XO authentication.
vms holds the component definitions, and each entry names the dnsconfig
record prefix that owns its hostname and address. Adding a component means
adding a record to ../dns/dnsconfig.json and an entry here; the guest hostname,
static address, and derived MAC all come from that one record. The agent
server is sized larger because it stores every backend conversation,
workspace, and bash event.
Defaults select the imported Fedora 44 template, local storage and wired
network by name from the OpenHands resource set. Override
TF_VAR_xoa_template_name, TF_VAR_xoa_storage_name, and
TF_VAR_xoa_network_name for another assignment. Native provider lookups run
as OpenHands’ own identity and reject ambiguous matches. The selected network
must carry 192.168.10.0/24; gateway and DNS default to 192.168.10.1 (the
wired router) and can be overridden.
The PVE-based infra/cloud_init:xen_linux target supplies the shared Ansible
user and CA configuration through the repository template rule. Terraform adds
the hostname and static network configuration from ../dns/dnsconfig.json. After
cloud-init completes, verify that /dev/xvda is the boot disk before running
Ansible.
bazel run //infra/openhands/tf_setup:tf_setup.plan
bazel run //infra/openhands/tf_setup:tf_setup.apply
Manage records through the dedicated DNS root.
The service deployment change
records separate VM, service, and TLS acceptance.
18 - Source repository
Repository evolution specifications and workflow history
This project owns the OpenSpec workspace describing
evolution of the alwaldend/src monorepo: its shared structure, build system
and development workflows. It also retains the index of the goal-to-OpenSpec
migration. Individual projects own their own specifications and change history.
The repository root remains the Bazel workspace and owns shared executable
configuration. This directory owns repository development specifications;
adding or changing them does not provision infrastructure.
Run the pinned CLI from the repository root.
It selects this project by default:
bazel run //tools/openspec -- list --specs
18.1 - Repository evolution
This OpenSpec workspace describes evolution of the alwaldend/src repository
itself: its shared structure, build system and development workflows.
specs/repository/spec.md records that contract;
changes/ records proposed and completed changes to it.
Each component owns a separate OpenSpec workspace beside its source:
projects/<project>/openspec/ holds that project’s specs and changes.tools/<project>/openspec/ holds that tool project’s specs and changes.infra/<project>/openspec/ holds that infrastructure project’s specs and changes.infra/src/openspec/ holds the repository’s own specs and changes.
Select the narrowest owner of the requested behavior. A project change belongs
in that project’s workspace, including when it has a standalone Bazel module.
Changes to shared repository structure belong here. Work spanning owners
keeps each affected contract with its owner and links related changes.
Component READMEs and build declarations retain their existing authority.
Run OpenSpec
The pinned CLI runs from the Git worktree
root. It selects infra/src by default; use OPENSPEC_PROJECT for a component:
bazel run //tools/openspec -- list --specs
OPENSPEC_PROJECT=tools/agents bazel run //tools/openspec -- list
OPENSPEC_PROJECT=infra/vault bazel run //tools/openspec -- list --specs
Use new change, status, instructions, validate, and archive with the
same owner selection. The packaged Repository OpenSpec skill
documents continuation and acceptance. No global install or assistant
configuration rewrite is needed. The CLI isolates configuration and disables
telemetry.
Run strict validation for this workspace with its local Bazel test.
bazel test //infra/src/openspec:validate_test
Each component has the same local test label in its own openspec package.
Validation checks artifact structure and, for archives, task completion.
Requirement acceptance still needs evidence from the owning implementation.
Infrastructure specs describe checked-in definitions, not observed deployment.
Maintain work
In the selected workspace, changes/<name>/proposal.md states outcome and
scope, design.md records decisions and continuation, tasks.md records
remaining actions, and specs/<capability>/spec.md contains requirement deltas.
Read an existing matching change before creating another. Keep temporary
notes, raw logs and validation receipts under ignored out/<task>/.
On interruption, preserve the candidate, evidence, execution state and next
action. Keep blocked or unfinished work explicit. OpenSpec files and Git do
not supply the removed legacy goal store’s transaction locks or evidence verdicts;
one coordinator owns a change and reconciles concurrent edits.
After acceptance, validate and archive the change in its owning workspace,
then inspect the resulting baseline specs. Specifications and generated
instructions neither expand user authority nor introduce an approval gate.
Goal migration
migration.md maps the nine maintained goals to their current
owner-local changes. It records a repository workflow migration; the actual
history and work state live with Agents, MCP Cordis and Renders. Original
history, checksums and acceptance states are preserved. Historical deltas
were archived without applying them to current specs. Reimu Fumo remains
open and blocked.
The legacy goal tool, its skill, and its store have been removed. New
maintained work uses the owning OpenSpec workspace; the migration record above
preserves the historical record.
18.1.1 - Goal migration to OpenSpec
On 2026-09-08, all nine tracked maintained project goal records at source commit 550d7e79b1f5fdbc2b6017b75178471d6914082f were migrated into native OpenSpec changes. Each change now lives in its owning project’s openspec/ workspace. Eight completed records are imported as archived history. The Reimu Fumo change remains open with blocked execution and no accepted candidate.
The machine-readable inventory maps all 222 tracked source files (834,320 bytes) to byte-identical provenance snapshots. Test fixtures and ignored task scratch are outside the maintained-record inventory.
Record mapping
Mapping and acceptance
- Objective and scope map to
proposal.md; accepted plans, decisions, rejected approaches, and constraints map to design.md. - The latest acceptance criteria map to
tasks.md and meaningful capability delta requirements. Each YAML criterion keeps its stable ID and revision in migration.json; original revisions, attempts, review verdicts, and evidence remain in provenance. - Completed task checkboxes reproduce explicit historical acceptance reviews. They do not revalidate today’s source. The Markdown Cordis record declares Complete and no failing criteria; its absent execution field stays unavailable rather than being guessed.
- Reimu acceptance and continuation tasks remain unchecked. A supported authorized unblock can change execution while the outcome remains open until every required criterion passes.
- Completed records were placed directly in their owner’s
openspec/changes/archive/2026-09-08-<id>/. No archive or spec-sync command applied their historical deltas. Current baseline specifications were derived separately from maintained owner source. Do not reapply historical deltas. - Historical Phase 5 acceptance includes an explicit fixture-gap inventory. Its accepted review and still-pending prose are both retained; migration does not claim the missing infrastructure fixtures were implemented.
Provenance and navigation
Each change has migration.json, a checksum inventory at provenance/manifest.json, original record bytes at provenance/source/, and a provenance navigation guide. The old agent goal landing and BUILD file are also retained under the repository-agent-system archive. The historical BUILD snapshot uses .original to preserve bytes without creating a new Bazel package.
Among preserved Markdown links, 47 links depend on the former location; companion navigation tables resolve them where the referenced artifact exists. 46 historical targets are unavailable in the checkout. Original bytes and historical Git identities are not rewritten to disguise unavailable scratch or superseded paths.
The former maintained goal directories are removed, and the legacy goal tool and its store were later removed as well; native OpenSpec work is the continuation surface. Provenance files are excluded from generic formatting so their source digests remain stable. The migration inventory is import evidence, not an alternate work scheduler or mutable status catalog. The removal change is remove-deprecated-goal-component.
18.1.2 - Specifications
18.1.2.1 - Anki go protos
18.1.2.1.1 - Anki Go Protobuf Integration Specification
Purpose
Make all protobuf schemas from the pinned upstream Anki source available to Go applications through reproducible repository builds.
Sources: dependency ownership,
schema catalog,
binding generation,
and consumer aliases.
Requirements
Requirement: Complete pinned Go schemas
The dependency integration SHALL generate Go messages and declared gRPC clients for every upstream Anki proto, retaining upstream import paths and the existing immutable source pin.
Scenario: Consume a previously omitted service
- WHEN an application imports the pinned tags or i18n schema package
- THEN its generated messages, descriptors and declared clients compile and can be used against the native backend
Requirement: Restricted schema consumption
Schema targets SHALL retain repository-internal consumer visibility.
Scenario: Intended application consumes all schemas
- WHEN anki_as_code links all pinned schema packages
- THEN its build succeeds through the dependency package’s declared aliases
18.1.2.2 - Go mod version
18.1.2.2.1 - go-mod-version Specification
Purpose
Keep tracked go.mod files on the Go version configured for
tools/go_mod.
Sources: tool README,
tool BUILD, and
archive.
Requirements
The repository SHALL provide a tools/go_mod command that discovers every
tracked go.mod file and sets its go directive to the version configured in
the tool’s BUILD file. The command MUST offer an update mode and a check mode.
Scenario: Update module files
- WHEN a user runs the update target
- THEN every tracked
go.mod file whose go directive differs from the
configured version is rewritten to that version - AND files already on the configured version remain unchanged
Scenario: Check module files
- WHEN the check test runs
- THEN it fails if any tracked
go.mod file has a go directive
different from the configured version - AND it passes when every tracked
go.mod file matches
Requirement: Repository quality integration
The go.mod version check MUST run as part of //:repo_quality_test so a
version mismatch fails repository quality.
Scenario: Quality suite covers the check
- WHEN a
go.mod file’s go directive differs from the configured
version - THEN
//:repo_quality_test fails
18.1.2.3 - Python import validation
18.1.2.3.1 - python-import-validation Specification
Purpose
Enforce module namespace imports in tracked first-party Python source through repository quality.
Requirements
Requirement: Validate namespaced Python imports
The repository quality suite SHALL reject individual symbol imports in tracked
first-party Python source using the existing pinned syntax linter, except direct
public re-exports listed in explicit __all__ in __init__.py. Wildcard imports
SHALL remain forbidden. Module imports
and qualified member access SHALL be accepted, including importing a verified
module with from package.path import module. Long module paths SHALL use this
form. Downloaded external source SHALL
remain outside this first-party check. The Python skill SHALL describe the
convention and its owning validation target.
Scenario: Reject a member import
- WHEN tracked Python imports individual members outside explicit package re-exports or uses a star from-import
- THEN repository quality fails with a namespaced-import diagnostic
Scenario: Accept namespaced imports and inert text
- WHEN source imports modules, including verified module from-imports, or includes from-import text only in comments or strings
- THEN the import check passes
Scenario: Preserve existing consumers
- WHEN existing first-party imports are migrated to the enforced convention
- THEN their module references and supported package exports remain usable
Scenario: Accept explicit package re-exports
- WHEN
__init__.py imports direct symbols and lists their bound names in explicit __all__ - THEN the import check accepts those exports, including relative imports
18.1.2.4 - Repository
18.1.2.4.1 - Repository Evolution Specification
Purpose
Define how the alwaldend/src monorepo evolves its shared structure, build
system and development workflows. Component behavior is specified in each
owner’s local OpenSpec workspace. This baseline was inspected at source revision
550d7e79b1f5fdbc2b6017b75178471d6914082f on 2026-09-08 and incorporates the
OpenSpec migration delivered with this specification. Changes in infra/src
record repository evolution; they do not collect unrelated component work or claim
runtime health or deployed infrastructure.
Sources: repository map, agent policy,
root build, project boundary,
infrastructure boundary,
tool boundary, OpenSpec workflow,
workspace procedure,
and goal migration record.
Requirements
Requirement: Component ownership and source boundaries
The repository MUST keep component purpose and publication boundaries in the
nearest owner README, executable and dependency structure in BUILD and MODULE
files, and agent policy in the applicable AGENTS.md chain. Specifications SHALL
describe component requirements with links to these owners.
Scenario: Select an implementation owner
- WHEN a change affects a project, tool or infrastructure component
- THEN its owning documents and Bazel workspace determine the affected
paths and supported consumers
- AND a repository-wide catalog or specification does not grant broader
publication or execution authority
Requirement: Reproducible Bazel development
Repository agent build and test operations MUST use al bazel in the
owning workspace with pinned dependencies and the repository’s shared agent
configuration. Generated dependency and catalog files MUST be updated through
their owning generator.
Every nested module that declares MODULE.bazel MUST declare only
dependencies its own sources use, with a resolvable version or an override
that applies when that module is the root. Every nested module directory MUST
appear in the root .bazelignore so root target expansion does not cross the
workspace boundary. Each nested workspace MUST build and test standalone.
Scenario: Change a shared dependency
- WHEN an implementation adds an external build input
- THEN its owner records an immutable version and integrity information
- AND applicable generated locks and package checks validate the declared
dependency through the pinned build workflow
Scenario: Build a nested module standalone
- WHEN a nested Bazel workspace is built or tested on its own
- THEN its module graph resolves without depending on root-only overrides
- AND the workspace builds and tests through its shared configuration
Scenario: Expand root targets across a nested boundary
- WHEN the root workspace expands targets beneath a nested module directory
- THEN the nested workspace is excluded by the root ignore list
- AND root expansion neither loads nor silently omits that module
Requirement: Isolated implementation and evidence
Repository modifications MUST use a dedicated feature branch and linked
worktree. The repository SHALL own that procedure in a al-workspace skill
that runs before the first mutation or task-scratch write, so isolation and
scratch placement are established before al-delivery is loaded. Task
scratch MUST remain under ignored out/<task>/ in the applicable workspace,
and configurable temporary and cache locations SHALL point there. Delivery
SHALL exclude disposable build outputs and include required
generator-maintained files updated through their owning workflow. Acceptance
SHALL identify the candidate and relevant checks and representative output
before delivery.
Scenario: Finish a repository change
- WHEN an authorized implementation is ready for delivery
- THEN task-owned changes pass applicable formatting, quality and semantic
checks and are committed and published through the repository procedure
- AND unrelated edits, scratch and protected data are excluded
Scenario: Begin a task that writes
- WHEN a task will modify repository files or write task-owned scratch
- THEN the agent verifies the feature worktree and branch before the first
write
- AND task-owned scratch and configurable temporary locations stay under
the ignored
out/<task>/ directory
Scenario: Prepare the delivery candidate
- WHEN the delivery procedure stages the candidate
- THEN disposable build outputs are excluded
- AND required generator-maintained files are included after their owning
workflow regenerates them
Requirement: Declarative infrastructure authority
Persistent infrastructure configuration MUST be defined in checked-in owning
infrastructure code. Infrastructure operations MUST require the user’s exact
operation and scope authorization; an implementation validation request SHALL
NOT authorize live deployment.
Scenario: Validate an infrastructure specification
- WHEN an agent adds or updates an infra component specification
- THEN it inspects source and runs applicable offline checks
- AND it does not infer deployed state or execute live apply or deployment
from the existence of the specification
Requirement: OpenSpec coverage and work state
Each direct project in projects/ and infra/ SHALL keep its baseline
specifications and maintained changes in its own openspec/ workspace.
infra/src/openspec SHALL describe evolution of the repository itself,
including shared structure, build system and development workflows. The
repository root SHALL NOT collect component specifications or change records.
Every repository change MUST use an OpenSpec change in its owning workspace,
including trivial edits, documentation, configuration, and dependency changes.
A matching active change SHALL be reused when available, and artifacts SHALL
remain proportional to scope. Read-only questions and reviews do not require
a change record. Maintained work SHALL preserve outcome, decisions, tasks and
requirement deltas. Existing task authority MUST survive workflow transitions.
Scenario: Change a component contract
- WHEN a change affects a project’s supported behavior
- THEN its specifications and change artifacts remain in that project’s
openspec/ directory - AND the pinned CLI and context routing select that owner workspace
Scenario: Evolve the repository itself
- WHEN a change affects the monorepo’s shared structure or development workflow
- THEN
infra/src/openspec records its repository requirements and evolution - AND component contracts remain with their respective owners
Scenario: Resume unfinished maintained work
- WHEN an agent resumes a named OpenSpec change
- THEN it reads that owner’s change artifacts, candidate, evidence and next action
- AND unfinished or blocked acceptance remains explicit until evidence
supports completion
Scenario: Validate a standalone project
- WHEN a project has its own Bazel module
- THEN repository OpenSpec validation still checks its declared local workspace
- AND a successful repository check does not omit that project’s requirements
Scenario: Make a trivial change
- WHEN an agent makes a one-line repository correction
- THEN it selects or creates a matching owner-local OpenSpec change before
editing, with small artifacts and skip_specs if behavior is unchanged
- AND the record adds no approval gate to already authorized work
Scenario: Conduct a read-only review
- WHEN the task only inspects a bounded change set and reports findings
- THEN no new OpenSpec change is required for that review
- AND the review itself does not authorize implementation or publication
Requirement: Removed legacy goal record
The repository MUST NOT carry a goal tool, goal store, or goal skill, and MUST
NOT reintroduce a goal record format as a maintained work channel. Maintained
work SHALL use the owning component’s OpenSpec workspace. The change SHALL
identify the removed component.
- WHEN an agent needs durable intent, tasks, or continuation state
- THEN it uses the owning component’s
openspec/ workspace through the
pinned CLI - AND no goal command, skill, or store is available or documented as an
active channel
Scenario: A reader needs the removed implementation
- WHEN a reader needs a file from the removed goal component
- THEN the change and migration record name the removed tree
- AND the reader retrieves the file from git history at the removal
commit’s parent
Requirement: Rule scripts and generated documentation
Bazel rules MUST NOT embed templated executable content in rule source. A rule
that needs an executable MUST reference an ordinary checked-in script and
supply its inputs as declared arguments or data files. Every public rule set
MUST generate stardoc documentation for its public .bzl entry points, and the
repository’s main documentation output MUST include that generated
documentation.
Scenario: A rule needs to run scripted logic
- WHEN an implementation needs a rule to run a script
- THEN the script is checked in as a normal file with its own target and receives data through arguments or a declared data file
- AND generated shell or program text does not live in the
.bzl source
Scenario: A rule set exposes public rules
- WHEN a project publishes a public Bazel rule or macro
- THEN it declares stardoc coverage for the declaring file
- AND the generated pages appear in the repository documentation build
First-party standalone Bazel rule modules SHALL live under tools/<module>/.
Their relocation MUST preserve module names, supported public rule and macro
interfaces, standalone workspace resolution, generated rule documentation,
and owner-local specifications. Repository consumers and discovery mechanisms
MUST resolve their new source locations through the owning declarations.
Scenario: Consume a relocated rule module
- WHEN a root or nested workspace loads a relocated rule module through its
supported module name and public rule interface
- THEN the module resolves from its new tool-owned location
- AND its supported build behavior remains available without changing the
public module identity
Scenario: Discover a relocated owner’s specifications and rules
- WHEN repository documentation, skill discovery, or OpenSpec validation
traverses the relocated modules
- THEN it selects the modules’ new owner paths
- AND generated rule documentation and existing component specifications
remain included in their declared outputs and checks
The relocated rule modules SHALL have no dedicated project landing-site
configuration. After authorized retirement, their selected landing repository
and DNS declarations MUST be absent from the owning infrastructure, and
shared-catalog consumers MUST exclude those retired repositories. Retirement
MUST preserve unrelated repositories, sites, access grants, and authentication
resources.
Scenario: Build or import the remaining repository catalog
- WHEN the catalog is projected for GitHub or GitLab after rule-landing
retirement
- THEN the retired landing repositories are absent
- AND remaining repositories retain their catalog identities, names, and
configured access behavior
Scenario: Retire a selected landing site
- WHEN the owning declarative workflows execute the user’s explicitly
authorized retirement scope
- THEN the selected Pages repository and matching DNS record are removed
- AND the reviewed plans and postconditions show no unrelated deletion or
replacement
Requirement: Thin CI workflow wrappers
Repository CI workflows MUST be maximally thin wrappers. Executable logic SHALL
be implemented in bazel run targets or committed scripts; workflow YAML SHALL
contain only declarative orchestration and short command invocations. The
discoverable repo-ci skill SHALL document this rule and link owning sources.
Scenario: A workflow needs executable job logic
- WHEN a workflow requires resource checks, authentication, parsing, loops,
or other executable behavior
- THEN that behavior resides in a committed implementation invoked by the
workflow, preferably through
bazel run - AND inline programs, heredocs, and composite-action YAML do not substitute
for the implementation
Scenario: An agent changes repository CI
- WHEN an agent discovers the repository skills for CI work
- THEN
repo-ci explains the workflow and command boundaries, authentication
constraints, and applicable offline and live validation entry points
Requirement: Shared repository CI entry point
Every repository CI workflow SHALL use the local tools/ci/action action
after checkout. The action SHALL launch bazel run --config=ci //tools/ci
without a shell and propagate its failure.
The entry point SHALL build and test all normal targets in the root and nested
Bazel workspaces, continuing to attempt both phases and remaining workspaces
after a failure and returning failure if any command fails. It SHALL discover
nested workspace boundaries from the root .bazelignore and MODULE.bazel
files. Runner infrastructure acceptance probes SHALL NOT be part of normal CI.
Scenario: Run normal CI
- WHEN a repository CI workflow runs
- THEN the shared command builds and tests each workspace with the CI profile
- AND normal Bazel exclusions for manual and incompatible targets apply
Scenario: One build fails
- WHEN one workspace’s build phase fails
- THEN its test phase and the remaining workspaces are still attempted
- AND the entry point reports failure
Requirement: Compose repository policy with skill routing
The root AGENTS.md SHALL keep repository-wide constraints visible: fact
ownership, infrastructure and approval authority, mandatory delivery,
worktree isolation, protection of unrelated work, confidentiality, and naming
and communication standards. Execution detail SHALL live with the skill that
owns it, and the root document SHALL route to that skill through one compact
“When to load a skill” table ordered by task phase. Each routing entry SHALL
name the trigger and the skill without restating the skill’s procedure.
Initial reads SHALL depend on the task: applicable policy and the owning
README first, and BUILD or MODULE declarations only when implementation or
validation depends on them.
Scenario: An agent starts an unfamiliar task
- WHEN an agent begins work in a subtree
- THEN it reads the applicable
AGENTS.md chain and the owning README.md - AND it inspects BUILD or MODULE declarations only when the task depends
on them
- AND it loads the skill whose routing trigger matches the current phase
Scenario: A procedure needs to change
- WHEN a repository-wide procedure changes
- THEN the change belongs with the skill that owns it, not in the root
policy
- AND the root document retains only the routing entry and any
repository-wide constraint
Requirement: One authoritative source per fact
Each fact SHALL have one authoritative source. Independently maintained
duplicates SHALL be treated as defects even when the original is hard to
reach; the owner SHALL be extended or parameterized instead of copied.
Generated projections, fixtures, and concise summaries that identify their
source are projections rather than duplicates.
Scenario: A generated file restates an owned fact
- WHEN a checked-in generated file, fixture, or summary restates a fact
owned elsewhere
- THEN it identifies its source and regeneration workflow
- AND it is not treated as an independently maintained duplicate
18.1.2.5 - Third party flux mirror
18.1.2.5.1 - Third-party Flux mirror
Purpose
Mirror pinned Flux and Flux Operator artifacts into Forgejo using the third-party publication workflow.
Requirements
Requirement: Flux artifact mirroring
The Flux and Flux Operator packages SHALL each provide Bazel targets to pull
their pinned charts and images and publish them to Forgejo using the
third-party AppRole.
Scenario: Publish an existing local mirror
- WHEN an operator runs the push target with that package’s staged artifacts
- THEN chart archives are published to the Helm registry
- AND image manifests retain their upstream digests and platform entries
19 - Cloud-init
Shared PVE-based infrastructure VM bootstrap configuration
assets/cloud_init.yaml is the canonical configuration moved from PVE. PVE
and Yandex Cloud consume it directly. It owns the Ansible sudo user, SSH keys,
local TLS root CA, and common bootstrap policy. The Ansible SSH CA is selected by its certificate-authority principal options;
user and key ordering do not affect the Xen configuration. Missing or duplicate
Ansible users or CA keys fail template rendering.
assets/cloud_init_min.yaml is the existing minimal PVE configuration with
QEMU guest tools. Both original PVE files retain their contents.
The xen_linux target uses the repository’s rules_template Go template rule
to derive xen_linux.json from that same PVE configuration. Its small template
selects the shared Ansible CA key, uses Fedora’s users,wheel groups, and adds
Xen guest tools. It omits PVE’s explicit package-reboot and public metadata-key
flags to preserve the existing Xen bootstrap behavior. All other base fields,
including the TLS CA, come from the PVE configuration. There is no separate
copy of the Xen user or CA configuration and no Terraform template file.
Forgejo merges its hostname into the generated object and uses Terraform’s
yamlencode to serialize it. Its static network structure stays in Terraform,
where interface, address, MAC, gateway, and DNS are runtime values. The rendered
Forgejo user-data and network configuration remain byte-identical to the
previous configuration.
PVE Ansible packages the moved snippets under the existing
files/cloud_init.yaml and files/cloud_init_min.yaml names. Those packaging
aliases preserve local:snippets/cloud_init.yaml references on PVE hosts.
Subsequent persistent VM configuration belongs in Ansible. Targets are
repository-internal runtime inputs, not published artifacts.
20 - XCP-ng
Xen Orchestra resource sets, VM templates, and XCP-ng hosts
Terraform in tf manages a Xen Orchestra resource set for every
entity in Vault’s approles group, following infra/pve/tf. Resource sets
are the XO grouping and delegation mechanism; XCP-ng host pools represent
physical clusters and are not created per AppRole.
resource_set_inventory assigns a pool, template, storage repository and
network by name to each AppRole. Native provider lookups resolve their IDs
and reject ambiguous matches. Forgejo and OpenHands have assignments by default;
other sets remain empty. Subjects are the exact synchronized OIDC users
selected by Vault issuer and immutable AppRole entity UUID. Bootstrap has
synchronized the 18 AppRole users; new AppRoles need their first OIDC login
before Terraform can bind their sets. resource_set_cpu_limit defaults to
32 CPUs per set. Creating a set does not allocate CPUs or storage.
The development resource set additionally receives the dedicated Runner cache
SMB storage repository. The existing host has the SMB3 driver and client. The
shared NAS root owns AppRole accounts and mandatory
transport encryption. The development NAS project
owns its namespace, cache and shares in separate state. The XCP-ng AppRole reads
its own account at shared/read/approle/src_infra_xcp_ng/nas for this connection.
The cache UNC path is //nas.alwaldend.com/src_infra_dev_runner_cache.
Named NAS ACLs grant parent traversal and cache modification; namespace share
ACLs prevent connection to the development namespace share. Jobs and guest
configuration receive no SMB credential; XAPI retains its mount credential.
The pinned provider lacks an SR resource. terraform_data.runner_cache therefore
invokes the existing XO helper’s ensure-cache-storage command once under the
Terraform backend lock. It creates absent storage, verifies its type, pool and
ownership marker, and preserves a matching repository on an explicit rerun.
It rejects ambiguous or conflicting inventory and never deletes or reformats an
existing repository. After a failed creation response, inspect the inventory
before retrying: server-side creation may already have completed.
This is creation-only bootstrap: ordinary plans do not refresh its PBD settings,
credential rotation is coordinated separately, and forgetting its Terraform
record leaves the repository intact. Host/share changes require explicit
reconciliation. Do not run the helper concurrently outside the owning workflow.
Before deployment, apply Vault groups/grants, the shared NAS root, and
//infra/nas/approles/src_infra_dev:tf.apply for the namespace and runner share,
before this root.
The complete runner VM apply and guest mount follow in infra/dev. This source change does not deploy any of them.
The provider is pinned to vatesfr/xenorchestra 0.41.0. The single
infra/xcp_ng/BUILD.bazel configuration supplies administrator authentication for
XCP-ng infrastructure operations: its named xcp_ng Vault AppRole injects
XOA_TOKEN from key xoa_token in
secrets/alwaldend.com/vault1/approles/src_infra_xcp_ng/xoa.
Forgejo instead uses its own Vault identity through the
XO login plugin, which issues an invocation-scoped
XO session and revokes it on shutdown. It retains its own Terraform backend
and does not inherit the infrastructure administrator token. Token values
are not Terraform inputs or outputs.
The default endpoint is wss://xoa.xcp-ng.alwaldend.com. DNS maps the XO
appliance to 192.168.1.206 and the XCP-ng host to 192.168.1.213.
TLS verification is enabled. xoa_insecure is an explicit temporary
bootstrap override for an appliance whose certificate has not been replaced.
The HTTP backend stores state under the AppRole’s tf_backend Vault path.
OIDC and certificates
infra/vault/tf owns the src_infra_xcp_ng_provider OIDC client, the
src_infra_xcp_ng_users and src_infra_xcp_ng_admins groups, and the
src_infra_xcp_ng_pki_server ACME role. Apply those scoped prerequisites
before the XO configuration. The callback is
https://xoa.xcp-ng.alwaldend.com/signin/oidc/callback.
XO must have the auth-oidc plugin installed and trust Vault’s CA. The
Terraform provider has no plugin resource, so terraform_data.oidc invokes
the packaged Go JSON-RPC helper directly, without a shell. It configures
Vault discovery, the client, and the user groups scopes, enables autoload,
and verifies the plugin is loaded. The OIDC client secret remains sensitive
and is stored in the Vault-protected Terraform state. The provisioner signs
the XCP-ng AppRole in through Vault to create the synchronized OIDC groups.
Plugin reconciliation runs when configuration or the helper binary changes,
without native drift refresh. Use -replace=terraform_data.oidc to reapply
after manual plugin drift.
Native xenorchestra_acl resources manage the administrators group’s pool
permissions. An import block adopts matching existing ACLs using their
discovered API IDs. The helper only reads these ACLs; it does not change them.
The users group grants login eligibility, with membership refreshed at login.
Per-AppRole resource-set membership and existing VM ownership use direct user
subjects. The Forgejo user receives administration permission on its own VM;
no shared pool-wide view grant is configured.
The helper remains for gaps in the pinned provider: OIDC plugin configuration
and bootstrap, discovery of external identity subjects and synchronized
groups, host registration, prepared VHD template import, and diagnostics.
Resources, ACLs and named infrastructure lookups use the native provider.
The resource-set management page is
Self Service. In the deployed XO
source revision 961b505cfb74cbf24aaeb8d61c5613f97e78de2c, its
menu entry
requires a global administrator. The
page
also requires XOA_PLAN > 3, corresponding to
Premium or Community.
The runtime edition has not been verified. Pool-level administrator ACLs do
not satisfy the page’s global-administrator requirement.
The certificate playbook uses Certbot with Vault EAB,
installs XO’s Vault CA trust, and configures renewal. It requires appliance
SSH access and inspected HTTPS certificate paths. Initial issuance and
renewal briefly interrupt XO management access, not running guest VMs.
Commands
Use the packaged SSH target for authorized host inspection:
bazel run //infra/xcp_ng:ssh -- 'lscpu; lspci -nn'
This target uses the host’s OpenSSH and sshpass, the existing Vault-backed
host password injected as SSHPASS, and the host administrator account root. The controller
must already trust the host key in its SSH known-hosts file. It bypasses host
SSH configuration files and refuses unknown or changed host keys. Arguments
after -- are forwarded as the remote command; omitting them opens a session.
The target grants no authority to change host configuration.
The XO server must be connected to an XCP-ng host before discovering
templates or creating VMs. xo_inspect prints selected operational metadata
without credentials or plugin configuration:
XOA_URL=wss://xoa.xcp-ng.alwaldend.com bazel run //infra/xcp_ng:xo_inspect
bazel run //infra/xcp_ng/tf:tf.plan
bazel run //infra/xcp_ng/tf:tf.apply
bazel test //infra/xcp_ng/tf:tf_tests.fmt_test //infra/xcp_ng/cmd/xo_config:xo_config_test
Formatting and helper tests run without live authentication. See
Forgejo provisioning for VM prerequisites.
To register host1, store its xcpng_username and xcpng_password fields
in secrets/alwaldend.com/vault1/approles/src_infra_xcp_ng/host1, then run:
XOA_URL=wss://xoa.xcp-ng.alwaldend.com XCPNG_HOST=192.168.1.213 bazel run //infra/xcp_ng:xo_register_host
The command uses the XOA token to register the host and supplies its separate
host credentials through AL. It waits for a connected pool and leaves an
already connected host unchanged. Duplicate registrations are rejected.
XCPNG_INSECURE=true explicitly allows the host’s bootstrap certificate;
XOA_INSECURE=true separately controls verification of XO’s certificate.
//infra/xcp_ng:xo_import_template imports the repository-pinned image from
//third_party/org_fedora_cloud through XO’s disk-upload API. Supply
XO_TEMPLATE_SHA256 from the image’s pinned checksum, XO_TEMPLATE_SR,
XO_BASE_TEMPLATE_ID (a diskless Generic Linux BIOS template), and
XO_TEMPLATE_NAME, together with XOA_URL. The host must support QCOW2
imports. The command verifies the image before creating anything, creates an
unbooted template with only a boot disk at device 0, and verifies the final
disk layout. It rejects incomplete or conflicting prior imports for inspection.
This keeps cloud-init fresh for cloned VMs and prevents empty CD drives from
shifting the Forgejo data disks to unexpected device names.
Older XO releases, including 5.192.1, require VHD rather than QCOW2 uploads.
For those releases, convert the pinned image to dynamic VHD in task-private
scratch, verify the decoded contents against the original with qemu-img compare, and record the converter version and converted file’s SHA256.
Use //infra/xcp_ng:xo_import_prepared_template with XO_TEMPLATE_IMAGE
set to the absolute converted path, XO_TEMPLATE_FORMAT=vhd, and
XO_TEMPLATE_SHA256 set to the converted checksum. The other inputs are
the same as for the pinned-image importer.
An interrupted import can resume on an inspected empty, halted task VM by
setting XO_TEMPLATE_RESUME_ID, XO_TEMPLATE_PREVIOUS_FORMAT, and
XO_TEMPLATE_PREVIOUS_SHA256 to its exact prior identity and image marker.
Resume preserves that VM and refuses any attached disk or network interface.
20.1 - OpenSpec
20.1.1 - Specifications
20.1.1.1 - Infra xcp ng
20.1.1.1.1 - XCP-ng infrastructure Specification
Purpose
Specify Xen Orchestra resource delegation, scoped authentication, and
certificate deployment owned by infra/xcp_ng. The baseline is checked-in
source at revision 550d7e79b1f5fdbc2b6017b75178471d6914082f, observed on
2026-09-08. Existing operational observations in project documentation are
historical context; this baseline does not verify current deployment, edition,
identity synchronization, or service health.
Requirements
Requirement: AppRole resource sets with named inventory
Terraform SHALL declare one Xen Orchestra resource set per entity in Vault’s
approles group. Each set SHALL contain its explicitly assigned template,
storage repository, and network resolved by names within the selected pool;
unassigned sets SHALL contain no inventory objects. Each set SHALL have a
positive integer CPU quota, defaulting to 32. These resource sets SHALL
represent delegation groups rather than new physical host pools.
Sources: resource sets,
named inventory, and
project contract.
Scenario: An AppRole has no assigned inventory
- WHEN an AppRole exists in Vault’s group but has no
resource_set_inventory entry - THEN its resource set contains no assigned inventory objects and retains
the configured CPU quota.
Requirement: Immutable OIDC subjects and explicit existing-VM ownership
Resource-set membership SHALL select the exact synchronized OIDC user by Vault
issuer and immutable AppRole entity UUID. AppRoles without synchronized users
SHALL be reported in approles_pending_oidc_login and have no resource-set
subjects. Existing-VM owner ACLs SHALL require exactly one VM matching the
hostname and owning AppRole tag within its named pool, and SHALL grant admin
to the owner’s synchronized user. Unknown owners, ambiguous VMs, or missing
owner synchronization SHALL fail planning. Native Terraform ACL resources
SHALL separately manage the synchronized administrators group’s pool grants.
Sources: identity contract,
owner ACLs and preconditions,
resource-set subjects, and
administrator ACLs.
Scenario: A new AppRole has not logged in to XO
- WHEN identity discovery cannot find its synchronized OIDC subject
- THEN its resource set has no subjects and its name appears in the pending
login output; an existing-VM ownership grant for it fails its precondition.
Scenario: An existing VM name does not identify a unique owned VM
- WHEN hostname and AppRole tag matching in the named pool returns zero or multiple VMs
- THEN Terraform rejects the existing-VM ownership configuration.
Requirement: Invocation-scoped tenant authentication
The XO login plugin SHALL authenticate using the calling component’s Vault
identity and export XOA_TOKEN, XOA_URL, and XOA_INSECURE=false to the
invoked process. XO HTTPS verification SHALL be mandatory for this plugin.
Session cookies and tokens SHALL remain in process memory, and normal plugin
shutdown SHALL revoke only the XO token issued by that invocation. Tenant
authentication SHALL remain separate from the infrastructure administrator
token. Forced termination or a lost callback can leave a session until XO’s
configured expiry and SHALL not be described as guaranteed revocation.
Sources: XO login contract and
authentication ownership.
Scenario: A component finishes its authenticated invocation
- WHEN normal plugin shutdown follows a successful XO login
- THEN the plugin revokes its issued session using
token.deleteOwn
without revoking unrelated sessions.
Requirement: Declarative certificate issuance and renewal
The XO appliance playbook SHALL use Certbot with Vault external account
binding, retain the inspected listener certificate paths, install
service-specific Vault CA trust, and configure twice-daily renewal checks.
The host playbook SHALL use its packaged compatibility helper and the
checksum-verified Lego release to install certificates through XAPI’s
supported certificate-install command. Temporary EAB registration material
SHALL be removed after use. Appliance renewal may interrupt XO management
access; host renewal SHALL not stop XAPI or running VMs.
Sources: certificate deployment contract
and packaged playbooks and runtime inputs.
Scenario: Renew an XCP-ng host certificate
- WHEN the renewal helper obtains a certificate different from the installed certificate
- THEN it uses
xe host-server-certificate-install, with installation
retry tracked independently of issuance, while preserving running VMs.
20.2 - Terraform
AppRole resource sets and Vault-backed Xen Orchestra authentication
This configuration manages one Xen Orchestra resource set per Vault AppRole
and configures the installed XO OIDC plugin through a packaged JSON-RPC helper.
See the project documentation for requirements and checks.
Resource-set subjects reference exact synchronized OIDC users whose OIDC
subject identifiers match Vault AppRole entity UUIDs. AppRole groups can include other
service entities, so using those groups would grant access across deployments.
Bootstrap XO’s OIDC configuration first, then log in through OIDC as each
AppRole and run the full Terraform apply. Identity discovery runs at plan
time and never creates users. AppRoles that have not logged in are listed in
approles_pending_oidc_login; their sets remain without subjects until the
next apply after login. Groups remain responsible for login entitlement and
administrative access, separately from these per-AppRole grants.
resource_set_inventory supplies pool, template, storage and network
names per AppRole. Native data sources resolve a unique pool and unique
objects within that pool. Unassigned resource sets remain empty. These inputs
have no UUID defaults; resolved IDs remain necessary for XO API operations.
existing_vms maps hostnames to an owning AppRole and pool name. Discovery
requires exactly one VM with both the hostname and AppRole tag in that pool.
The owner receives an explicit admin ACL. Resource-set membership permits
provisioning and does not transfer existing VM ownership. Missing or ambiguous
VMs, unknown AppRoles and unsynchronized OIDC users fail planning. ACL resource
keys retain the AppRole and resolved VM ID, preserving their addresses when
the same existing VMs are found through names.
Native xenorchestra_acl.pool_administrator resources manage the synchronized
administrators group’s permissions on connected pools. The read-only helper
identifies existing matching ACLs, and an import block adopts them without
recreating access. Fresh installations must bootstrap terraform_data.oidc
before the full plan so the synchronized groups exist. There is no shared
pool-view grant and the helper performs no ACL writes.
The pinned hashicorp/external provider calls the packaged helper’s read-only
oidc-identities command. XO exposes login names as email and authentication
providers in authProviders; the helper accepts only OIDC-authenticated
identities from the configured Vault issuer and indexes them by
authProviders["oidc:" + issuer].id, the Vault entity UUID.
Duplicate OIDC subjects are an error. Mutable login names and inherited group
membership do not select the ACL subject. Group discovery selects only
synchronized OIDC groups and rejects duplicate names. The provider has no
group datasource and its user datasource does not expose immutable external
subjects. API credentials remain in the injected environment.
Manage records through the dedicated DNS root.
20.3 - Xen Orchestra certificates
Vault ACME certificate issuance and renewal for the XOA appliance
This playbook installs Debian’s Certbot package and obtains a certificate for
xoa.xcp-ng.alwaldend.com and host1.xoa.xcp-ng.alwaldend.com from the Vault
src_infra_xcp_ng_pki_server ACME role. The XCP-ng AppRole creates the
external account binding; its registration file is removed after issuance.
The target injects xoa_ssh_password from
secrets/alwaldend.com/vault1/approles/src_infra_xcp_ng/xoa for the appliance’s
xoa SSH account and sudo. Ansible uses its native ssh_askpass password mechanism;
the controller must provide a verified SSH host key. Passwords
are runtime environment inputs and are not stored in inventory.
Run the read-only inspection target before deploying a different appliance:
bazel run //infra/xcp_ng/ansible:ansible.inspect
bazel run //infra/xcp_ng/ansible:ansible
# Certificate and trust reconciliation without reinstalling the OIDC plugin:
bazel run //infra/xcp_ng/ansible:ansible -- --skip-tags oidc
The playbook verifies existing managed certificates against the Vault CA and both
hostnames. Missing or invalid certificates trigger issuance and an XO restart;
file existence alone does not establish a valid certificate. Inspect the public
certificate with :ansible.inspect -- --tags certificate_status.
The checked-in settings match the inspected appliance: xo-server runs as
root and listens on HTTPS with /etc/ssl/cert.pem and /etc/ssl/key.pem.
The deployment explicitly sets autoCert = false in that HTTPS listener so XO
cannot replace the externally managed certificate with a self-signed fallback.
The deployment preserves these listener paths.
Apply the Vault PKI role before certificate issuance.
Certbot uses standalone HTTP-01 validation. Vault must resolve both names to
the appliance and reach TCP port 80. Issuance and renewal briefly stop
xo-server to free that port, interrupting management access but not guest VMs.
The existing TLS files are preserved with .before-vault-acme suffixes before
their paths become symlinks to Certbot’s renewable files. The dedicated
xo-acme-renew.timer checks twice daily. Certbot is configured to renew the
seven-day Vault certificates with two days remaining; stop/start hooks run
when renewal is needed. Certificate keys and ACME account files remain root-only.
The playbook adds a service-specific Vault CA trust override using
NODE_EXTRA_CA_CERTS so XO can also validate Vault’s OIDC endpoint. It verifies
the appliance HTTPS endpoint against that CA after deployment.
The deployment target is //infra/xcp_ng/ansible:ansible. Building
//infra/xcp_ng/ansible:ansible_bin packages the playbook without deploying it.
XO’s native ACME implementation
does not pass EAB credentials to its ACME client. Certbot supports
external account binding
without changing Vault’s mandatory-EAB policy.
XCP-ng Ansible interpreter
The existing inventory selects
/opt/ansible-python/3.14.4/bin/python3.14 for
host1.xcp-ng.alwaldend.com at host scope. This takes precedence over the
security consumer’s group_vars/all.yaml setting of /usr/bin/python3.
Shared security workflows consume this owner inventory directly.
The user explicitly authorized a manual bootstrap exception for this
host. The parent implementation agent owns installation and validation of
the side-by-side runtime. Bootstrap must preserve vendor Python, PATH, and
system symlinks, and must not reboot the host. The runtime follows the
existing rules_python CPython 3.14.4 pin in
tools/py/include.MODULE.bazel;
there is no additional third-party pin. It is not maintained by yum.
The host-scoped inventory setting and this exception document the IaC
reconciliation. The parent reports successful installation and native module
verification. Evidence and pending shared-role audit validation are recorded in the
owner change.
The parent must review the candidate before deployment and record the remaining
validation results there.
XCP-ng host certificates
//infra/xcp_ng/ansible:ansible.host provisions a Vault ACME certificate for
host1.xcp-ng.alwaldend.com and xcp-ng.alwaldend.com. Inspect a different
host with //infra/xcp_ng/ansible:ansible.inspect_host before deployment.
The host must serve /opt/xensource/www/.well-known/acme-challenge through
HTTP or an HTTP-to-HTTPS redirect; the inspection verifies and cleans up a
public probe file. This host supports that path without changing XAPI settings.
XCP-ng’s vendor Python 3.6 cannot run the current Ansible modules. The
certificate playbook explicitly uses /usr/bin/python3 through Ansible’s
script transport for a Python 3.6-compatible helper, without adding packages
to dom0. The helper downloads the immutable Lego release declared in
third_party/com_github_go_acme_lego_bin/binary_toolchain.json, verifies its
checksum, and installs it under root-only /etc/xcp-ng-acme.
The initial EAB is temporary. Only the ACME account remains for unattended
renewal; no Vault token is retained on the host. The client requests RSA4096
keys to match the Vault role. xcp-ng-acme-renew.timer runs twice daily and
uses XAPI’s supported xe host-server-certificate-install command when the
issued certificate differs from the installed certificate. Installation is
retried independently of issuance. Renewal does not stop XAPI or running VMs.
The final deployment verifies HTTPS and enables the timer.
Set an absolute task-private TMPDIR for controller registration scratch.
Ansible removes the temporary registration script after execution. The
bootstrap tag updates the helper without ordering a certificate.
OpenID Connect plugin
The XO playbook installs the official xo-server-auth-oidc 0.4.0 plugin with
pinned, checksum-verified upstream files and isolated dependencies. This
version supports Vault group synchronization while remaining compatible with
the installed XO core. Ansible verifies the plugin before restarting XO;
Terraform configures it and reconciles group ACLs through the API.
SSH connection reuse keeps deployment within the appliance’s existing UFW
limit of six new SSH connections per 30 seconds. No firewall exception is
required.
20.4 - Xen Orchestra DNS
Owner-local DNS Terraform
This root manages the records in dnsconfig.json using
//infra/xcp_ng/dns:tf.<operation>. Follow the
shared transfer procedure
before operating this root.
21 - GitHub
GitHub organization, repositories, access, and Pages configuration
This project manages the GitHub organization and repositories declared by the
shared repository catalog, including existing forks,
project landing sites, organization membership, and developer access.
Service Terraform adopts existing resources and preserves their
identities. It also manages repository default-branch rules and existing Pages
configuration. Site content is published through the owning project deployment
targets; this infrastructure package does not publish it.
21.1 - GitHub Terraform
GitHub organization, repository, access, and Pages management
This package consumes the shared repository catalog
through its provider-free Terraform module. The catalog supplies the GitHub
owner, repositories, default branches, repository settings, organization
administrators, and developers. This root supports one GitHub organization per
provider instance and rejects multiple configured owners.
Existing repositories are imported, including forks. The apex site repository
keeps its Pages configuration and custom domain. Published repository names and
Pages domains come directly from the catalog; they are not regenerated from the
current build-project registry.
Dedicated per-project landing repositories were retired: the main site now
publishes every project landing at /projects/<name>/, so the catalog carries
no landing_project key and this root manages no per-project Pages repository,
custom domain, github-pages environment, or landing default branch.
Adoption and access
The checked-in import blocks adopt the organization, existing repositories,
default branches, memberships, developer collaborators, and both existing
src rulesets. A repository with an observed catalog github.id must retain
that numeric identity. An import failure must be resolved before applying;
never remove an import merely to create an existing object again. Repositories,
memberships, access grants, environments, and rulesets have deletion guards.
Review the complete plan and obtain explicit authorization for any deletion
or replacement. Previously authorized retirement may proceed within its exact
reviewed scope.
Organization settings own only catalog-defined repository base permissions.
Billing, profile fields, and other organization defaults remain controlled by
GitHub and are explicitly ignored. The required empty billing_email argument
is an import-only placeholder: the existing billing address is retained from
state and must never be committed or exposed in plan output. Do not create
this organization-settings resource without its import block. Dependabot alert
settings for newly adopted repositories are similarly preserved.
Catalog administrators are organization owners. Developers receive explicit
write access on every catalog repository, while organization base permissions
remain at the catalog setting. The grants are non-authoritative, preserving
other collaborators. Each repository has an active default-branch ruleset
restricting creation, updates, deletion, and force pushes, with an organization
administrator bypass. Developers can push other branches and open pull
requests, but cannot directly push or merge into the default branch. Forks
also disable the upstream fetch-and-merge exception. Catalog repositories
permit merge commits only; squash and rebase merges are disabled, so an
accepted pull request records a merge commit whose parents include the
reviewed feature commit. Both pre-existing src rulesets retain their
separate release-branch protections and bypass actors; the default-branch
ruleset also applies alongside them. Repository rulesets are available for
these public repositories on
GitHub Free.
Publish the main site
The apex site repository receives its built Hugo site from
//projects/alwaldend.com:deploy in the root workspace. Terraform manages the
catalog-defined custom domain and Pages source. Keep all applies limited to
reviewed, authorized repository and Pages changes. DNS is managed by the
owning Terraform root; DNS documentation describes the
workflow. Validate the public custom domain after rollout.
GitHub issues the custom-domain certificate as part of its Pages build. If a
certificate must be reissued, remove the pages block from the apex catalog
record in a reviewed plan, apply it, then restore it in a second plan; GitHub
schedules a new certificate once the custom domain returns. Verify the pushed
revision, Pages build state, DNS, and the served certificate before closing the
recovery.
21.2 - OpenSpec
21.2.1 - Infrastructure GitHub
Purpose
Describe Terraform ownership of the catalog-defined GitHub organization,
repositories, member access, default-branch restrictions, and Pages settings.
These requirements describe source guarantees; they do not assert that a plan
has been applied or that published sites are healthy.
Sources: component documentation,
Terraform workflow,
shared catalog,
packaged inputs,
repository resources,
organization access,
branch rules, and
provider configuration.
Requirements
Requirement: Consume the shared organization and repository catalog
The package SHALL consume organization identity, administrator and developer
lists, repository identity, default branches, repository settings, and Pages
configuration through infra/repos/tf. It SHALL NOT generate a second inventory
from the build-project registry. Its provider instance SHALL require exactly
one configured GitHub organization.
Scenario: Consume a catalog repository
- WHEN the package renders its repository resources
- THEN every catalog GitHub repository is managed from its catalog record
Requirement: Publish project landings from the apex site
Dedicated per-project landing repositories SHALL NOT be managed. The main site
publishes every project landing at /projects/<name>/, so the catalog carries
no landing_project key and no per-project Pages repository, custom domain,
github-pages environment, or landing default branch is declared.
Scenario: Publish a project landing
- WHEN a project’s landing page is published
- THEN it is served by the apex site at
/projects/<name>/ from the apex
Pages repository - AND no per-project repository, Pages configuration, or custom domain is
managed
Requirement: Adopt existing resources without recreating them
The package SHALL provide import blocks for existing organization settings,
repositories, default branches, memberships, developer collaborators, and
the two existing src rulesets. Repositories with observed catalog IDs SHALL
retain those IDs. Managed resources SHALL reject Terraform destruction, and
any deletion or replacement SHALL require explicit user approval before apply.
The organization settings resource SHALL own only catalog-defined base
repository access. Its mandatory billing argument SHALL be an import-only
placeholder whose imported value is ignored; billing, profile, and other
organization defaults SHALL remain outside this module’s ownership. Existing
Dependabot alert settings SHALL be preserved.
Scenario: An existing repository cannot be imported
- WHEN import cannot resolve an observed catalog repository
- THEN the operation fails rather than creating a replacement repository
Requirement: Restrict developers to contribution branches
Catalog administrators SHALL be organization owners. Catalog developers SHALL
receive explicit write access on every GitHub catalog repository through
non-authoritative collaborator resources. Repository default branches SHALL
have active rulesets restricting creation, updates, deletion, and force
pushes, with bypass restricted to organization administrators. The update
restriction SHALL NOT permit fork syncing as a developer bypass. Ruleset
application SHALL follow the managed default-branch selection. The two
pre-existing src rulesets SHALL be imported unchanged, retaining their
rules and bypass actors alongside the new default-branch ruleset.
Scenario: A developer contributes a change
- WHEN a catalog developer writes to a non-protected contribution branch
- THEN repository write access permits the contribution and opening a pull
request
- AND the developer cannot push or merge into the default branch
Scenario: Publish the main site
- WHEN the site publisher writes content to the apex repository’s
pages
branch - THEN repository write access permits publication
- AND its
master default branch remains protected from developer pushes
and merges
Requirement: Keep repository provisioning separate from site and DNS publication
This package SHALL own repository resources and Pages settings. The documented
workflow SHALL use //projects/alwaldend.com:deploy for site content and
//infra/dns for DNS records.
Scenario: Review a site rollout
- WHEN an operator prepares an authorized site rollout
- THEN repository and Pages changes are reviewed in the Terraform workflow
- AND built content publication and DNS changes use their separately owned
workflows
Requirement: Provide an explicit certificate reprovision procedure
GitHub issues the custom-domain certificate as part of its Pages build and
offers no direct reissue action, so the package SHALL document a supported,
separately reviewed way to omit the apex site’s Pages block and then restore
it, forcing a new certificate. The procedure SHALL use two filtered applies
and SHALL include an HTTPS verification step.
Scenario: Reprovision the apex site certificate
- WHEN an authorized apply removes the apex site’s Pages block
- THEN the reviewed plan removes only that configuration
- AND the documented procedure restores it with a later apply
- AND the operator verifies the certificate served for the custom domain
22 - Development hosts
Shared deployment for development and runner hosts
infra/dev owns the existing workstation at dev1.dev.alwaldend.com
(192.168.1.210) and the secure runner at secure1.dev.alwaldend.com
(192.168.10.102).
One Ansible deployment configures both host groups while
preserving their current roles, users, package backends and storage settings.
The secure runner uses the shared host and Forgejo runner roles, with one
self-hosted host-executor slot scoped to alwaldend/src. Jobs run as the
unprivileged forgejo-runner account and share its persistent filesystem;
only trusted code belongs on this worker. The runner’s
managed bazelrc sets each invocation’s job limit
and CPU scheduling budget to HOST_CPUS*0.8, with a memory scheduling budget
of HOST_RAM*0.8. These defaults scale with the detected host resources; they
are scheduling budgets rather than hard process or aggregate host-wide limits.
Ansible installs Node.js, Bazelisk,
AL and the repository Android prerequisites. Its
provisioning root owns the XO VM through the
shared development identity and its own resource set.
The NAS AppRole project owns its
namespace and cache in independent state using the NAS operator identity;
VM provisioning only attaches the
800-GiB disk from the dedicated XO repository. The module owns encrypted storage
and private ACLs. Terraform publishes disk metadata to Vault for automatic
Ansible injection and UUID mounting. The worker requires the mount; action-cache
GC is 700 GiB and Bazel working state remains local. The
rollout record records the
live mount, worker and repeated-action cache verification.
The runner reuses the API-issued identity owned by
infra/forgejo, delivered through
an exact-path Vault read grant for the development deployment. Jobs receive no
deployment credentials. The repository’s
CI workflow runs only on pushes to master:
it checks out the event revision and invokes the local action backed by
tools/ci. The command builds and tests all normal
targets in the root and declared nested Bazel workspaces.
Secure1 jobs use the existing Vault-owned T3 Code HTTP proxy for external
downloads. Ansible injects the selected password into the restricted runner
configuration, without logging it. A loopback socket on port 18080 forwards
HTTP proxy traffic over certificate-verified TLS to
yc1.nodes.threexui.alwaldend.com:40250, supporting Bazel’s Java downloader.
That endpoint uses the yc1 Mullvad balancer.
Both cases of NO_PROXY bypass localhost, alwaldend.com and its subdomains;
private CIDR entries also apply to clients that support them. The proxy is
scoped to jobs; the runner daemon continues contacting the local forge directly.
Ansible installs zip for Android test archive creation. The
2026-11-17 rollout
records the authorized deployment, a no-change rerun, successful upstream
requests and checksum-verified Bazel download, and direct local-forge access.
Dev1 runs Traefik in front of T3 Code and ComfyUI, with mTLS enforced by
public ingress. The host firewall blocks direct external access to the
application ports and accepts new connections only on SSH, HTTP, and HTTPS
ports.
ComfyUI uses comfyui.dev1.dev.alwaldend.com. Site-local
DNS points to dev1; public DNS points to ingress, which forwards HTTPS
through dc1.comfyui.dev1.dev.alwaldend.com with the
service hostname as TLS SNI. Local Traefik uses the Vault certificate resolver
and forwards to 127.0.0.1:8188. Ansible declares the route; the server must
be started separately using the ComfyUI launcher.
The canonical package updater keeps automatic OSTree staging enabled without
automatic reboot. The automatic_updates tag reconciles this policy. The
shared infra/security playbook performs on-demand audits and stages immediate
system updates; activating a staged deployment requires a separately authorized
reboot.
Ansible declares Tuned’s balanced power profile through
dev1_tuned_profile, enables the existing Tuned service, and reconciles
the selected profile in manual mode. The power_profile tag scopes those
tasks. The live setting was applied directly at the user’s explicit request;
no Ansible deployment was run for that initial change.
Ansible and DNS use the dedicated src_infra_dev AppRole. SSH signing is scoped to these hosts and TLS issuance to dev1’s services.
OpenHands has been removed and disabled; deployment neither installs it nor reads
its Vault key. The completed one-time removal tasks are no longer in the playbook.
DNS credential reads cover dc1 and public records.
Provision this identity through Vault Terraform before deploying.
One DNS root consumes the complete dnsconfig.json and uses
the src_infra_dev/tf_backend/dns backend. The authorized handoff adopted all
12 existing records without recreation; the rollout record
records the state boundaries and rollout results.
DNS, Vault and host deployment remain separately authorized operations.
T3 Code controls permissions per thread. Its Auto mode maps to Codex
Auto-review. The managed Codex requirements allow read-only and host-bot
permissions with on-request approvals, so threads cannot select Full
access or disable approvals. The requirements file only allowlists the
host-bot profile; it must not define the profile because T3 Code supplies a
per-thread config layer with the same name, and Codex rejects profiles defined
by both requirements and config. The normal and isolated provider configs
define host-bot with workspace writes, public command-network access, and
write access to the Bazel cache and Bazelisk directories while keeping local
network binding and loopback connections available for Bazel servers. Other
private network targets remain blocked. T3 Code must select that profile for
the thread. Hosted web search is not restricted by this role.
The deployment installs pinned Bazelisk as ~/.local/bin/bazel and AL as
~/.local/bin/al. Run builds and tests with ordinary bazel commands.
The managed user bazelrc supplies bounded,
non-interactive output and failure-focused test reporting directly, so these
defaults also apply in workspaces without a named agent profile. Explicit
command-line options can override them. AL supplies repository lifecycle
commands and the workspace status used by release builds.
Two SATA SSDs, selected by their stable ATA IDs, back the sata_ssd volume
group. Its striped bazel_cache logical volume is mounted persistently at
/var/cache/bazel. Every Bazel workspace uses its disk_cache directory and
the managed user bazelrc points its output-user root at the same filesystem.
The managed user bazelrc also sets repo_contents_cache
to /var/cache/bazel/repo_contents_cache. This requires the live bazelrc to
match that file and the cache directory to exist with its Ansible-defined
ownership and permissions. Eligible materialized external repositories are
then shared across output bases: the first cache miss extracts an archive,
and later worktrees reuse the cached contents instead of repeating extraction. The repository cache still
avoids the network archive download. Automatic garbage collection caps the
action disk cache at 700 GiB, leaving room within the 1-TiB filesystem for
output bases, repository contents, and install state; the volume group retains
about 900 GiB for later growth or another logical volume. Because the volume is
striped, either SSD failing invalidates the disposable cache.
The managed bazelrc sets GO_REPOSITORY_EPHEMERAL_MODCACHE=1. Gazelle 0.53.0
uses a temporary Go module cache for each module fetch and deletes it after
materializing the repository. Pinned, reproducible Go repositories can then
be reused through the shared Bazel repository-contents cache across worktrees.
The variable saves duplicate download-cache space; it does not enable Bazel
cache reuse. A repository-contents cache miss downloads the module again,
including after changes to Gazelle or generation inputs. Gazelle’s default
instead retains module ZIPs within each output base while pruning extracted
module trees. Explicit host module-cache settings take precedence over
ephemeral mode.
The managed user bazelrc limits each Bazel invocation to four concurrent jobs
and budgets one quarter of the host CPUs for local actions. These scheduling limits
apply to builds and tests; they do not impose a combined CPU cap across
independent Bazel processes or Codex sessions.
Executable repository tools use /var/cache/bazel/tool_cache. Unlike the
disposable action and output caches, this directory is private to the host-bot
account. Cache entries are keyed by declared source, build configuration,
platform, and dependency pins, and are installed atomically after a Bazel
build on the first miss.
The arXiv MCP server is pinned to version 0.7.2 and runs locally over stdio.
Its downloaded papers and search data live under
/srv/misc/arxiv-mcp-server/papers on a reusable 100-GiB misc logical
volume in the existing sata_ssd volume group. The volume is mounted for
reconstructible non-executable application data. Data with durability or
different reliability requirements belongs on a separate volume.
The managed Codex configuration allows up to 20 concurrent subagents per
session. The root agent is accounted for separately.
Ansible installs Codex and Grok CLI as the managed user through the official
https://chatgpt.com/codex/install.sh and https://x.ai/cli/install.sh
installers. Both commands are placed in ~/.local/bin. The codex_install
and grok_install tags select only their respective installation tasks;
codex and grok also include them. An existing command skips its installer,
so deployment provisions missing CLIs without upgrading installed versions.
First installation follows the upstream installer’s current release, and
Grok’s installer also provisions its shell integration and completions.
Node.js and npm are provisioned through the development VM role’s mutable or
OSTree package backend. OpenSpec 1.14.2 (@fission-ai/openspec) is installed
without npm lifecycle scripts under the managed user’s ~/.local prefix,
providing ~/.local/bin/openspec. Its exact version is controlled by
openspec_version; the openspec tag selects its prerequisites and installation.
Repository workflows continue to use the repository-pinned Bazel CLI wrapper.
Ansible installs the repository-pinned standalone Forgejo CLI as
~/.local/bin/fj. The fj tag selects only its user-local directory and binary
tasks; reapplication preserves an unchanged executable. On dev1,
bazel run //infra/dev/ansible:fj_install runs those same tasks locally without
SSH or Vault authentication. This target changes only the managed user’s CLI
installation. Native fj authentication is a separate user-authorized operation;
Ansible does not install passwords or API tokens. See the
Forgejo CLI guide.
The workstation’s managed Git configuration uses that native login for
https://forgejo.alwaldend.com/alwaldend/src.git. Its credential helper asks
fj to refresh the login when necessary and reads the matching host entry from
the private credential file used by fj 0.7.0. The git tag selects the Git
configuration and helper installation. Git obtains its credential from the
helper on request.
Open Computer Use 0.3.3 is then installed without npm
lifecycle scripts under the managed user’s ~/.local prefix. Its skill is
then installed for the whole host under /etc/codex/skills from the matching
immutable upstream revision. The deployment configures its stdio MCP server in
the normal Codex config and the isolated OpenRouter and Abliteration homes.
The MCP can inspect and control the logged-in desktop session, so agents must treat its actions as real user input and obtain approval before
externally visible or destructive actions.
The API Codex home is ~/.codex-api. It uses the shared managed Codex
settings and instructions, requires API-key login, and keeps its credentials
and conversation state separate. The codex_api tag selects its configuration.
With OPENAI_API_KEY set in your terminal, log in with:
printenv OPENAI_API_KEY | CODEX_HOME="$HOME/.codex-api" codex login --with-api-key
Start it with CODEX_HOME="$HOME/.codex-api" codex. In T3 Code, set
CODEX_HOME path to /var/home/simeonwarrenbot/.codex-api and start a new thread.
Ansible does not provision or copy API credentials.
OpenRouter is available through its isolated Codex home. Its
configuration reads its API key from the desktop keyring entry selected by
service=openrouter and application=codex; the key is not stored in the
configuration. Repository work uses the repo-owned $codex-migration skill, while
the user-level Codex instructions require isolated migration testing and
intentional host changes to be mirrored into this role. Existing sessions are
not redirected because provider-bound encrypted reasoning history cannot
safely migrate in place.
T3 Code can use OpenRouter as a separate Codex provider by setting its
CODEX_HOME path to /var/home/simeonwarrenbot/.codex-openrouter. That
isolated home defaults to ~deepseek/deepseek-v4-flash-latest and shares no
conversation state with the ChatGPT-backed Codex provider. Start a new thread
when selecting it.
The OpenRouter no-tools home at ~/.codex-openrouter-no-tools mirrors the
OpenRouter provider with every tool surface disabled. It reuses the same
keyring lookup and model, sets web_search = "disabled", turns off the shell,
unified-exec, image, multi-agent, computer-use, browser, app, plugin, and goal
features, and disables the request_user_input tool and the MCP servers.
Codex then advertises no tools at all, so the model can only reply with text.
This matters beyond tidiness: OpenRouter rejects a request that carries any
tools when its routed endpoint supports none, so a single leftover tool fails
the turn.
T3 Code launches the Codex app server with
-c mcp_servers.t3-code.url=..., so its own MCP server would otherwise
reintroduce the MCP resource tools. The no-tools config therefore declares
[mcp_servers.t3-code] with enabled = false, which still wins over that
launch-time override.
Select it in T3 Code with CODEX_HOME path set to
/var/home/simeonwarrenbot/.codex-openrouter-no-tools and start a new thread.
The Abliteration and standard OpenRouter homes keep their tools.
Abliteration uses a separate home with
CODEX_HOME="$HOME/.codex-abliteration" codex, using the endpoint and model from its
Codex integration guide.
It retrieves its API token at runtime with secret-tool, selecting
service=abliteration and application=codex. Save the token from an
interactive terminal in the same user’s desktop keyring:
secret-tool store --label='Abliteration API token for Codex' service abliteration application codex
Enter the token at the hidden prompt. The configuration contains only the
lookup command. Provider response and tool-call validation require a saved
token. Both providers keep their configuration and conversation state outside
the main Codex home; provider profiles in the main home are removed. For
T3 Code, set its CODEX_HOME path to
/var/home/simeonwarrenbot/.codex-abliteration and start a new thread.
T3_MCP_BEARER_TOKEN authenticates the Codex app-server’s loopback MCP
connection to T3 Code at /mcp. Codex excludes it from model-spawned commands
so those subprocesses do not inherit the credential.
Codex terminal session argument limitation
Codex can reject write_stdin before it reaches a running command when a
provider encodes session_id as a whole floating-point number. For example,
{"session_id":96230.0} fails with invalid type: floating point, expected i32,
while {"session_id":96230} parses successfully. Use the actual ID returned by
exec_command; the number above is only an example. Quoting the ID changes it
to a string and is also rejected by the integer parser.
As checked on 2026-11-15, upstream tracks this schema/parser mismatch in
Codex issue #33452.
The installed CLI reported 0.167.0: its
tool schema
advertises session_id as number, but its
terminal resolver
uses strict i32 deserialization. The
0.169.0 resolver
and argument parser
retain that behavior, so upgrading to that release alone does not fix it.
This evidence establishes an argument-parsing defect; it does not establish
that an XML parser caused the numeric conversion.
Retry the terminal-continuation call with the original session ID encoded as a
bare integer, without a decimal point or quotes. If the client keeps converting
it to a float or the session is unavailable, inspect the original process and
resource state before repeating its shell command. An argument error does not
cancel a process already started by exec_command or establish whether its
operation succeeded. For Terraform, confirm that the original operation has
exited before any authorized stale-lock recovery, then use the owning
component’s Terraform workflow. This note records the upstream limitation;
the host does not carry a local parser patch.
Cache cleaning
bazel clean removes the current workspace’s build outputs and
resets its local action cache. Adding --expunge removes that workspace’s
entire output base and stops its Bazel server. Neither operation purges the
shared action disk cache, repository-contents cache, or archive-download cache,
so another worktree can continue reusing them.
With the pinned Bazel 8.7.0, repository-contents garbage collection removes
entries unused for 14 days after the server has been idle for five minutes,
using the defaults of --repo_contents_cache_gc_max_age and
--repo_contents_cache_gc_idle_delay. Routine manual cleanup of that cache
is unnecessary. The action disk cache uses the managed 700-GiB cap described
above. The archive-download cache at
/var/cache/bazel/output_user_root/cache/repos/v1 has no automatic cleanup
configured and requires separate maintenance to reclaim its space. Gazelle’s
ephemeral module download cache is already deleted after each fetch.
Architecture
Development hosts


The Forgejo runner and development machine share deployment configuration under
infra/dev while retaining separate roles. This service overview shows the
runner enabled.
Download the dark WebP diagram.
Repository CI


The runner uses a guest cache disk backed by the NAS through XCP-ng. The
diagram source uses the same light/dark site render as the
development-host diagram. //infra/dev:rendered_ci_svg builds both SVG variants.
Download the dark WebP diagram.
T3 Code


The diagram source is t3code-architecture.mmd,
and the SVG beside this page is rendered from it at build time by
//infra/dev:rendered_svg. Edit the .mmd to update the generated image.
Rendering uses the repository’s pinned Mermaid, headless Chrome, and Liberation
font inputs. The site preset renders native light/dark SVG variants with bordered
caption labels and rounded containers; it does not post-process the generated SVG.
The site selects the variant matching its theme menu. The rendered_historical
target retains the original appearance used by the historical blog publication.
ComfyUI


The HTTP API and CPU generation thread share one ComfyUI process. The public
Z-Image target starts that process inside a transient systemd scope; model
weights and generated PNGs remain on Host Bot.
The source is docs/comfyui-architecture.mmd.
//infra/dev:rendered_comfyui_svg builds the light and dark
documentation assets in the same site style as T3 Code.
Deployment
Follow the playbook guide. The wrapper automatically loads
the provisioned cache metadata from Vault when deploying secure1.
22.1 - Development DNS
This root manages every record in the canonical declarations:
secure1, dev1 and dev1’s services. It uses the shared src_infra_dev AppRole,
DNS-only provider credentials and one Vault HTTP backend:
alwaldend.com/vault1/approles/src_infra_dev/tf_backend/dns.
Validate offline with //infra/dev/dns:tf_tests.fmt_test. Operational entry
points are :tf.plan and interactive :tf.apply.
The authorized deployment adopted seven RouterOS and five Cloudflare records
from the previous owners, preserving their provider identities, then renamed
them in place. Temporary import inputs and backend access targets have been
removed. Both previous states are empty and their access identities have been retired.
Secure1 now uses 192.168.10.102; its VM is owned by the separate tf_setup root.
The rollout record
contains the sanitized handoff evidence. Rollback requires freezing writers
and reconciling state ownership through the shared procedure;
reverting source alone does not restore the previous ownership.
22.2 - Development host deployment
One deployment for both development hosts
bazel run //infra/dev/ansible
bazel run //infra/dev/ansible -- --limit secure1.dev.alwaldend.com
One invocation runs both host-specific plays using the src_infra_dev AppRole.
Workstation storage and services apply only to dev1; secure1 runs the Forgejo
worker and its build prerequisites.
Enable or reconcile only the secure worker and its build prerequisites with:
bazel run //infra/dev/ansible -- --limit secure1.dev.alwaldend.com --tags forgejo_runner
The deployment identity needs its exact-path read grant for the existing worker
record before initial deployment. The runner role preserves existing local
credentials. Proxy configuration additionally needs an exact read of
secrets/alwaldend.com/vault1/approles/src_infra_threexui/http_proxies by
src_infra_dev; the controller injects only the selected t3code password.
Apply the checked-in Vault policy through its owning workflow before deploying
the worker. Proxy credentials remain in the mode-0640 runner configuration;
the systemd transport units contain no credentials. Inspect the service with the
packaged SSH target:
bazel run //infra/dev:ssh.secure1 -- 'systemctl is-active forgejo-runner.service'
The workstation’s managed known_hosts trusts secure1 certificates through the
canonical repository server CA and pins dev1’s public host key. The dev1 key
was verified from its local host filesystem and strict SSH handshake during
the deployment; host-key checking remains enabled through hostname cutover.
Run bazel test //infra/dev/ansible:ansible.syntax for offline validation.
Terraform publishes the cache device and capacity to the development AppRole’s
runner_cache Vault record. The normal wrapper reads it into
DEV_RUNNER_CACHE_METADATA; secure1 group variables decode its device and
size fields. Apply VM provisioning before deployment so this record exists.
No output command or caller-supplied cache arguments are needed. The cache tasks
reject missing/invalid metadata, boot
positions, capacity mismatches, partitions, incompatible filesystems and mounts
used elsewhere before creating ext4 without forcing an overwrite. The filesystem
is mounted by UUID at /var/cache/bazel; the worker requires it before startup.
Ansible has no XO lookup executable, API request or authentication.
The action cache uses its private disk_cache directory with 700-GiB garbage
collection. Bazel output bases remain local. The guest receives no SMB credential
or network-filesystem client. Apply storage and the VM disk in the order in the
provisioning guide. Verify
live encryption, mount identity, write access and a repeated Bazel action only
after separately authorized deployment.
To install or reconcile only the pinned standalone fj binary on the current
dev1 host, run bazel run //infra/dev/ansible:fj_install. It uses the same
packaged playbook’s fj tasks with a local connection and privilege escalation
disabled, independently of the Vault/SSH deployment wrapper. -- --list-tasks
and -- --syntax-check inspect this selection without installing it.
22.3 - OpenSpec
22.3.1 - Specifications
22.3.1.1 - Architecture diagram
22.3.1.1.1 - architecture-diagram Specification
Purpose
Describe the maintained architecture diagram owned by
infra/dev. The diagram replaced the T3code page of the
former central Drawio document. Infrastructure diagrams now live with their
owning projects, with ownerless archived diagrams under infra/archive.
The diagram describes checked-in configuration; it is not a live inventory or
health check.
Requirements
Requirement: Owner-local Mermaid diagram source
The project SHALL keep its architecture diagram as Mermaid source at
t3code-architecture.mmd and SHALL render it through the repository’s
mermaid_svg rule at //infra/dev:rendered. The project
SHALL NOT commit a rendered SVG: //infra/dev:docs_assets
SHALL take its srcs from :rendered so the documentation site publishes the
build output, and the README SHALL reference that published path. The diagram
SHALL use the shared //tools/mermaid:theme.json appearance rather than a
package-local copy.
Scenario: Publish the diagram
- WHEN the documentation site is built
- THEN
:docs_assets packages the SVG produced by :rendered - AND the README image reference resolves to that packaged file
- AND no rendered SVG is tracked in the source tree
- WHEN the render action produces the SVG
- THEN it uses the repository’s pinned Mermaid, headless Chrome, and font
inputs
- AND it loads no stylesheet, script, or font from a CDN
- AND the document embeds the pinned handwriting face, so a viewer that
loads no webfont still lays the labels out at their measured widths
Requirement: Diagram content reflects the deployed topology
The diagram SHALL group the remote actor and the shared Ingress in an
Internet cluster, and SHALL show the remote actor reaching Ingress over
HTTPS with mTLS. It SHALL nest the host-bot cluster inside the local
infrastructure cluster, so the local actor, Vault, and the host’s services
sit inside dc1.alwaldend.com rather than beside it, and the two nested cluster
titles SHALL carry the dc1.alwaldend.com and
dev1.dev.alwaldend.com names respectively. It SHALL group
Traefik, T3 Code, and Codex in the host-bot cluster, SHALL show the local
actor reaching Traefik directly over HTTPS, Ingress forwarding to Traefik
over Wireguard, and Traefik obtaining ACME certificates from Vault. It
SHALL show T3 Code reaching GitHub for source and Codex reaching OpenAI and
OpenRouter for inference, with those providers in a second Internet cluster
because they are off-host. Both actors SHALL be labelled Actor. External
service nodes SHALL carry their own hostnames.
Sources: diagram source and
project documentation.
Scenario: Consult the host-bot architecture
- WHEN a reader opens the architecture section of the project README
- THEN it displays the maintained diagram showing the ingress path, the
in-host services, and the two external service dependencies
Requirement: Legible diagram layout
The diagram SHALL keep node labels short by naming each host once, in the
cluster title that owns it, and SHALL NOT restate a hostname in both a cluster
title and the nodes it contains. Node labels SHALL NOT wrap mid-token. The
diagram SHALL keep subgraph titles clear of node outlines and edges: Mermaid
centers a cluster title on the cluster’s top border, so a title that wraps
extends into the cluster’s node area. The diagram source SHALL describe topology
only and SHALL let the shared theme own appearance and spacing; a per-diagram
directive is warranted only for a specific geometry need the theme cannot
express.
Actors SHALL render as an ordinary rounded node carrying the shared theme’s
hand-drawn stick figure beside the label, rather than as a bare glyph, a pill
outline, or a Mermaid person shape. Mermaid’s person shape draws the head
over the body box, so it is not used.
Sources: diagram source and
theme.
Scenario: Render the maintained layout
- WHEN the renderer draws the diagram
- THEN every node outline is clear of headings, edges, and other nodes
- AND no label is truncated or broken inside a hostname
Requirement: Appearance is owned by the shared theme
Diagram appearance SHALL come from //tools/mermaid:theme.json rather than
package-local copies or per-diagram appearance overrides, so node rounding and
edge-label plates are consistent across every rendered diagram. The theme SHALL
keep shapes semantic, so a rounded bracket node renders rounded while a square
bracket node stays square; rounding SHALL NOT be forced on every node. The
theme SHALL box edge labels by styling the label text, because Mermaid emits an
empty label plate for unlabelled edges and styling that plate directly would
draw a stray box.
Source: theme.
Scenario: Render another diagram with the theme
- WHEN any diagram renders through
mermaid_svg or the mmdc target - THEN a rounded node renders rounded and a square node stays square
- AND its edge labels use bordered plates
Scenario: Read an edge annotation
- WHEN the renderer draws an edge that carries a label
- THEN the label renders on a bordered plate rather than directly on the
edge line
- AND an edge without a label draws no plate
22.3.1.2 - Bazel resource scheduling
22.3.1.2.1 - bazel-resource-scheduling Specification
Purpose
Reduce resource contention from independent Bazel builds on host-bot through conservative per-invocation scheduling defaults.
Requirements
Requirement: Reduced per-invocation scheduling defaults
The managed user Bazel configuration SHALL set four concurrent jobs and a local CPU scheduling budget of HOST_CPUS*0.25 for builds and tests. These defaults SHALL NOT be described as an aggregate host-wide resource cap.
Scenario: Build or test reads the managed defaults
- WHEN a new Bazel build or test invocation loads the managed user configuration without overriding its resource settings
- THEN it receives
--jobs=4 and --local_resources=cpu=HOST_CPUS*0.25
Scenario: Independent workspaces build concurrently
- WHEN separate Bazel servers build in multiple workspaces
- THEN each receives its own scheduling budget, without sharing an aggregate limit
22.3.1.3 - Infra forgejo runner
22.3.1.3.1 - Secure runner infrastructure specification
Purpose
Describe the host-only secure1 baseline under infra/dev. The checked-in source
does not install or register an Actions worker and does not establish live state.
Requirements
Requirement: No legacy Proxmox allocation
The owner SHALL NOT declare runner1/VM 1200, its old DNS entry or its inventory
entry. Secure1 SHALL retain its host-only configuration. Its DNS SHALL belong
to the common dns root without a Proxmox provider or login.
Scenario: Inspect runner allocation
- WHEN the current source is inspected
- THEN no legacy Proxmox allocation or separate tf_setup root remains
- AND secure1 DNS and host configuration remain available
Requirement: Host-only deployment baseline
The secure1 play SHALL apply only the
shared host role to the secure1 inventory group. It SHALL NOT require runner
registration credentials, an Actions instance URL or a runner disk setting.
Scenario: Determine the playbook effect
- WHEN the current playbook is inspected
- THEN only the shared host role is enabled
- AND runner installation and registration remain outside this baseline
22.3.1.4 - Openspec cli
22.3.1.4.1 - openspec-cli Specification
Purpose
Keep Host Bot’s user-facing OpenSpec CLI installation reproducible through its checked-in Ansible deployment.
Requirements
Requirement: Managed OpenSpec CLI installation
Host Bot’s Ansible deployment SHALL install @fission-ai/openspec at an exact
inventory-configured version under the managed user’s ~/.local prefix, with
Node.js and npm provisioned through the existing host package backend.
Repeated deployment with the same version SHALL preserve the installed version.
Scenario: Provision the CLI
- WHEN the Host Bot deployment runs with OpenSpec absent
- THEN it installs the configured version and exposes
~/.local/bin/openspec to the managed user
Scenario: Repeat the deployment
- WHEN the configured OpenSpec version is already installed
- THEN the npm task leaves the package unchanged
22.3.1.5 - Owned dns
22.3.1.5.1 - Development DNS specification
Purpose
Define one DNS deployment for both development hosts and dev1’s services.
Requirements
Requirement: One owner-local DNS root
The dns root SHALL consume the complete canonical dnsconfig.json through the
shared DNS module, preserving all declared views. It SHALL use src_infra_dev
and the alwaldend.com/vault1/approles/src_infra_dev/tf_backend/dns backend.
There SHALL be no separate runner DNS root or record filter.
Scenario: Evaluate the declaration
- WHEN the DNS root is evaluated
- THEN secure1, dev1 and dev1’s service records belong to the same root
- AND provider credentials are injected through the shared owner identity
Requirement: Explicit ownership handoff
The owner SHALL document the pending transfer from both legacy states and
preserve legacy access until separately authorized reconciliation is complete.
Adoption SHALL bind existing DNS records without destructive recreation or
concurrent ownership. Unrelated legacy resources SHALL NOT be transferred or
destroyed by implication. After adoption, unchanged declarations SHALL produce
a no-change plan, and temporary import configuration SHALL be removed.
Scenario: Review source before adoption
- WHEN a maintainer inspects the merged root
- THEN the legacy backend locations and logical-key changes are documented
- AND source validation makes no claim of live ownership or deployment
Requirement: Offline source checks
The package SHALL expose a format check and package both DNS provider binaries,
the canonical declaration and shared module without live authentication.
Scenario: Validate source
- WHEN offline checks run
- THEN they validate packaged source without contacting Vault or DNS providers
22.3.1.6 - Power profile
22.3.1.6.1 - power-profile Specification
Purpose
Keep the host’s selected power profile reproducible through its owning
Ansible configuration while retaining an explicit desired profile.
Requirements
Requirement: Managed host power profile
The host’s Ansible configuration SHALL declare balanced as its desired
Tuned profile. Deployment SHALL enable and start the existing Tuned service
and persist the declared profile with manual selection. Deployment SHALL
avoid reselecting an already-correct profile in manual mode and SHALL
report unexpected profile-query failures.
Scenario: Selected profile differs
- WHEN the active profile differs from the declared profile
- THEN deployment selects and persists the declared profile
Scenario: Automatic selection is enabled
- WHEN the active profile matches but selection is automatic
- THEN deployment persists the declared profile with manual selection
Scenario: No profile is active
- WHEN Tuned reports that no profile is active
- THEN deployment selects the declared profile instead of failing on that expected query result
Scenario: Desired state already matches
- WHEN the active profile matches and selection is manual
- THEN deployment does not repeat the profile-selection command
Scenario: Query fails unexpectedly
- WHEN querying the active profile or selection mode fails unexpectedly
- THEN deployment reports the failure instead of concealing it
22.4 - Secure1 provisioning
This root owns secure1’s Xen Orchestra VM and uses the development AppRole’s
own resource set and Vault backend at src_infra_dev/tf_backend/tf_setup.
Its 500 GiB boot disk, 8 CPUs and 16 GiB RAM match the prior allocation. A separate
800-GiB cache disk uses the Runner cache NAS-backed storage repository.
The NAS AppRole project owns the
namespace and cache in separate state using NAS operator authentication.
This VM root has no TrueNAS provider or NAS credentials;
it consumes the provisioned XO repository and owns the disk attachment.
Appending the disk uses the pinned provider’s in-place update support.
Hostname, address and deterministic MAC derive from the canonical development
DNS declaration. Shared cloud-init installs the Ansible user and guest tools;
Ansible then configures the runner and its UUID-mounted cache filesystem.
Bootstrap the development OIDC identity and apply its resource-set assignment
through infra/xcp_ng before running :tf.apply. The XO session is scoped to
this owner and revoked at exit; no shared administrator token is injected.
For an explicitly authorized recreation, use :tf.apply -- -replace=xenorchestra_vm.secure1
and review its interactive replacement plan before confirming.
The existing private-key injector seeds the initial Ed25519 host key. Cloud-init
is treated as creation-only input, so subsequent invocations do not rotate the
VM key. Its private material stays in the Vault-protected Terraform state and
VM bootstrap configuration; temporary injector files are removed at shutdown.
The public ssh_host_public_key output establishes strict controller trust
before Ansible signs the permanent host certificate. No SSH checks are disabled.
Initial cache provisioning
After separate authorization, apply Vault groups/grants, then the complete
//infra/nas/truenas:tf.apply root for accounts and shared settings. Apply
//infra/nas/approles/src_infra_dev:tf.apply for its namespace and runner cache
dataset/share/ACLs. Then apply //infra/xcp_ng/tf:tf.apply
to create and delegate the storage repository, and //infra/dev/tf_setup:tf.apply
to attach the cache disk. Each stage uses its own state.
For the initial disk attachment, Xen Orchestra provider 0.41.0 leaves the new
disk’s position null during planning. Initialize the VM disk first, then apply
the complete root to publish its observed device:
bazel run //infra/dev/tf_setup:tf.apply -- -target=xenorchestra_vm.secure1
bazel run //infra/dev/tf_setup:tf.apply
Review both interactive plans. Subsequent complete applies use the existing
attachment position and need no target selection.
The complete VM apply publishes the attached cache device and capacity to
secrets/alwaldend.com/vault1/approles/src_infra_dev/runner_cache, using the
existing development AppRole permissions. Terraform owns this generated record;
do not edit its values manually. The normal Ansible wrapper loads it from Vault,
so deployment requires no Terraform output command or extra-vars handoff.
See the playbook guide. The
rollout record records the
attached disk, saved metadata and no-change full plan.
23 - Nas
TrueNAS pools, datasets, and storage namespaces
The DNS Terraform package manages this owner’s DNS records through
its dedicated Vault AppRole. The separate TrueNAS root
manages the existing pool, filesystem datasets, and Nextcloud lifecycle
metadata with its own state. Existing NAS resources are
adopted through that root; appliance installation remains outside these roots.
Namespaces and child datasets are managed independently by AppRole under
approles/, with separate state and plan/apply targets.
Architecture
This diagram describes the maintained architecture source, not live inventory or service health.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Links
23.1 - AppRole storage projects
Each <approle>/ directory is a standalone Terraform root with its own state,
plan/apply targets and fixed namespace under default/encrypted/approles.
It owns the namespace, ACLs, shares and child datasets through the shared
dataset module.
No parent input or remote-state dependency is needed.
The shared NAS root owns accounts, the encrypted parent
and appliance-wide settings. It does not load AppRole projects. Group membership
creates an account; a namespace is created when its storage project is applied.
Add another project only when declaring that AppRole’s storage.
Projects use the NAS operator identity, the shared connection injector and a
separate backend under that identity’s tf_backend/approles/<approle> path.
This separates state and lifecycle; it does not restrict TrueNAS administrator
API permissions to a dataset path. The consumer AppRole receives only its own
NAS account credential, not the provisioning key.
Apply the shared NAS prerequisites first, then the selected AppRole storage
project. The development project owns its namespace
and runner cache. VM provisioning consumes the resulting Xen Orchestra storage
repository through its own development identity.
23.1.1 - Development NAS storage
This standalone Terraform root owns default/encrypted/approles/src_infra_dev,
its private namespace share and the runner cache dataset/share. The namespace
permits XCP-ng to traverse to the cache without connecting to the namespace
share. The cache grants XCP-ng MODIFY access and limits SMB clients to its host.
The reusable dataset module owns encryption inheritance and private ACL defaults.
The cache share is named src_infra_dev_runner_cache: SMB names are NAS-wide,
and TrueNAS forbids slashes in them.
The root has its own HTTP state backend at
alwaldend.com/vault1/approles/src_infra_nas/tf_backend/approles/src_infra_dev.
It authenticates as the existing NAS operator and reuses the shared NAS API
connection. Its tf=approle_src_infra_dev selection chooses this backend;
truenas selects the connection injector. The development AppRole does not gain
NAS administrator credentials. There are no Terraform input variables or
remote-state reads, and the shared NAS root does not load this project.
Operation order
Under separately authorized live scope:
- Apply Vault NAS groups/grants, then
//infra/nas/truenas:tf.apply for accounts,
the shared encrypted parent and mandatory SMB encryption. Unlock the parent. - Review/apply
//infra/nas/approles/src_infra_dev:tf.plan/tf.apply for this
namespace and cache. - Apply
//infra/xcp_ng/tf:tf.apply for the storage repository, then the runner
VM root and Ansible for disk attachment and mounting.
Run the named targets through bazel run. Each NAS apply covers its complete root;
other AppRole states are outside this project. Follow the
VM provisioning guide for initial disk attachment.
Formatting and offline provider validation use :tf_tests.fmt_test and
:tf_tests.validate_test.
The authorized rollout
created this namespace/cache and its ACLs/shares in this independent state. Its
subsequent plan has no changes. If an earlier shared-state revision was applied
elsewhere, reconcile its ownership before applying either root; preserve existing data.
23.2 - DNS Terraform
This root packages the owner’s canonical DNS declarations
through the shared DNS module and keeps state in the owner AppRole’s Vault HTTP
backend. The root contains DNS resources only. dns_enabled defaults to true
after verified adoption. Keep it enabled to retain existing records; disabling
it would propose deletion.
The DNS migration procedure owns credential provisioning,
reconciliation, and recovery. The adoption record
contains import and verification evidence. Use the //infra/nas/dns:tf wrappers
for operational commands and //infra/nas/dns:tf_tests.fmt_test for offline
source validation.
Operational Terraform calls require the DNS AppRole policy grants and credential
fields described by the migration procedure. Provider configuration and
authentication require real credentials and live access.
23.3 - OpenSpec
23.3.1 - Specifications
23.3.1.1 - Infra nas
23.3.1.1.1 - NAS infrastructure Specification
Purpose
Describe the TrueNAS-related configuration surface currently owned by
infra/nas. The baseline is checked-in source at revision
550d7e79b1f5fdbc2b6017b75178471d6914082f, observed on 2026-09-08.
The directory contains an AL configuration, DNS declarations, Vault wrappers,
and brief documentation. It does not contain a TrueNAS provisioning playbook
or Terraform configuration, and this baseline makes no claim about live NAS
configuration or availability.
Source baseline limitation: the owning BUILD file restricts the AL target’s
visibility to //infra/harvester:__subpackages__, although infra/harvester
does not exist in this revision. This declaration does not establish a working
consumer integration.
Requirements
Requirement: Scoped NAS configuration packaging
The project SHALL declare its AL configuration through //infra/nas:al.
That configuration SHALL depend on the shared //infra:al configuration.
The project’s Vault command map SHALL use its own AL target.
Sources: project description and
configuration and command targets.
Scenario: Inspect the NAS configuration and Vault packaging
- WHEN a maintainer inspects the NAS target declarations
- THEN the AL target includes
al.lua and the shared infrastructure AL dependency - AND the Vault command map references that NAS AL target
Requirement: Distinct local and global cloud DNS destinations
The NAS DNS declaration SHALL expose the NAS host and root names as A records,
and SHALL distinguish the DC1 and global cloud aliases. The DC1 cloud alias
SHALL target nas.alwaldend.com., while the global alias SHALL target
ingress.alwaldend.com.. The DNS filegroup SHALL remain visible only within
the infrastructure tree.
Sources: DNS declarations and
DNS target visibility.
Scenario: Consume DNS declarations for different views
- WHEN a DNS consumer selects the entries tagged
dc1 and global - THEN it receives the NAS destination for the DC1
cloud alias and the
ingress destination for the global cloud alias.
23.3.1.2 - Owned dns
23.3.1.2.1 - owned-dns Specification
Purpose
Define NAS DNS management through the owner’s tf root,
including canonical declarations, scoped credentials, and offline source checks
before adopting live records.
Requirements
Requirement: Owner-local DNS configuration
The tf root SHALL consume this owner’s canonical dnsconfig.json through
the shared DNS Terraform module, preserving declared record identities and views.
DNS resources SHALL default to disabled until the authorized adoption revision
and SHALL retain enabled ownership after existing records are imported into the
owner’s state. Reconciliation against unchanged declarations and adopted state
SHALL propose no record additions, changes, replacements, or deletions.
Scenario: Inspect the preparatory configuration
- WHEN the checked-in root is evaluated with default inputs before its
authorized adoption revision
- THEN it reads this owner’s declaration and disables managed DNS records
- AND the package contains the module and declaration inputs
Scenario: Adopt existing DNS records
- WHEN the authorized adoption freezes the old central writers and enables
the owner’s record management
- THEN the owning root imports existing records by exact provider ID into
its state while preserving their declared identities and views
Scenario: Inspect adopted source defaults
- WHEN the adopted root uses its checked-in source defaults
- THEN DNS ownership remains enabled and the package retains the module
and canonical declaration inputs
Scenario: Reconcile existing DNS records
- WHEN the owning root plans against its adopted state and unchanged declarations
- THEN it proposes no record additions, changes, replacements, or deletions
Requirement: Scoped DNS execution and offline checks
The DNS wrapper SHALL select src_infra_nas through the repository AL flow and keep
secret values in injected variables. DNS injection SHALL select the root’s existing
Terraform stage label. Real DNS credentials and Vault policy grants SHALL be
prerequisites for operational Terraform calls. RouterOS DNS credentials SHALL be isolated
from unrelated RouterOS resources. The package SHALL expose a format test that
does not authenticate to Vault or contact DNS providers.
- WHEN the package format test executes
- THEN it checks the packaged Terraform configuration without live credentials
- AND existing non-DNS authentication and backend paths remain unchanged
- WHEN the wrapper selects its Terraform stage labels
- THEN it selects DNS credential injection through the owner AppRole
- AND disabled DNS resources do not imply offline provider configuration
23.4 - TrueNAS
This root preserves the adopted default RAIDZ2 pool, seven datasets and
Nextcloud lifecycle settings. Existing imported addresses remain unchanged.
Settings are inline HCL; there is no JSON configuration interface.
This root owns the encrypted default/encrypted/approles parent and one account
for each entity member of Vault’s
truenas_admins and truenas_user groups. Vault owns membership: the NAS AppRole
is an administrator, and the user group projects the other canonical AppRoles.
The shared parent permits traversal without listing. NAS groups mirror Vault membership. Only truenas_admins grants the FULL_ADMIN
privilege. Ordinary accounts have no administrative privilege; no account gets
SSH login, web shell or sudo rights. Long account names are
shortened deterministically; namespace and share names retain the full AppRole.
SMB transport encryption is mandatory.
The reusable dataset module
owns filesystem defaults, private ACLs and optional DEFAULT_SHARE exports. This
root does not load the AppRole storage projects.
Each project owns its namespace, ACLs, shares and child datasets in its own
Terraform state, with independent plan/apply targets. The development project
owns the runner cache. Namespaces are created by their project’s apply, not
account provisioning. VM provisioning consumes the XO repository and does not
authenticate to TrueNAS.
64-character passwords are generated by the pinned random provider and retained only in
Vault-backed state and Vault KV. NAS publishes each account at
secrets/alwaldend.com/vault1/shared/read/approle/<approle>/nas. Existing shared-read
policies let each AppRole read its own account. XCP-ng reads its own account for
the cache connection; the development NAS project owns its traversal and MODIFY
grants. Coordinate password rotation with
clients. Increment nas_password_version to regenerate passwords and update
TrueNAS together; the same version drives password keepers and the write-only
rotation trigger.
The existing NAS API credential comes from its Vault truenas entry. State uses
tf_backend/truenas, separate from DNS. The provider is pinned to 1.9.3; TLS
verification is enabled. API roles are method-based and do not enforce dataset
path restrictions. Both shared and AppRole storage roots use NAS’s administrator
identity; namespace accounts do not receive that credential. AppRole state uses
distinct backend paths and does not depend on this root’s state outputs.
Apply the Vault NAS access groups, account-publisher and lookup grants before
planning this root.
Unlock the encrypted root before provisioning namespaces or mounting shares.
The authorized rollout
provisioned the accounts and shared settings; the subsequent plan has no changes.
bazel run //infra/nas/truenas:tf.plan
bazel test //infra/nas/truenas:tf_tests.fmt_test //infra/nas/truenas:tf_tests.validate_test
24 - ingress
Traefik ingress and backend routing for public services
Architecture
This diagram describes the maintained architecture source, not live inventory or service health.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Run ansible
bazel run //infra/ingress/ansible
Services in traefik_services must use a backend target that resolves from
the ingress hosts without resolving back to ingress. Define a dedicated
site-local address, conventionally prefixed with dc1., in the owning
service’s DNS configuration and use that address as the target.
bazel run //infra/ingress/tf
Update signed image url
Recreate VMs
bazel run infra/ingress/tf -- -replace 'yandex_compute_disk.vpc["*"]'
Regenerate wireguard keys
- Regenerate private and public keys:
wg genkey | tee host1.privatekey.txt | wg pubkey >host1.publickey.txt
wg genkey | tee host2.privatekey.txt | wg pubkey >host2.publickey.txt
wg genkey | tee router.privatekey.txt | wg pubkey >router.publickey.txt
cat - >data.json <<EOF
{
"wg_public_keys": {
"host1": "$(cat host1.publickey.txt)",
"host2": "$(cat host2.publickey.txt)",
"router": "$(cat router.publickey.txt)"
},
"wg_private_keys": {
"host1": "$(cat host1.privatekey.txt)",
"host2": "$(cat host2.privatekey.txt)",
"router": "$(cat router.privatekey.txt)"
},
"wg_preshared_keys": {
"host1": "$(openssl rand 32 | base64)",
"host2": "$(openssl rand 32 | base64)"
}
}
EOF
bazel run infra/ingress:vault.kv_put -- -format json alwaldend.com/vault1/approles/src_infra_ingress/wireguard "@${PWD}/data.json"
rm data.json *.privatekey.txt *.publickey.txt
24.1 - Ansible
Ansible setup
24.2 - Ingress DNS
Owner-local DNS Terraform
This root manages the records in dnsconfig.json using
//infra/ingress/dns:tf.<operation>. Follow the
shared transfer procedure
before operating this root.
24.3 - OpenSpec
24.3.1 - Specifications
24.3.1.1 - Infra ingress
24.3.1.1.1 - Infrastructure ingress
Purpose
Describe Yandex Cloud ingress provisioning, the RouterOS WireGuard connection,
and the Ansible-managed Traefik configuration. The baseline covers checked-in
desired state, not a live routing or availability observation.
Baseline source revision: 550d7e79b1f5fdbc2b6017b75178471d6914082f.
Observation date: 2026-09-08. Sources are linked in full; no excerpts are used.
Sources: component contract,
VM resources,
WireGuard resources,
deployment playbook,
Traefik entry points, and
Traefik routes.
Requirements
Requirement: Provision ingress hosts from the declared host map
Terraform SHALL create addresses, encrypted boot disks, and instances for the
active local.vpc entries, using the shared cloud-init source. The baseline
active map SHALL contain host1 in ru-central1-d; the commented host2 entry
SHALL NOT be treated as an enabled resource declaration.
Scenario: Evaluate the baseline host configuration
- WHEN the checked-in ingress Terraform configuration is evaluated
- THEN instance resources are declared for
host1 - AND its boot disk references the declared KMS symmetric key
- AND instance metadata includes the shared cloud-init content
Requirement: Connect declared hosts through WireGuard
The RouterOS configuration SHALL declare the ingress-vpc interface and a peer
for each active ingress host. Peer endpoints SHALL use the corresponding cloud
address, and allowed addresses SHALL come from the Ansible inventory’s wg_ip.
- WHEN an ingress host is present in the active Terraform host map
- THEN its WireGuard peer uses the host’s declared public and preshared key
variables and inventory address
- AND the interface belongs to the configured LAN, forwarding, and ICMP lists
Requirement: Route to backend addresses that do not return to ingress
Each traefik_services backend target MUST resolve from the ingress hosts
without resolving back to ingress. The service owner SHALL declare the dedicated
site-local address. Generated HTTPS backend transports SHALL use the service
hostname as TLS server name.
Scenario: Add a service behind ingress
- WHEN a service is added to
traefik_services - THEN its host route forwards to
https:// followed by its backend target - AND that target is a dedicated site-local address defined by the service
owner
- AND backend TLS uses the service’s configured hostname
Requirement: Deploy Traefik with HTTPS and client-certificate authentication
The ingress playbook SHALL apply the host, WireGuard, and Traefik roles. The
Traefik templates SHALL redirect the web entry point to HTTPS and configure
default TLS client authentication as RequireAndVerifyClientCert using the
configured client CA file.
Scenario: Render the ingress TLS configuration
- WHEN the Ansible role renders the checked-in Traefik templates
- THEN port 80 redirects to the secure entry point
- AND the default TLS options require a certificate verified against the
configured client CA
24.4 - Tf
Terraform config
This stage manages ingress service infrastructure.
Manage records through the dedicated DNS root.
25 - threexui
3x-ui control plane and Xray proxy nodes
Architecture
The architecture source is one diagram with three separate
sections: overview, control plane, and data plane. It describes maintained
architecture, not live inventory or service health. Bazel renders light and dark SVGs.
The overview shows Master in the Control Plane hierarchy and full node hostnames
in provider groups, with Vault, Let’s Encrypt, and Mullvad as external services.
Overview links attach to the Control Plane and Data plane boundaries.
The control-plane section expands the 3x-ui VM’s Traefik and panel with one simple
data-plane node. The data-plane section expands one node’s Traefik, 3x-ui, and Xray
with one simple control-plane endpoint. Both njalla1 and yc1 share this implementation.


Nodes
The data-plane node njalla1 is hosted by njal.la. Yandex Cloud hosts yc1.
Terraform configures both through the shared node module, and Ansible
installs their services.
Links
Fetch and fix subs for a particular subscription id
bazel run //infra/threexui:fix_subs -- --hosts njalla1.nodes.threexui.alwaldend.com,yc1.nodes.threexui.alwaldend.com --sub_id subid
Fix subs from a local file
bazel run //infra/threexui:fix_subs -- --sub_file path_to_file
25.1 - 3x-ui DNS
Owner-local DNS Terraform
This root manages the records in dnsconfig.json using
//infra/threexui/dns:tf.<operation>. Follow the
shared transfer procedure
before operating this root.
25.2 - Ansible
Ansible setup
25.3 - OpenSpec
25.3.1 - Specifications
25.3.1.1 - Infra threexui
25.3.1.1.1 - Infrastructure 3x-ui
Purpose
Describe 3x-ui provisioning, host deployment, node routing configuration, and
the subscription URL transformer. This baseline describes checked-in source,
not verified live node access. The advertised host-only subscription command
has a source limitation: sub/main.go also attempts to read sub_file when it
is empty, so successful host-only operation is not a baseline guarantee.
Baseline source revision: 550d7e79b1f5fdbc2b6017b75178471d6914082f.
Observation date: 2026-09-08. Sources are linked in full; no excerpts are used.
Sources: component documentation,
root wrappers,
provisioning package,
configuration package,
host playbook,
Traefik routes,
node definitions,
node inbounds,
node routing, and
subscription transformer.
Requirements
Requirement: Separate provisioning, deployment, and service configuration
The package SHALL keep infrastructure creation in tf_setup, host deployment
in Ansible, and 3x-ui API resources in tf. The deployment playbook SHALL apply
host, Traefik, and 3x-ui roles to the control-plane and data-plane inventory
groups.
Scenario: Select a 3x-ui workflow
- WHEN an authorized operator selects the setup or main Terraform wrapper
- THEN its AL plugin selects the corresponding Terraform stage
- AND the Ansible playbook remains the owner of host and service installation
Requirement: Terminate proxy traffic at the declared local services
The Traefik route template SHALL forward the panel to loopback port 2053 and
subscription requests to loopback port 2096. It SHALL define HTTP inbound routes
for ports 40000 through 40149 and TCP inbound routes for ports 40150 through
40299, forwarding to corresponding loopback ports.
Scenario: Render a subscription route
- WHEN the checked-in dynamic Traefik template is rendered
- THEN requests matching the configured subscription path prefix route to
http://127.0.0.1:2096 - AND the router selects the configured TLS certificate resolver
Requirement: Declare explicit node and outbound routing relationships
Terraform SHALL configure the njalla1 and yc1 nodes through the shared node
module. The node routing declaration SHALL block the advertising category and
private IP destinations before routing the freedom inbound directly and each
mullvad_min or http_proxy inbound through its named WireGuard outbound.
The enabled mullvad_min_lb inbound has no active dedicated balancing rule;
commented balancing rules SHALL NOT be treated as enabled routing behavior.
- WHEN a node’s selected relay creates a Mullvad inbound
- THEN the inbound listens on loopback
- AND its routing rule selects the matching
out-mullvad-min- outbound tag - AND the node declaration supplies its own relay selection to the module
For readable local subscription files, the transformer SHALL ignore blank and
comment lines, parse each remaining URL, set security=tls and sni to the URL
hostname, sort URLs by fragment, and write one URL per output line. It SHALL
return a nonzero exit status when input reading or URL parsing fails.
- WHEN
fix_subs receives a readable --sub_file containing subscription URLs - THEN output URL queries contain
security=tls and the matching hostname SNI - AND output is ordered by URL fragment with blank and comment lines omitted
25.4 - sub
Fetch subscriptions and fix them
25.5 - Tf
Terraform config
25.6 - Tf setup
Terraform setup
This stage provisions 3x-ui and reads network settings from dnsconfig.json.
Manage records through the dedicated DNS root.
26 - Ceph
Ceph storage configuration and CRUSH map maintenance for Proxmox
Links
See current crush map
Go to Nodes -> Host -> Ceph -> Configuration
Crush map update
Ssh to the PVE host and update the map:
sudo ceph osd getcrushmap -o crushmap.cm
sudo crushtool --decompile crushmap.cm -o crushmap.txt
sudo vim crushmap.txt
sudo crushtool --compile crushmap.txt -o new_crushmap.cm
sudo ceph osd setcrushmap -i new_crushmap.cm
sudo ceph -s
26.1 - OpenSpec
26.1.1 - Ceph infrastructure specification
Purpose
Describe the single-host Ceph CRUSH map maintained by infra/ceph and its
documented operator workflow. This owner contains a map and documentation;
its BUILD file exposes documentation, not a Ceph deployment target. The
baseline describes checked-in source, not an observed running cluster.
Baseline revision: 550d7e79b1f5fdbc2b6017b75178471d6914082f.
Observed: 2026-09-08. Sources: owner README,
BUILD, and
CRUSH map.
Requirements
Requirement: Single-host CRUSH topology
The maintained CRUSH map SHALL place four HDD devices, osd.0 through
osd.3, in the host1 bucket beneath the default root, using the declared
device weights and straw2 bucket algorithm.
Scenario: Inspect the recorded storage topology
- WHEN a maintainer reads the checked-in CRUSH map
- THEN all four OSDs belong to
host1, and the default root contains
that host - AND this topology establishes a single-host placement baseline without
asserting that the running cluster matches it
Requirement: OSD-level replicated and erasure placement
The maintained map SHALL define a replicated rule using
chooseleaf firstn 0 type osd and an erasure rule using
chooseleaf indep 0 type osd beneath the default root. The erasure rule
SHALL set chooseleaf attempts to 5 and choose attempts to 100.
Scenario: Inspect the placement failure domain
- WHEN a maintainer evaluates
replicated_rule or ceph-ec-data - THEN placement selects OSDs within the recorded topology
- AND the map provides no requirement for replica separation across hosts
Requirement: Operator workflow documentation
The owner documentation SHALL describe exporting, decompiling, editing,
compiling, and installing a CRUSH map followed by a Ceph status check.
Executing that workflow MUST remain subject to the repository’s explicit
infrastructure-operation authorization requirement.
Scenario: Use the documented map update procedure
- WHEN an authorized operator follows the map update instructions
- THEN the procedure obtains the current map before creating its compiled
replacement and checks
ceph -s after installation - AND the presence of these instructions alone does not authorize a
live map update
27 - flux
Flux cluster bootstrap and workload deployment


The three Vault nodes show the same service from different network paths.
Vertical network diagram ·
Interactive 3D network diagram
Views with one Vault node are available in
horizontal,
vertical, and
interactive 3D layouts.
- DNS manages the Flux host and Operator ingress records.
- AppRole manages the Vault identity used for DNS, Xen
Orchestra login, SSH certificates, and Terraform state.
Provision the XCP-ng VM, then run the
K3s bootstrap. Apply the separate
Terraform workload root to install the Flux Operator and
FluxInstance. Follow the Operator ingress runbook
to make the UI available.
27.1 - Flux DNS
Owner-local DNS Terraform
This root manages the records in dnsconfig.json using
//infra/flux/dns:tf.<operation>. Follow the
shared transfer procedure
before operating this root.
27.2 - Flux K3s bootstrap
After provisioning the VM, wait for cloud-init and verify the initial SSH host
key out of band. Run bazel run //infra/flux/ansible. AL uses the Flux AppRole
to obtain a short-lived Vault-signed SSH client certificate for the ansible
user, which cloud-init configures on the guest. Ansible installs a Vault-signed
host certificate during bootstrap.
The shared K3s role installs the repository-pinned binary and writes the server
configuration. The API server trusts the existing Flux Vault OIDC issuer.
The only project manifest in the auto-deploy directory grants Kubernetes
cluster administration to the Vault group src_infra_flux_admins, which
includes the deployment AppRole. Terraform uses that grant to install charts
with cluster-scoped resources.
After K3s starts, the shared role publishes the public API server CA at the
Vault path configured by Flux. It updates that entry if the CA has changed.
The host firewall accepts SSH and lets cluster pods reach the API. Vault can
reach TCP 6443 from its private address for TokenReview. The DC1 management and workload LANs and shared ingress peers can connect
to TCP 443 on the VM.
The Terraform workload root opens its SSH forward
automatically and authenticates with a Vault OIDC token.
HTTPS socket
The normal Flux playbook enables the HTTPS socket. On an existing VM with
Traefik listening on TCP 443, apply the workload root before running the
playbook so Traefik releases the port. Systemd listens on
TCP 443 and starts its TCP proxy on demand. Traefik terminates TLS on
loopback TCP 8443. The host firewall checks the original source address.
Traefik sees the proxy’s loopback address.
The socket role installs the SELinux policy that lets the systemd proxy
bind and connect to the HTTP port type used by TCP 443 and 8443.
27.3 - Flux Vault AppRole
This Terraform root manages the Flux AppRoles, their DNS and SSH signing
policies, and the Flux PKI, OIDC, and SOPS Transit configuration. Shared Vault
manages the mounts and cross-component memberships, including the Forgejo and
Harbor grants. The DNS root authenticates with the
src_infra_flux AppRole and uses a separate state backend.
Review changes with //infra/flux/approle:tf.plan. The
state transfer record
describes the completed migration from shared Vault state.
27.4 - Flux workloads
Terraform installs the Flux Operator using the mirrored Forgejo chart and
image, then applies the FluxInstance after the operator is ready. The instance
uses the distribution embedded in the operator and pulls controller images
from Forgejo. The chart and images support anonymous reads.
The workload root also installs cert-manager with its CRDs and Traefik with
a non-root loopback HTTPS listener on the VM. Both pull their pinned charts
and images from Forgejo. Publish the cert-manager
and Traefik mirrors before
applying the root.
After bootstrapping K3s, run Terraform from any
host that can reach the VM’s SSH port. AL obtains a Vault-signed SSH client
certificate, verifies the VM’s SSH host certificate, and opens the API
forward on a private loopback port for the invocation. AL also fetches the
Kubernetes server CA and a Vault OIDC ID token for Helm. The K3s bootstrap
binding grants the Flux AppRole cluster administration through its Vault group.
bazel run //infra/flux/tf:tf.plan
bazel run //infra/flux/tf:tf.apply
Helm waits for the operator deployment. FluxInstance reconciliation continues
after the Helm release completes. Bump the local instance chart version
when changing its template so Terraform plans a Helm upgrade.
Operator ingress
Open https://operator.flux.alwaldend.com and sign in with Vault OIDC.
On the DC1 management and workload LANs, DNS points directly to the Flux VM
and browsers need to trust the Vault server CA. Outside those LANs, use
shared ingress with a trusted client certificate.
The Flux user group receives the Kubernetes view role.
For the initial rollout, apply the Flux AppRole root
before running the K3s playbook. Then apply the workload
root. cert-manager uses a short-lived Flux service account token to renew the
backend certificate through Vault, which validates the token over the private
network. The workload plan needs the Vault OIDC client and the public API CA,
both supplied by AL. After the workload apply, activate the
host HTTPS socket. When migrating the
existing listener, TCP 443 is briefly unavailable between those stages.
Before applying shared ingress, apply the
Flux DNS root and verify that the flux-operator issuer and
flux-operator-tls certificate are ready in flux-system. Shared ingress
connects to dc1.operator.flux.alwaldend.com over WireGuard, with TLS
verification for the public hostname.
27.5 - Flux XCP-ng VM
This root provisions the Fedora VM and its disks on XCP-ng through Xen
Orchestra. It reads the host address from Flux DNS.
The src_infra_flux Vault AppRole signs in to Xen Orchestra through Vault
OIDC. AL injects the invocation-scoped XO token and revokes it on normal
shutdown. Flux can provision within its assigned resource set. The state
backend uses the same AppRole and the dedicated tf_backend/xcp_ng_setup
path.
Before the first provisioning run, synchronize the AppRole’s XO identity if
needed, then reconcile the src_infra_flux resource set using the
Xen Orchestra workflow.
XO_BOOTSTRAP_APPROLE=src_infra_flux bazel run //infra/xcp_ng/cmd/xo_login:bootstrap
bazel run //infra/xcp_ng/tf:tf.plan
bazel run //infra/xcp_ng/tf:tf.apply
Review the Flux VM plan before applying it.
bazel run //infra/flux/tf_setup:tf_setup.plan
bazel run //infra/flux/tf_setup:tf_setup.apply
27.6 - OpenSpec
27.6.1 - Specifications
27.6.1.1 - Infra flux
27.6.1.1.1 - Flux infrastructure specification
Purpose
Define the Flux DNS, Vault identities, minimal K3s bootstrap, and Terraform
workload configuration.
Requirements
Requirement: Standalone Flux DNS management
The Flux infrastructure project SHALL expose its site-local DNS declarations
through a standalone Terraform package authenticated with the existing
src_infra_flux Vault AppRole and its dedicated DNS state backend. The
project SHALL manage the Flux-specific AppRoles, policies, identity groups,
PKI, OIDC, and Transit configuration from a separate local root.
Scenario: Select the Flux DNS package
- WHEN a maintainer selects the Flux DNS Terraform package
- THEN it consumes the existing Flux DNS declaration and uses the
component AppRole and DNS backend
- AND no Flux VM, host deployment, or cluster reconciliation package
is required
Scenario: Reconcile a shared grant
- WHEN shared Vault reconciles a Forgejo, Harbor, or global grant for Flux
- THEN it resolves the Flux identities by their Vault names
- AND the Flux AppRole root owns the identities and component policies
Requirement: Flux VM provisioning
Flux SHALL provision its guest through Xen Orchestra with an invocation-scoped
session issued for the Flux Vault AppRole.
Scenario: Provision the guest
- WHEN an operator applies the VM root
- THEN the provider uses the Flux resource set and resolves the guest address from the Flux DNS declaration
Requirement: Minimal K3s bootstrap
Flux SHALL bootstrap a K3s host with the repository-pinned binary and
configure Vault OIDC for the API. The K3s auto-deploy directory SHALL
contain only the project RBAC binding that authorizes Terraform to
administer the cluster.
- WHEN an operator runs the Flux bootstrap playbook
- THEN it installs K3s from the packaged binary and binds the Flux Vault administrator group
Terraform SHALL manage the Flux Operator and FluxInstance as ordered releases
using a dedicated state backend.
Scenario: Deploy to a bootstrapped cluster
- WHEN an operator applies the workload root
- THEN Terraform installs the mirrored operator and its CRDs before submitting the FluxInstance
- AND the launcher opens its SSH tunnel and supplies the Vault OIDC token and server CA
- AND the instance selects the mirrored Flux controller images
Flux SHALL install Traefik and cert-manager as Terraform-managed Helm releases
using pinned charts and images mirrored in Forgejo.
Scenario: Apply the workload root
- WHEN an operator applies the workload Terraform root
- THEN Terraform installs Traefik with a cluster-local Service and cert-manager with its CRDs
28 - forgejo
Self-hosted Git forge, CI runners, and repository mirrors
Architecture
Forgejo runs on an XCP-ng VM behind Traefik. Local Git links redirect to the
canonical Forgejo hostname; public Git links redirect through the download
server to GitHub. The two local Traefik nodes represent routes in the same proxy.
Public Forgejo access passes through the ingress server, which requires a client
certificate and opens a separate HTTPS connection to the service proxy.
See Deployment for DNS, provisioning, and service configuration.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Links
Repository configuration
Service Terraform consumes the shared repository catalog
for organization-owned repositories and named administrator/developer roles.
Vault continues to own OIDC login identities and service-specific access.
See service Terraform for identity validation, state adoption,
and the preserved automation grants.
Push mirroring
Terraform reads each repository’s mirror settings and bootstraps the native
Forgejo mirrors with destination credentials from Vault. Forgejo pushes the
default branch, weekly release branches, tags, and LFS objects to GitHub and
GitLab on commits and every eight hours.
See mirror Terraform for setup and ref checks.


Deployment
Instance commit signing
Setup Terraform creates a dedicated Ed25519 SSH commit-signing pair through the
shared Vault SSH key tool. The pair is stored in
KV v2 mount secrets at
alwaldend.com/vault1/approles/src_infra_dc1_forgejo1/commit_signing, within the
existing Forgejo AppRole namespace. Secret values never become Terraform
attributes. Normal applies preserve the pair; an explicit bootstrap resource
replacement validates and reuses the Vault record. Deletion or corruption of
the cache requires restoration, not automatic regeneration.
Setup also publishes a sibling commit_signing_public entry with the public
key and fingerprint. Its bootstrap runs after the private pair is available,
so existing installations can publish it without rotating their key.
Consumers can receive exact-path read access to this public-only entry.
Ansible reads that record through AL and installs the pair under
/opt/forgejo/signing/, with mode 0600 on the private file and a service-owned
0700 directory. The existing recovery archive includes this directory.
Deployment rejects a different existing private key; rotation is a separate
operation. The service uses the public file instance.pub as SIGNING_KEY,
FORMAT = ssh, and the Forgejo <noreply@forgejo.alwaldend.com> identity.
Forgejo signs pull request merges and web or API file changes with this key.
Repositories that inherit the instance’s collaborator trust model record the
merging user’s identity as the Git committer and trust signatures from
repository collaborators under Forgejo’s verification rules.
After separate live authorization, run setup Terraform before service-only
Ansible deployment using the commands below. This does not require running
service Terraform to obtain an API token first. Modern Git (2.34+) and
OpenSSH ssh-keygen (8.2p1+) must be present on the service host. Verify
/api/v1/signing-key.ssh and an instance-generated commit after activation.
See the Forgejo 17 signing contract.
Host and service deployment
Forgejo is recreated on XCP-ng through Xen Orchestra, using the
src_infra_dc1_forgejo1 resource set provisioned by infra/xcp_ng.
VM provisioning authenticates to XO through Vault OIDC as Forgejo’s own
AppRole. Its exact synchronized user receives the resource-set membership
and an explicit administration ACL on the existing Forgejo VM; it does not
use the shared infrastructure administrator token. These bindings must be
applied by infra/xcp_ng/tf before Forgejo’s setup Terraform runs.
The canonical service URL is https://forgejo.alwaldend.com. Local
https://git.alwaldend.com redirects there, preserving the path and query.
Public DNS points the Git name at the Yandex download server, whose Traefik redirects
ordinary web requests to https://github.com with the path and query preserved.
Go discovery requests with go-get=1 receive metadata from the download
server for git.alwaldend.com/alwaldend/src and its descendants, pointing to
https://github.com/alwaldend/src.git. Unknown discovery prefixes return 404. The
dc1 A record continues to select this Forgejo VM. The public CNAME remains
owned by this component’s dnsconfig.json and DNS-only Terraform targets.
Vault’s Forgejo URL and OIDC callback, shared AL login configuration, and runner
instance URL use the canonical hostname. Vault’s certificate role retains both
names so HTTPS also works on the local Git redirect. These are desired-state
definitions; source changes alone do not apply Vault or Ansible configuration.
The VM retains 192.168.10.40 and host1.forgejo.alwaldend.com. Its boot, Forgejo,
and Traefik disks are 20, 40, and 5 GiB respectively.
See Terraform setup for the template, network, storage,
and previous-state prerequisites. These commands create and configure a
fresh service; they do not restore the destroyed Proxmox VM’s data.
Fresh host hardening can outlast the ten-minute Vault token. Run host setup
and service deployment separately to obtain fresh authentication for each phase. Ansible
creates the missing Vault OIDC login source after starting Forgejo; existing
active Vault sources are preserved.
Before configuring Forgejo with Terraform, set TF_VAR_vault_oauth_source_id
to the verified ID of the active vault OIDC source, as described in
service Terraform. Its narrowly scoped Vault entity-read policy
must be provisioned first so the required external users can be created.
The guest disables IPv4 redirect acceptance so its traffic uses the configured
gateway. LAN clients must also retain symmetric routes: same-interface router
redirects can otherwise make connections fail. Router redirect policy and stale
client route caches must be resolved before relying on LAN access.
bazel run //infra/forgejo/tf_setup:tf_setup.apply
bazel run //infra/forgejo/ansible:ansible -- --skip-tags traefik,forgejo,forgejo_oidc
bazel run //infra/forgejo/ansible:ansible -- --tags traefik,forgejo,forgejo_oidc
bazel run //infra/forgejo/tf:tf.apply
28.1 - Ansible
Ansible setup
The Ansible package installs the common Forgejo theme
through the managed custom header. Forgejo’s Light, Dark, and Auto modes use
the website’s neutral palette, font stack, and corner radii. Auto follows the
browser preference. The header also carries the mobile pull request diff styles.
Forgejo uses the shared Alwaldend monogram as its SVG favicon and navigation
logo. The forgejo_branding tag updates only those public assets.
28.2 - Forgejo DNS
Owner-local DNS Terraform
This root manages the records in dnsconfig.json using
//infra/forgejo/dns:tf.<operation>. Follow the
shared transfer procedure
before operating this root.
28.3 - Native push mirrors
Forgejo native HTTPS push mirror configuration
Terraform bootstraps native Forgejo HTTPS push mirrors for repositories
declared in the catalog. The packaged push_mirror API command reconciles
mirrors on Terraform resource creation and when the desired branch filter
changes. Vault supplies
the separate GitHub and GitLab destination credentials under the Forgejo
AppRole’s push_mirrors/<destination> paths. Tokens stay out of Terraform state.
The branch filter combines the catalog’s default branch with releases/*.
Forgejo also sends all tags and uses its native HTTPS LFS transfer. The
mirrors synchronize on commits and every eight hours.
The command adopts a matching HTTPS mirror without writing to Forgejo.
Forgejo’s API requires deleting and recreating a mirror to change its filter.
Before either creation or replacement, the command checks that the source
advertises trunk and that every existing destination head and tag matches
Forgejo’s object ID. It also obtains the destination credential before
deleting the old entry. A failed replacement can be retried through Terraform.
The first filtered sync prunes previously mirrored development branches from
the destination. Confirm that pruning is intended before applying the plan.
The preflight requires their tips to be recoverable from the source. The
command requires Git on the controller. Refresh cannot detect remote drift.
Removing the Terraform resource leaves the live mirror in place.
Add a github or gitlab entry under forgejo.push_mirrors in the
repository’s catalog file. See src.json
for an example. Set username and vault_key for each destination and
include the corresponding destination forge in the same repository file.
Use oauth2 for GitLab or the PAT owner’s GitHub login.
Store the token field in the Forgejo AppRole’s push_mirrors/<vault_key>
record.
bazel run //infra/forgejo/tf_mirrors:tf.plan
bazel run //infra/forgejo/tf_mirrors:tf.apply
28.4 - OpenSpec
28.4.1 - Specifications
28.4.1.1 - Infra forgejo
28.4.1.1.1 - Forgejo infrastructure specification
Purpose
Describe the Forgejo service owned by infra/forgejo, including Xen
Orchestra provisioning, Ansible service configuration, and Terraform account
and repository management. The tf_setup, ansible, and tf packages are
implementation stages of this owner. This baseline records source guarantees
and prerequisites; it does not verify live service health or restore earlier
Forgejo data.
Baseline revision: 550d7e79b1f5fdbc2b6017b75178471d6914082f.
Observed: 2026-09-08. Sources: owner README,
BUILD, and the implementation links below.
Requirements
Requirement: Scoped Xen Orchestra provisioning and disk checks
Setup SHALL provision Forgejo through Xen Orchestra in the
src_infra_dc1_forgejo1 resource set using the owner’s Vault AppRole and
packaged XO OIDC login flow. The VM SHALL declare 20 GiB boot, 40 GiB
Forgejo, and 5 GiB Traefik disks. Ansible SHALL verify the expected sizes
of xvdb and xvdc before applying the service roles that use them.
Sources: setup contract,
setup BUILD,
VM definition, and
deployment playbook.
Scenario: Detect unexpected Xen disk attachments
- WHEN Ansible gathers disks that do not match the expected Forgejo and
Traefik device names and sizes
- THEN its pre-task assertion fails before the service roles run
Requirement: Canonical service routing with legacy hostname support
Forgejo SHALL configure https://git.alwaldend.com/ as its canonical root
URL, bind its HTTP service to loopback port 3000, and enable the built-in
SSH service on port 3005. Traefik SHALL route the canonical hostname, the
inventory hostname, and forgejo.alwaldend.com to that HTTP service with
the Vault certificate resolver.
Sources: service variables,
Forgejo configuration, and
Traefik routing.
Scenario: Inspect support for existing Forgejo clients
- WHEN the Traefik routing template is rendered with the owner’s variables
- THEN the canonical and legacy hostnames resolve to the same configured
loopback service
- AND generated Forgejo URLs use the canonical Git hostname
Requirement: Guarded Vault OIDC bootstrap
The deployment playbook SHALL create a missing vault OIDC authentication
source after configuring the Forgejo service. It SHALL preserve one existing
active OAuth2 source and reject multiple matches, an inactive source, or a
source of another type. Creation SHALL obtain client credentials from the
injected environment and suppress secret-bearing task output.
Source: deployment playbook.
Scenario: Preserve an existing active authentication source
- WHEN Forgejo reports exactly one active OAuth2 source named
vault - THEN the bootstrap accepts it and skips source creation
Scenario: Reject an ambiguous authentication source
- WHEN more than one
vault source is discovered, or its type or active
state is incompatible - THEN the bootstrap assertion fails rather than selecting or replacing
an arbitrary source
Requirement: Vault identities and service grants with catalog named roles
Service Terraform SHALL require a verified positive integer Vault OAuth
source ID, discover login users from the owning Vault group through at most
two nested group levels, and use entity UUIDs as external login names.
Managed accounts SHALL be protected from deletion. The shared repository
catalog SHALL own named organization administrator and developer assignments
and organization-owned repository identities. Catalog members and Vault
access-group members SHALL belong to the discovered login population.
Existing Vault service-administrator, package-writer, and automation-writer
grants SHALL be retained; the src automation writer group SHALL resolve to
exactly one user. A catalog developer SHALL NOT also receive administrator
access through the retained Vault groups.
Sources: service Terraform contract,
users,
access validation, and
repository access.
The shared catalog contract owns repository
naming and named-role assignments; its
adoption change
records the source migration and pending verification.
Scenario: Reject unsupported group membership
- WHEN a login group extends beyond two nested levels, an access-group
member is outside the login population, or the automation writer count is
not one
- THEN the corresponding Terraform condition rejects the configuration
- AND Terraform does not silently omit the unsupported membership
Scenario: Resolve a catalog member through Vault
- WHEN a catalog administrator or developer is assigned organization access
- THEN that assignment uses the discovered account’s existing Vault entity
UUID and verified OAuth source mapping
- AND the assignment does not create a password-based replacement account
Scenario: Retain service access while restricting a named developer
- WHEN shared named roles are adopted
- THEN existing Vault service administration, package-writing, and
automation-writer grants remain configured
- AND the catalog developer receives feature-branch and pull-request
access without a default-branch push or merge bypass
- AND an overlapping administrator grant for that developer fails
validation
28.5 - Tf
Terraform config
This package configures Forgejo organizations, repositories, and access from
the shared repository catalog. The catalog owns named
administrators, developers, repository identities, and destination names.
Its Terraform module supplies the consumer’s
repository projection. First-party names remain stable across forges;
external fork and mirror names retain their original upstream identity.
Repository resources preselect deletion of eligible pull request source
branches in Forgejo’s web merge form. The pinned provider sends the setting
on repository creation and update and does not detect out-of-band changes to
this field during refresh.
Before applying, provision the Vault OIDC authentication source with Ansible and set
TF_VAR_vault_oauth_source_id to its verified positive numeric ID. Obtain the
ID from forgejo admin auth list on the instance using the service’s config
and work path; confirm that the vault source is active and uses OpenID
Connect with the expected Vault issuer. Do not assume source IDs survive
instance recreation.
Terraform discovers users from the authoritative Vault
src_infra_dc1_forgejo1_users login group, then looks up their entities,
following the PVE Terraform pattern. Discovery includes direct members and
two levels of nested groups, covering the current administrator membership.
Deeper nesting fails validation rather than silently omitting accounts.
Each account uses its Vault entity UUID as the OIDC login name and its
canonical username/email metadata. No local password or user impersonation is
used. The Forgejo AppRole receives the existing group/entity lookup permissions,
as PVE does. Apply those Vault group memberships before running this package.
The accounts are protected from Terraform deletion. OIDC group claims retain
ownership of administrator/restricted status after login. If a user already
exists outside this state, verify its source and login-name mapping before
importing it; never replace an existing account to resolve a name collision.
Resource addresses remain keyed by Vault entity name, preserving existing
managed users. The Forgejo service identity may already exist from the first
OIDC login: verify and import it before applying its newly discovered resource.
Named organization administrator and developer assignments come from the
catalog and must resolve to the discovered Vault login population. The
Developer team can read repositories, write feature branches, and open pull
requests. Its members receive no default-branch push or merge bypass.
Existing service administration remains sourced from
src_infra_dc1_forgejo1_admins and its direct child groups. Those grants are
retained for entities with a Vault AppRole alias, alongside catalog
administrators. The separate instance-wide OIDC administrator claim remains
owned by Vault. Validation rejects a catalog
developer who also receives administrator access through those Vault groups.
Package writers and the repository automation writer retain the grants from
src_infra_dc1_forgejo1_package_writers and
src_infra_dc1_forgejo1_src_writers. These dedicated groups avoid granting
service permissions to AppRole credential issuers. The existing singleton
collaborator still requires exactly one discovered writer. Access-group
members outside the login population also fail validation.
Repository adoption preserves remote IDs. The existing singleton repository
address has an explicit move to its catalog key, while account and service
access addresses remain stable. Import an existing untracked destination
before applying; never recreate it to resolve a name collision. Review the
full plan before execution and obtain separate approval for any deletion or
replacement. The retained branch rules continue to own administrator and
automation-writer exceptions.
bazel run //infra/forgejo/tf:tf.plan
bazel run //infra/forgejo/tf:tf.apply
Runner credentials
terraform_data.runners["secure1"] bootstraps the repository-scoped
secure1.dev.alwaldend.com runner for alwaldend/src through the packaged
local tool. Its credentials are cached
in KV v2 mount secrets at
alwaldend.com/vault1/approles/src_infra_dc1_forgejo1/runners/secure1, within
the Forgejo AppRole’s existing namespace. The worker receives no controller
API credential. This declaration creates credentials; host configuration and
consumer read access remain owned by their deployment and Vault policies.
The provisioner runs only when its stable Terraform resource is created. It
has no timestamp, executable hash or replacement trigger. Normal applies and
tool changes do not rerun registration. An explicit replacement reuses the
Vault cache. The token is written directly to Vault and is never a Terraform
attribute. Removing the resource preserves the runner and cached credentials.
The local tool’s README owns its failure and reconciliation contract.
Runner registration consumes an existing repository and uses its identity from
the shared catalog. Provision the repository first on a fresh service. A
targeted runner bootstrap does not reconcile the service’s repository resources.
28.6 - Tf setup
Terraform setup
This package creates a Xen Orchestra VM in the src_infra_dc1_forgejo1
resource set. infra/forgejo/BUILD.bazel authenticates with Forgejo’s own Vault
AppRole and the packaged XO OIDC login plugin. The plugin supplies a temporary
XO token and revokes it on shutdown; no infrastructure administrator token
is loaded. The setup HTTP backend remains owned by the same Forgejo config.
It also bootstraps the instance commit-signing key
directly into Vault through a stable creation-only resource. Run this stage
before Ansible, which requires that cache. The provisioner receives the existing
Vault environment without loading a Forgejo API credential. Plans do not run
generation; normal applies do not rotate or refresh an existing key.
Before running this package, bootstrap the AppRole’s XO OIDC user and apply
its resource-set membership and existing VM ACL through infra/xcp_ng/tf.
Subjects are matched by immutable Vault entity UUID under the configured
OIDC issuer, not by login name or AppRole group membership. See
XO authentication.
Defaults select the imported Fedora 44 template, local storage and wired
network by name from the Forgejo resource set. Override
TF_VAR_xoa_template_name, TF_VAR_xoa_storage_name, and
TF_VAR_xoa_network_name for another assignment. Native provider lookups run
as Forgejo’s own identity and reject ambiguous matches. No infrastructure
UUID defaults are required; resolved IDs are passed to the XO API.
The template must contain a single boot disk no larger than 20 GiB, Fedora,
and cloud-init. Bootstrap installs Xen guest tools. The pinned Fedora 44
image uses predictable interface naming; xoa_guest_interface defaults to
enX0 for its first Xen interface and can be overridden for another template.
The selected network must carry 192.168.10.0/24; gateway and DNS default to
192.168.10.1 (the wired router) and can be overridden with the Terraform variables.
The PVE-based infra/cloud_init:xen_linux target supplies the shared Ansible
user and CA configuration through the repository template rule. Terraform adds
the hostname and static network configuration from ../dns/dnsconfig.json. After cloud-init completes, verify that /dev/xvda is the
boot disk, /dev/xvdb is the 40 GiB Forgejo disk, and /dev/xvdc is the 5 GiB
Traefik disk before running Ansible, which creates filesystems on the latter
two devices.
The old Proxmox VM was destroyed and its obsolete Terraform state binding
was removed without issuing a destroy. This package now uses only XO.
There is no cross-provider state move or data restoration in this package.
bazel run //infra/forgejo/tf_setup:tf_setup.plan
bazel run //infra/forgejo/tf_setup:tf_setup.apply
Manage records through the dedicated DNS root.
29 - harbor
Harbor container registry configuration on Proxmox and K3s
Archive/Harbor
This archived diagram preserves the historical source topology.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Links
CE Login
- Go to User Profile, copy CLI secret
- Run:
podman login harbor.alwaldend.com
Update secrets
- Generate approle secret id:
SECRET_ID=$(bazel run //infra/harbor/cl:vault.secret_id | jq -r .data.secret_id)
echo "Secret id: ${SECRET_ID}"
- Patch secret-id in ./cl/cert-manager/issuer-approle.yaml
- Encrypt:
bazel run //infra/harbor/cl:sops.encrypt infra/harbor/cl/cert-manager/issuer-approle.yaml
29.1 - Ansible
Ansible setup
29.2 - cl
Cluster manifests
29.3 - Harbor DNS
Owner-local DNS Terraform
This root manages the records in dnsconfig.json using
//infra/harbor/dns:tf.<operation>. Follow the
shared transfer procedure
before operating this root.
29.4 - OpenSpec
29.4.1 - Specifications
29.4.1.1 - Infra harbor
29.4.1.1.1 - Harbor infrastructure specification
Purpose
Describe the Harbor registry infrastructure owned by infra/harbor, spanning
Proxmox setup, K3s host configuration, Flux-managed chart declarations, and
Harbor service Terraform. The tf_setup, ansible, cl, and tf packages
are implementation stages of this owner. This is a checked-in source
baseline, without an observation of live registry availability or deployment
success.
Baseline revision: 550d7e79b1f5fdbc2b6017b75178471d6914082f.
Observed: 2026-09-08. Sources: owner README,
BUILD, and the implementation links below.
Requirements
Requirement: Dedicated K3s registry host
Setup SHALL declare a Proxmox VM in the src_infra_harbor pool with two
cores, 4096 MiB memory, and 20 GiB boot, 20 GiB K3s data, and 40 GiB K3s
storage disks. Ansible SHALL apply the shared host and K3s roles with K3s
secrets encryption enabled. Its firewall variables SHALL scope API port
6443 access to the declared Flux host address.
Sources: VM definition,
deployment playbook,
K3s configuration, and
host variables.
Scenario: Inspect management API access
- WHEN the Harbor host configuration is evaluated
- THEN the API-port firewall entry identifies the Flux source address
- AND the K3s configuration enables secrets encryption and disables
bundled Traefik
Requirement: Remote Flux chart reconciliation
The Harbor Flux manifests SHALL declare a remote-cluster Kustomization and
HelmRelease using src-infra-harbor-cl-kubeconfig. The HelmRelease SHALL
pin its chart version, enable Helm tests and drift detection, set
https://harbor.alwaldend.com as the external URL, and use the local-path
storage class for its declared persistent components.
Source: Harbor Flux manifests.
Scenario: Inspect the Harbor release declaration
- WHEN a maintainer evaluates the Harbor HelmRelease
- THEN the source selects a specific chart version and the remote Harbor
cluster configuration
- AND tests, drift detection, external URL, and persistent storage choices
are explicit
Requirement: Vault-backed registry identity configuration
Harbor service Terraform SHALL configure Vault OIDC authentication using
client credentials from the Vault provider, the groups claim, and the
src_infra_harbor_admins administrator group. It SHALL enable automatic
onboarding and use the username claim for users.
Source: authentication configuration.
The baseline sets oidc_verify_cert = false with a CA-issues comment; this
specification does not claim that OIDC server certificate verification is
enabled.
Scenario: Resolve OIDC identity settings
- WHEN the service Terraform authentication resource is inspected
- THEN it references Vault-provided client credentials and the configured
user and group claims
- AND its certificate-verification setting remains visible as a baseline
limitation
Requirement: Registry projects and guest access
Service Terraform SHALL declare an alwaldend project with vulnerability
scanning and automatic SBOM generation, plus a dockerhub proxy-cache
project linked to the Docker Hub registry. Both projects SHALL grant the
configured src_infra_harbor_users OIDC group the guest role.
Sources: first-party project and
Docker Hub proxy.
Scenario: Inspect registry consumer permissions
- WHEN the managed registry projects are evaluated
- THEN
alwaldend enables scanning and SBOM generation, while dockerhub
references the Docker Hub proxy registry - AND both group membership resources specify guest access
29.5 - Tf
Terraform config
29.6 - Tf setup
Terraform setup
This stage provisions Harbor. It reads network settings from dnsconfig.json.
Manage records through the dedicated DNS root.
30 - Pve
Proxmox cluster configuration, resource pools, and VM bootstrap
Archive/Proxmox
This archived diagram preserves the historical source topology.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Links
Deployment
bazel run //infra/pve/ansible # host setup
bazel run //infra/pve/tf/tf.apply # tf setup
Recreate the test VM
bazel run //infra/pve/tf:tf.apply -- --replace module.vm_cloudinit_test.proxmox_vm_qemu.vm
Cloud-init snippet update
bazel run //infra/pve/ansible -- --tags pve_snippets
Update ACME account
Pve token
- Create a token with Privilege Separation
- Grant it required roles
- Create json:
{
"token_id": "",
"token_secret": ""
}
- Write the data:
bazel run //infra/pve:vault.kv_put alwaldend.com/vault1/approles/src_infra_dc1_pve1/pve_token @"${PWD}/data.json"
30.1 - Ansible
Ansible setup
30.2 - OpenSpec
30.2.1 - Specifications
30.2.1.1 - Infra pve
30.2.1.1.1 - Proxmox infrastructure Specification
Purpose
Specify the Proxmox cluster configuration, resource pools, and bootstrap test
VM owned by infra/pve. The baseline is checked-in source at revision
550d7e79b1f5fdbc2b6017b75178471d6914082f, observed on 2026-09-08.
It describes declared infrastructure and packaged operator entry points;
deployment and cluster health have not been observed for this baseline.
Requirements
Requirement: AppRole resource pools
The Terraform configuration SHALL resolve the members of Vault’s approles
identity group and declare one Proxmox pool per resolved entity, keyed and
named by that entity’s name. It SHALL also declare a separate templates pool.
Sources: project documentation and
resource pool definitions.
Scenario: Declare pools for known AppRoles
- WHEN Terraform resolves the entities in the Vault
approles group - THEN the desired configuration includes a pool with each entity’s name
and the dedicated
templates pool.
Requirement: Packaged host and snippet configuration
The PVE Ansible entry point SHALL package the inventory and deployment playbook
and apply the shared host and PVE roles to the pve1 inventory group. It SHALL
package the canonical shared cloud-init files under files/cloud_init.yaml
and files/cloud_init_min.yaml, preserving the existing snippet update flow.
Sources: deployment target,
playbook, and
snippet variables.
Scenario: Assemble the PVE deployment package
- WHEN the Ansible binary’s source package is built
- THEN it includes the playbook, inventory, shared role collection, and
both shared cloud-init files under their established aliases.
Requirement: Cloud-init test virtual machine
The Terraform configuration SHALL declare its cloud-init test VM through the
shared pve_vm_qemu module, derive its hostname and address from the project’s
DNS configuration, and place it in the src_infra_dc1_pve1 AppRole pool. The
baseline declaration SHALL use VM ID 100, a 5G scsi0 disk, and the test tag.
Sources: VM definition and
DNS configuration.
Scenario: Resolve the test VM’s desired configuration
- WHEN Terraform evaluates
module.vm_cloudinit_test - THEN its name and
/24 address derive from cloudinit_test DNS fields,
and its pool resolves to the declared PVE AppRole pool.
PVE Terraform commands SHALL use the project’s AL configuration and the
declared Terraform, PVE-login, and Vault-environment plugins. The package SHALL
include the lockfile, Terraform source, shared backend and VM modules, and
required Vault helper targets. PVE Ansible commands SHALL likewise use the
project AL configuration and packaged injector.
Sources: Terraform wrapper and
Ansible wrapper.
- WHEN a repository Terraform command target is invoked with authorization
for its operation
- THEN the wrapper supplies the declared modules and helper inputs and
selects the
tf, pve_login, and vault_env=default_default plugins.
30.3 - Proxmox DNS
Owner-local DNS Terraform
This root manages the records in dnsconfig.json using
//infra/pve/dns:tf.<operation>. Follow the
shared transfer procedure
before operating this root.
30.4 - Tf
Terraform config
This root manages Proxmox infrastructure and retains its ordinary Proxmox authentication.
Manage records through the dedicated DNS root.
31 - Yandex Cloud
Yandex Cloud organization folders and infrastructure access
Links
31.1 - OpenSpec
31.1.1 - Infrastructure Yandex Cloud
Purpose
Describe organization-level Yandex Cloud folder provisioning derived from Vault
AppRole identities. The direct infra/yandex_cloud owner currently contains one
concrete organization package, org1, covered here. This baseline does not
assert that the cloud organization or its folders were inspected live.
Baseline source revision: 550d7e79b1f5fdbc2b6017b75178471d6914082f.
Observation date: 2026-09-08. Sources are linked in full; no excerpts are used.
Sources: top-level documentation,
organization package,
organization targets,
Terraform packaging,
folder derivation,
provider configuration, and
credential injection.
Requirements
Requirement: Keep organization configuration under its owner
The Yandex Cloud tree SHALL expose its documentation through the infrastructure
documentation boundary and keep org1’s AL configuration and Terraform package
under infra/yandex_cloud/org1.
- WHEN a contributor follows the Yandex Cloud package’s child documentation
- THEN
org1 identifies the current organization configuration - AND its Terraform wrapper uses
//infra/yandex_cloud/org1:al
Requirement: Derive folders from Vault AppRole membership
Terraform SHALL read the Vault identity group named approles, resolve its
member entities, and instantiate the shared yc_folder module once per entity
name. Folder names SHALL replace underscores with hyphens, and secret references
SHALL use the corresponding yandex.cloud/org1/folders/ path.
Scenario: Map an AppRole identity to a cloud folder
- WHEN the
approles group contains an entity named example_service - THEN the folder module receives the name
example-service - AND its secret reference is
yandex.cloud/org1/folders/example-service - AND its cloud identifier comes from the configured
cloud_id variable
The Terraform Bazel package SHALL include its provider lock, shared folder and
backend modules, and Vault backend and injector tools. Its operational wrapper
SHALL select the Terraform plugin and the default_default Vault environment;
the package SHALL also expose the configured Terraform test map.
Scenario: Resolve the organization Terraform entry point
- WHEN the organization’s Terraform wrapper is assembled
- THEN its runfiles contain the declared local modules and provider lock
- AND runtime authentication is supplied by the owning AL/Vault flow
31.2 - Org1
Organization 1
Links
31.2.1 - Tf
Terraform config
32 - Vault
Vault deployment, secrets management, and certificate issuance
Architecture
This diagram describes the maintained architecture source, not live inventory or service health.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Links
Deployment
bazel run //infra/vault/tf_setup:tf.apply # Create VMs (requires an active Vault host)
bazel run //infra/vault/ansible # Set up hosts (BM and VMs)
bazel run //infra/vault/tf:tf.apply # Configure vault
The Molecule SSH issuer has a separate Terraform
stage and state.
Backup
bazel run //infra/vault:backup
Unseal
With a working Vault:
bazel run //infra/vault:unseal
Without a working Vault:
bazel run //infra/vault:unseal_standalone
Fix quorum
bazel run //infra/vault/ansible:fix_quorum
Set up only VMs
bazel run //infra/vault/ansible:ansible.vm # Set up only VMs
bazel run //infra/vault/ansible:ansible.bm # Set up only bare metal
Tf
Plan:
bazel run //infra/vault/tf:tf.plan
Apply:
bazel run //infra/vault/tf:tf.apply
Run terraform directly:
bazel run //infra/vault/tf:tf.direct -- -chdir="${PWD}" plan
Replace VMs
bazel run //infra/vault/tf:tf.apply -- -replace 'module.vm_ha["host2"].proxmox_vm_qemu.vm' -replace 'module.vm_ha["host3"].proxmox_vm_qemu.vm
Generate and import a user cilent certificate
username="username"
bazel run //infra/vault:gen_client_cert -- --user "${username}" --output_dir "${PWD}"
bazel run //tools/ykman -- piv certificates import 9A "${PWD}/${username}.pfx"
bazel run //tools/ykman -- piv keys import 9A "${PWD}/${username}.pfx"
Generate a host cilent certificate
bazel run //infra/vault:gen_client_cert -- --host some-host --output_dir "${HOME}/.al/client_cert"
Generate a user device cilent certificate
bazel run //infra/vault:gen_client_cert -- --host some-host --user username --output_dir "${HOME}/.al/client_cert"
Unseal
- Prepare encrypted unseal token
- Run and input the encrypted token:
bazel run //infra/vault:unseal
Root token
- Prepare encrypted unseal token
- Run and input the encrypted token:
bazel run //infra/vault:gen_root_token -- --pgp_key path_to_public_gpg_key_in_base64
Generate an EAB for ACME
bazel run //infra/vault -- write -f pki/ica_servers/roles/ica_servers_dc1_pve1/acme/new-eab
Sign a client ssh key
bazel run //:vault -- write ssh/clients/sign/admins ttl=30000000 public_key=@"${HOME}/.ssh/key"
Revoke all tokens
bazel run //infra/vault -- token revoke -mode=path auth
Vault certificates
Renew the Vault server certificate through its Ansible role. The vault_tls
tag issues a certificate, installs its chain and private key, and reloads Vault
with SIGHUP. It stops on certificate errors and does not run the host setup,
package installation, or service restart tasks.
Run from the repository root. Keep SSH host verification enabled by deriving a
temporary known_hosts entry from the repository-owned public SSH CA:
vault_recovery_dir="${PWD}/out/vault-certificate-recovery"
mkdir -p "${vault_recovery_dir}"
printf '@cert-authority host1.vault.alwaldend.com,host1.vault.dc1.alwaldend.com %s\n' \
"$(cat data/ssh/ca_servers.pub)" \
>"${vault_recovery_dir}/ssh_known_hosts"
For an expired server certificate, temporarily disable Vault certificate
verification for this recovery command only. The SSH options trust that CA
only for this invocation and retain the existing SSH certificate’s host alias:
env VAULT_SKIP_VERIFY=true \
ANSIBLE_SSH_COMMON_ARGS="-o StrictHostKeyChecking=yes \
-o HostKeyAlias=host1.vault.alwaldend.com \
-o UserKnownHostsFile=\"${vault_recovery_dir}/ssh_known_hosts\"" \
bazel run //infra/vault/ansible:ansible -- \
--limit host1.vault.alwaldend.com --tags vault_tls
Vault must be reachable and unsealed, and the host token must allow the
component’s AppRole login. If that token has expired, connect the login YubiKey
and refresh it first:
bazel run //tools/vault/login -- simeonwarren --insecure
This login replaces the host token. Stop if it fails; a missing YubiKey cannot
be fixed by disabling TLS verification. Neither command changes the persistent
TLS verification configuration. Do not add the bypass to shell profiles,
BUILD.bazel, or Ansible defaults, and do not use verbose or diff output for the
certificate tasks. The temporary public known_hosts projection does not
modify the host’s SSH configuration; do not replace it with an unverified
ssh-keyscan result or disable SSH host verification.
After renewal, verify Vault with certificate validation enabled:
env -u VAULT_SKIP_VERIFY bazel run //:vault.status
For renewal before expiry, omit VAULT_SKIP_VERIFY=true from the Ansible
command. The current inventory serves Vault from host1; review the inventory
before changing the host limit. Its inventory name remains
host1.vault.alwaldend.com to preserve the Vault node identity; ansible_host
connects through the DNS-owned name host1.vault.dc1.alwaldend.com. Certificate
alternate names include this connection hostname for the existing unseal
endpoint, as well as the shared Vault service names.
Read OIDC client info
bazel run //infra/vault -- read identity/oidc/client/src_infra_dc1_forgejo1_provider
Read all entity aliases
bazel run //infra/vault -- list -format json identity/entity-alias/id | jq ".[]" | xargs "-I{}" bazel run //infra/vault -- read "identity/entity-alias/id/{}"
Independent AppRole projects
The NAS,
development,
AL, and
download identities use independent
Terraform roots and states. The core root retains shared mounts and global
memberships, discovering those projects’ existing identities by name.
32.1 - Ansible
Ansible setup
32.2 - Molecule SSH issuer
Standalone Terraform stage for the Molecule SSH certificate authority
This Terraform root owns the ssh/molecule mount, Ed25519 issuer, and test
AppRole. It uses one state and a single set of deployment targets under
//infra/vault/ssh_molecule.
The smoke role signs Ed25519 keys for the fedora user principal. Its
default certificate lifetime is 15 minutes, and callers can request up to
one hour. The ssh_molecule_sign_smoke policy permits signing through this
role. The test AppRole assigns that policy to src_tools_molecule
and grants global_admins access to bootstrap it.
The former AppRole backend was retired after the state transfer.
After deployment, the seed ISO can use the CA public key from
ssh/molecule/public_key as its build input. The test generates its own keypair
and sends the public key to ssh/molecule/sign/smoke at runtime.
Offline validation uses //infra/vault/ssh_molecule:tf_tests.validate_test.
The stage has its own :tf.plan and :tf.apply targets.
32.3 - OpenSpec
32.3.1 - Specifications
32.3.1.1 - Download identity
32.3.1.1.1 - download-identity Specification
Purpose
Provide a dedicated Vault identity for download infrastructure while keeping
state, credential references, and provider permissions scoped to its needs.
Requirements
Requirement: Dedicated component authentication
Vault configuration SHALL declare src_infra_download using the existing
AppRole backend and reusable identity modules. Its state permissions SHALL
cover the component’s own environment and DNS state keys, not another
component’s state namespace.
Scenario: Inspect component state access
- WHEN the download identity’s effective state policy is evaluated
- THEN it grants access to download-owned state and locks
- AND it does not grant access to unrelated component state
Requirement: Required provider and SSH assignments
The identity SHALL expose the membership and identity outputs needed for
Yandex folder provisioning and XCP-ng resource-set assignment. It SHALL
receive the required component SSH permissions and DNS provider-secret reads
for global and local records without administrative provider credentials.
Scenario: Prepare both environment assignments
- WHEN provider owners consume the declared download identity
- THEN they can assign its Yandex folder and XCP-ng resource set
- AND no unrelated component’s identity is reused for deployment
Requirement: Secret references and certificate automation
Checked-in declarations SHALL contain secret references only. Download
certificate automation SHALL receive role-scoped EAB access for internal Vault
HTTP-01 certificates. The role SHALL permit only alwaldend.com,
download.alwaldend.com, and www.alwaldend.com, without subdomain or client
certificate permissions. Public Let’s Encrypt HTTP-01 SHALL require no DNS
challenge credential. Adding this
identity SHALL NOT broaden unrelated identities’ policies.
Scenario: Review the source change
- WHEN the role and its policy declarations are inspected
- THEN they name Vault paths and permissions without embedding credential values
- AND unrelated identity permissions remain unchanged
Requirement: Independent identity state
The download identity SHALL be deployed from its own Terraform root and
backend under infra/vault/approles/src_infra_download. Shared identity IDs
SHALL be resolved by name through data sources rather than parent-module
inputs or another root’s state. Shared group membership lists SHALL retain
one owner in the core Vault stage.
Scenario: Bootstrap without the download identity
- WHEN shared Vault mounts and the administrative/operator identities already exist
- THEN the standalone root can create the download identity using administrative authentication
- AND a subsequent core Vault apply resolves the new identity/group by name and adds their memberships
32.3.1.2 - Infra vault
32.3.1.2.1 - Infrastructure Vault
Purpose
Describe the Vault host configuration, authentication and certificate services,
and packaged recovery entry points. This baseline concerns checked-in desired
state and supported wrapper structure; it does not establish live unsealed
state, successful backups, quorum, or certificate freshness.
Baseline source revision: 550d7e79b1f5fdbc2b6017b75178471d6914082f.
Observation date: 2026-09-08. Sources are linked in full; no excerpts are used.
Sources: operator documentation,
operational wrappers,
Ansible entry points,
Vault host template,
authentication backends,
storage engines,
server PKI,
client PKI, and
public CA outputs.
Requirements
Requirement: Separate host provisioning from Vault configuration
The documented workflow SHALL separate tf_setup VM provisioning, Ansible host
setup, and the tf Vault configuration stage. Ansible SHALL expose combined,
VM-only, and bare-metal-only setup entry points using the shared host and Vault
roles.
Scenario: Prepare an authorized host setup
- WHEN an operator selects
ansible.vm or ansible.bm - THEN the wrapper selects the matching checked-in playbook and inventory
- AND Vault’s API configuration remains owned by the separate Terraform stage
The host template SHALL configure TLS API and cluster endpoints on ports 8200
and 8201 and Raft storage under /opt/vault/raft. It SHALL derive each Raft node
identifier from the inventory hostname and emit retry-join addresses for hosts
in the Vault inventory group.
Scenario: Render a Vault host configuration
- WHEN Ansible renders
vault.hcl for a member of the Vault group - THEN its API and cluster URLs use its inventory hostname
- AND Raft receives that hostname as node ID and the group’s HTTPS join URLs
Requirement: Declare authentication and secret-engine boundaries
Terraform SHALL declare userpass, approle, and cert authentication
backends, a version-two KV engine at secrets, and a transit engine at
transit/default. Client and server certificate authorities SHALL remain
distinct, and server PKI ACME SHALL require external account binding with the
default directory policy set to forbid.
- WHEN the main Terraform configuration is evaluated
- THEN authentication, KV, transit, client PKI, and server PKI are distinct
declared resources
- AND server ACME is enabled with
eab_policy = "always-required" - AND published CA output files contain certificate or public-key material
Requirement: Package recovery and certificate operations explicitly
The package SHALL expose separate wrappers for backup, ordinary unseal,
standalone unseal, client certificate generation, and root-token generation.
Standalone unseal SHALL use the default_no_auth environment without selecting
the ordinary unseal plugin; these wrappers SHALL NOT imply that recovery has
been executed successfully.
Scenario: Select the standalone unseal workflow
- WHEN an authorized operator invokes
//infra/vault:unseal_standalone - THEN the wrapper selects the packaged unseal utility and declared Vault
endpoint with its no-auth environment
- AND success remains an operational result to be observed separately
Requirement: Give each DNS owner a component identity
Every owner that manages DNS records through Terraform SHALL use its existing
component AppRole or a dedicated owner AppRole when one is missing. A DNS-only
identity SHALL retain the shared AppRole module’s own-state and named shared
secret access without cloud provisioning, SSH, or PKI permissions. Existing
component identities and unrelated authentication flows SHALL remain stable.
Scenario: Introduce a landing site’s DNS stage
- WHEN a project has DNS records but no existing component AppRole
- THEN Vault configuration declares an AppRole named for that owner
- AND the identity can manage its own Terraform state without access to
another owner’s state
Scenario: Add host DNS management
- WHEN host_bot uses its dedicated DNS AppRole
- THEN its existing Ansible authentication remains unchanged
Requirement: Restrict provider secret reads to owned DNS views
DNS identities SHALL receive read access to the existing Cloudflare credential
only when they own global records and to the existing RouterOS DNS credential
only when they own dc1 records. DNS access SHALL NOT grant writes to either
provider secret or duplicate credential values.
- WHEN an owner declares only global records
- THEN its DNS policy grants Cloudflare credential reads
- AND its DNS policy grants no RouterOS credential access
- WHEN an owner declares global and dc1 records
- THEN its DNS policy grants reads for both existing credential references
- AND neither read policy grants mutation of the provider credential
Requirement: Recover an expired server certificate with scoped Ansible tasks
The packaged Vault Ansible workflow SHALL expose a vault_tls tag that issues
and installs the configured server certificate and private key, then reloads
Vault. Selecting only this tag SHALL NOT update packages, the service binary,
host configuration, or Raft peers. Certificate material SHALL be suppressed
from task output. Explicit certificate renewal SHALL stop on issuance or
installation failure before reloading the service.
Scenario: Renew one authorized host’s certificate
- WHEN the operator selects
vault_tls and limits the play to one Vault host - THEN only certificate issuance, certificate and key installation, and
service reload are selected, in addition to read-only fact gathering
- AND a failed certificate task prevents the reload
Requirement: Scope certificate-verification bypass to recovery invocations
The recovery procedure SHALL use an invocation-scoped verification override
only when an expired server certificate prevents the authorized renewal. It
SHALL retain the existing Vault authentication and injection flow, require a
valid bootstrap login, and verify the recovered service with certificate
validation restored. The procedure SHALL NOT persist insecure TLS defaults.
Scenario: Certificate expiry prevents authenticated renewal
- WHEN an authorized operator performs the documented recovery
- THEN the temporary override applies to credential injection and certificate
issuance within that command
- AND a failed bootstrap login prevents proceeding to renewal
- AND success is established separately with normal TLS verification
32.3.1.3 - X article uploader identity
32.3.1.3.1 - X Article uploader identity
Purpose
Describe the uploader’s dedicated Vault identity, component-scoped credential
access, and injected OAuth references. These declarations do not establish that
a live identity or credential has been provisioned.
Requirements
Requirement: Dedicated component identity
Vault configuration SHALL declare a src_projects_x_article_uploader identity
through the existing AppRole backend and reusable identity module, so the
uploader authenticates as itself rather than sharing another component’s role.
Checked-in declarations SHALL contain secret references only.
Scenario: Inspect component authentication
- WHEN the uploader’s identity is evaluated
- THEN it authenticates through the shared AppRole backend as
src_projects_x_article_uploader - AND it does not reuse another component’s role or entity
Requirement: Least-privilege access to the publication credential
The identity’s policy SHALL grant access to the uploader’s own credential path
and SHALL NOT grant access to another component’s secrets. The credential value
SHALL live in Vault under the identity’s own AppRole subtree, read through the
shared module’s own-subtree policy, and the checked-in source SHALL reference it
by mount and path only.
Scenario: Reference the credential by path
- WHEN the credential mount and its logical path are evaluated for the
injected reference
- THEN the checked-in source names the mount and the path and no credential
value, so no secret enters source
- AND the path lies inside the identity’s own AppRole subtree, so the shared
module’s own-subtree policy grants the read
Scenario: Read the publication credential
- WHEN the uploader reads its X API credential through the injection flow
- THEN the read succeeds against the uploader’s own path
- AND the credential value is not present in checked-in source
Scenario: Attempt to read another component’s secret
- WHEN the uploader’s effective policy is evaluated against another
component’s credential path
- THEN the policy grants no read access to that path
Requirement: Injected credential reference
The publication credential is an OAuth 1.0a user-context credential, which
requires four fields: the API key, the API secret, the access token, and the
access token secret. The injected reference SHALL name one environment variable
per field, and this identity’s configuration SHALL declare those variables by
name. The references, not the values, are what checked-in configuration
carries; no credential value enters source.
Scenario: Inject the credential at run time
- WHEN the uploader’s injection runs
- THEN each of the four credential fields is placed in its named environment variable
- AND the reference, not the value, is what checked-in configuration names
32.4 - Tf
Terraform config
Selected userpass entries
userpass.tf contains the explicit user list, initially only
simeonwarrenbot. It generates a stable 72-character password for each selected
user and stores the username/password at
secrets/alwaldend.com/users/<username>/userpass before updating that login.
Users and the users group receive no storage grant. No deny rules are added.
The existing simeonwarren entity receives exact data/metadata read access to
secrets/alwaldend.com/users/simeonwarrenbot/userpass. This grants no writes,
namespace listing, or sibling reads. The infrastructure role can manage only
selected userpass entries, including provider-required metadata read/update,
without metadata deletion.
The account’s existing alias and token policy settings are preserved. Unchanged
configuration retains the generated password. Vault cannot return userpass
passwords for drift detection; out-of-band changes require managed rotation.
Sensitive state remains in the existing Vault backend. Do not export it or
enable debug logging. KV removal soft-deletes the entry and retains versions.
The deployment verification
records the authorized apply and live access checks.
Public certificate snapshots
This root manages Vault’s PKI and SSH issuers. Public snapshots are owned and
refreshed independently by data/ssl/alwaldend.com/tf
and data/ssh/tf; this root does not write them.
The removed blocks in outputs.tf retire the four former local_file
exports with destroy = false. A later authorized apply forgets those state
entries without deleting their files. No state migration or Vault operation is
performed merely by moving the checked-in snapshots.
DNS identities
Missing DNS-owner AppRoles compose the existing reusable
AppRole module with an owner-specific DNS policy in approles/<name>/.
DNS access grants read-only access to the existing
provider credentials for the owner’s views. Existing component identities
receive these policies through their existing module declarations.
DNS-only group membership adds no policies. These
identities retain their own state and named shared-secret access without
joining the general infrastructure AppRole group or receiving cloud
provisioning, SSH, or PKI permissions.
The operator bootstrap membership follows the existing component pattern.
An authorized Vault apply must create the roles and policies before their DNS
stages can authenticate; source validation does not establish deployed access.
Follow the DNS migration for the coordinated cutover and
the AppRole bootstrap procedure
when distinguishing missing deployment from insufficient operator access.
The Flux project owns its AppRoles and
related policies. Shared Vault resolves the Flux identities by name for
cross-component grants.
Vast team token delivery
The Vast infrastructure role declares access to
only src_infra_image_gen/vastai in addition to its existing namespace. The
policy grants data lifecycle operations and exact metadata read/delete access,
with no sibling or component-state access. It lets the team root deliver and
later remove the generated key using its own identity.
The image-generation role owns its own KV and
state subtree. Its operator member can bootstrap the AppRole and browse that
namespace in Vault. List-only permissions on exact metadata ancestors support
UI navigation without access to other secret values. An additional exact-path
metadata read/delete policy lets the component manage and remove all versions
of its web-login entry. Its explicit read permission retains metadata access
when this exact-path policy takes precedence over the namespace wildcard. It does not join the broad infrastructure AppRole group.
The legacy personal image-generation grant was removed through a reviewed
scoped apply on 2026-11-10. The replacement role and delivery grant were then
deployed under the user’s credential-only authorization; no rental was created.
The component receipt
records the operation. The existing personal user role and its browser access are independent
and remain unchanged.
32.5 - Tf setup
Terraform setup
This stage provisions Vault and reads network settings from dnsconfig.json.
Manage records through the dedicated DNS root.
Offline formatting is available through
//infra/vault/tf_setup:tf_tests.fmt_test.
32.6 - Vault DNS
Owner-local DNS Terraform
This root manages the records in dnsconfig.json using
//infra/vault/dns:tf.<operation>. Follow the
shared transfer procedure
before operating this root.
33 - Dns
Project-owned DNS declarations for alwaldend.com
DNS records live in each owner’s dns/dnsconfig.json. Each owner manages its records
through the reusable Terraform DNS module
from a dedicated DNS root with independent state and DNS-only credentials.
DNS-only roots moved from tf/ to dns/ keep their existing backends.
This component’s
dnsconfig.json owns shared apex and mail records.
The public apex follows download.alwaldend.com to the Yandex download host.
The dc1 apex continues to use the local download VM. The
activation record
documents the authorized cutover and HTTPS acceptance.
Architecture
This diagram describes the maintained architecture source, not live inventory or service health.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Declaration pages
Cloudflare DNS and Mikrotik DNS list the
records this repository declares for each destination view, with the owning
declaration for every record. They are manually refreshed snapshots of
dnsconfig.json and may lag behind the declarations. Regenerate them explicitly
when a documentation refresh is wanted, for example after parallel DNS changes
have merged:
bazel run //infra/dns/cmd/dump -- --write
Ordinary validation checks declarations and ownership without requiring or
rewriting these snapshots. A DNS change does not require a documentation
refresh in the same PR. To explicitly check snapshot freshness, run
bazel run //infra/dns/cmd/dump -- --check.
Inspect and lint declarations
bazel run //infra/dns:lint
The linter discovers dnsconfig.json files in the current workspace at runtime
and prints their DNS declarations as a table. It includes nested project
workspaces and excludes task scratch, tool caches, and generated directories.
There is no central source registry to maintain when a project adds a file.
A canonical domain name must belong to one source file. Multiple values, record
types, and destination views within that file are valid. Duplicate JSON object
keys and domains declared by different source files are errors. The command
reads checked-in declarations without contacting Terraform backends or DNS
providers.
bazel test //infra/dns:config_test runs the linter’s fixture tests
and checks every DNS declaration in the current checkout. The repository test
resolves the root MODULE.bazel runfile to the checkout and runs without sandboxing
or cached test results so newly added files and nested workspaces are included
on every run. It only reads local files.
The provider-free normalization module
owns the Terraform input schema, relative-name handling, TTL defaults, and stable
resource keys. Each logical key can contain several record-type members; dsp
selects global, dc1, or all. Explicit member TTLs preserve shared apex and
mail settings. The normalization module remains an internal dependency of each
owner’s Terraform DNS module.
Owner-local roots receive their provider credentials and Vault HTTP state
backend through the existing AL configuration. Standalone roots can use the
infra_terraform_dns macro to package their Terraform
configuration and Bazel commands. The shared module resolves the
Cloudflare zone by name when no optional zone ID is provided. DNS and ingress
reuse the RouterOS endpoint declared in the shared AL configuration,
while their separate credentials remain in Vault. Neither integration requires
adding metadata fields to the existing credential entries.
Validate their source with the
owning package’s offline checks. A live plan, import, apply, or state operation
requires separate authorization for that owner and operation.
Run tf.plan and interactive tf.apply from the owner’s DNS package.
Service commands retain their own AL settings, providers, and backends.
Transfer from service state
The consolidation change
introduces independent roots for the owners below. Each new root uses the
same AppRole and a distinct tf_backend/dns path under that AppRole.
Freeze both writers before using the new revision. Complete the state transfer
before running ordinary plan or apply from this revision. A DNS plan against a
fresh backend can propose creation. A service plan against its old state can
fail or propose removal. Use the prior revision to inspect and relinquish the
old bindings.
| Owner | Previous root |
|---|
| Flux | //infra/flux/tf_setup |
| Forgejo | //infra/forgejo/tf_setup |
| Harbor | //infra/harbor/tf_setup |
| Ingress | //infra/ingress/tf |
| OpenHands | //infra/openhands/tf_setup |
| Proxmox | //infra/pve/tf |
| 3x-ui | //infra/threexui/tf_setup |
| Vault | //infra/vault/tf_setup |
| Xen Orchestra | //infra/xcp_ng/tf |
| alwaldend.com | //projects/alwaldend.com/tf |
- Obtain explicit authorization for the source state removal and the
destination imports for one owner. Freeze all writers to both backends,
record the prior deployed revision, and verify an independent recovery
path for infrastructure endpoints.
- Inspect both states using their owning wrappers. Verify the destination
is absent or empty, and check each managed source DNS address and exact
provider ID against the declaration and provider inventory. Cloudflare
imports use
zone_id/record_id. RouterOS imports use the static row ID.
Keep that inventory private and preserve a recoverable KV version of the
original state. - From the prior revision, use the previous root’s state target to review
rm -dry-run module.dns. Require every address to match the reviewed DNS
inventory or a DNS data source under the same module. Run the separately
authorized state removal and verify the scope. The previous revision retains
the provider configuration needed to inspect the original bindings. - In the new
dns/ root, import each reviewed provider ID at the same
Terraform address with tf.import -- <address> <id>. If an import fails,
inspect both states before resuming and import only the missing bindings. - Review a fresh DNS
tf.plan and a service plan
against the new revision. Require zero DNS additions, changes, replacements,
or deletions in both. Verify provider IDs and authoritative DNS answers,
then release the writer freeze.
If a transfer cannot finish, keep both writers frozen. Reconcile back to a
single owner using the reviewed state inventory and the prior revision before
resuming normal operations.
Migration and recovery
The migration change and
cutover runbook
describe adoption, imports, recovery, and retirement requirements. Each owner’s
adoption change records its verified live transfer; source implementation alone
does not establish operational ownership. The completed coordination record
links the operational acceptance evidence and its coverage limits.
Current source no longer exposes the central DNSControl deployment commands.
Before an owner begins Terraform reconciliation, stop central deployment jobs
identified by the active and scheduled writer audit. Record coverage and
unavailable observations, and coordinate one owner at a time. Adopt existing
records into the owner’s state with an exact-ID, no-change plan. Fresh complete
inventories may establish missing declarations for a separately reviewed
additions-only plan that preserves all existing records.
Rollback requires stopping the affected Terraform writers and following the
runbook’s recorded prior revision and state-reconciliation procedure.
Deployment snapshots are not maintained here. The declaration pages above
reflect their last manual refresh; each owner’s declarations remain the
authoritative inventory.
33.1 - Cloudflare DNS
Records declared for the public zone served by Cloudflare
Every record this repository declares for the public zone, which Cloudflare serves.
This page is generated from the declarations; run bazel run //infra/dns/cmd/dump -- --write after changing them. The authoritative source is each owner’s dnsconfig.json.
| Domain | Type | TTL | Value | Declaration |
|---|
| @ | A | 300 | 185.199.108.153 | infra/dns/dnsconfig.json |
| @ | A | 300 | 185.199.109.153 | infra/dns/dnsconfig.json |
| @ | A | 300 | 185.199.110.153 | infra/dns/dnsconfig.json |
| @ | A | 300 | 185.199.111.153 | infra/dns/dnsconfig.json |
| @ | AAAA | 300 | 2606:50c0:8000::153 | infra/dns/dnsconfig.json |
| @ | AAAA | 300 | 2606:50c0:8001::153 | infra/dns/dnsconfig.json |
| @ | AAAA | 300 | 2606:50c0:8002::153 | infra/dns/dnsconfig.json |
| @ | AAAA | 300 | 2606:50c0:8003::153 | infra/dns/dnsconfig.json |
| @ | MX | 300 | 10 mail.protonmail.ch. | infra/dns/dnsconfig.json |
| @ | MX | 300 | 20 mailsec.protonmail.ch. | infra/dns/dnsconfig.json |
| @ | TXT | 300 | _globalsign-domain-verification=0QBJgVV_uwcFLTi1Rot3bb1LyJ5uW1WD0ygvIS4OM5 | infra/dns/dnsconfig.json |
| @ | TXT | 300 | protonmail-verification=bdcd133d3f472fa17f66328950d02fbeae1bef75 | infra/dns/dnsconfig.json |
| @ | TXT | 300 | v=spf1 include:_spf.protonmail.ch ~all | infra/dns/dnsconfig.json |
| _dmarc | TXT | 300 | v=DMARC1; p=quarantine; adkim=s | infra/dns/dnsconfig.json |
| _dmarc.simplelogin | TXT | 10800 | v=DMARC1; p=quarantine; pct=100; adkim=s; aspf=s | infra/dns/dnsconfig.json |
| canvas.openhands | CNAME | default | ingress.alwaldend.com. | infra/openhands/dnsconfig.json |
| cloud | CNAME | default | ingress.alwaldend.com. | infra/nas/dnsconfig.json |
| dc1.automation.openhands | A | default | 192.168.10.92 | infra/openhands/dnsconfig.json |
| dc1.canvas.openhands | A | default | 192.168.10.90 | infra/openhands/dnsconfig.json |
| dc1.cloud | A | default | 192.168.1.209 | infra/nas/dnsconfig.json |
| dc1.host-bot.simeonwarren.users | A | default | 192.168.1.210 | users/simeonwarren/host_bot/dnsconfig.json |
| dc1.server.openhands | A | default | 192.168.10.91 | infra/openhands/dnsconfig.json |
| dc1.t3code.host-bot.simeonwarren.users | A | default | 192.168.1.210 | users/simeonwarren/host_bot/dnsconfig.json |
| dkim._domainkey.simplelogin | CNAME | 10800 | dkim._domainkey.simplelogin.co. | infra/dns/dnsconfig.json |
| dkim02._domainkey.simplelogin | CNAME | 10800 | dkim02._domainkey.simplelogin.co. | infra/dns/dnsconfig.json |
| dkim03._domainkey.simplelogin | CNAME | 10800 | dkim03._domainkey.simplelogin.co. | infra/dns/dnsconfig.json |
| forgejo | CNAME | default | ingress.alwaldend.com. | infra/forgejo/dnsconfig.json |
| git | CNAME | default | ingress.alwaldend.com. | infra/forgejo/dnsconfig.json |
| host1.ingress | A | default | 81.26.185.118 | infra/ingress/dnsconfig.json |
| ingress | A | default | 81.26.185.118 | infra/ingress/dnsconfig.json |
| int.forgejo | A | default | 192.168.10.40 | infra/forgejo/dnsconfig.json |
| int.vault | A | default | 192.168.1.218 | infra/vault/dnsconfig.json |
| mail._domainkey.yandex | TXT | 300 | v=DKIM1; k=rsa; t=s; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCcYzFVgkeDOhaIIkWM8gNQjxVsv0/aXfU+ax5urB5y6hA6lSjRnjRo6tm0bXbkOJf41GmiwMNgdXpwRtzgzAlX1i2aJbtEr4b9jzibEGLQ7Cvqs44bOYES9f/K3ueQpnvdTOJmFqlRReFL7ZrUyDFCoQ7f4+7h4i8s01cCcRrt5wIDAQAB | infra/dns/dnsconfig.json |
| njalla1.nodes.threexui | A | default | 45.142.141.133 | infra/threexui/dnsconfig.json |
| njalla1.nodes.threexui | AAAA | default | 2a0a:3840:8078:141:0:2d8e:8d85:1337 | infra/threexui/dnsconfig.json |
| pages | A | default | 185.199.108.153 | projects/alwaldend.com/dnsconfig.json |
| pages | AAAA | default | 2606:50c0:8000::153 | projects/alwaldend.com/dnsconfig.json |
| protonmail._domainkey | CNAME | 300 | protonmail.domainkey.djgwfzcu5fgjtpoijqqomgifmqj6zeiuwdd4mzim4hrxab3zsgwkq.domains.proton.ch. | infra/dns/dnsconfig.json |
| protonmail2._domainkey | CNAME | 300 | protonmail2.domainkey.djgwfzcu5fgjtpoijqqomgifmqj6zeiuwdd4mzim4hrxab3zsgwkq.domains.proton.ch. | infra/dns/dnsconfig.json |
| protonmail3._domainkey | CNAME | 300 | protonmail3.domainkey.djgwfzcu5fgjtpoijqqomgifmqj6zeiuwdd4mzim4hrxab3zsgwkq.domains.proton.ch. | infra/dns/dnsconfig.json |
| simplelogin | MX | 10800 | 10 mx1.simplelogin.co. | infra/dns/dnsconfig.json |
| simplelogin | MX | 10800 | 20 mx2.simplelogin.co. | infra/dns/dnsconfig.json |
| simplelogin | TXT | 10800 | sl-verification=bxfzzfjiggzsxyzxhhmkmjqkaskjgy | infra/dns/dnsconfig.json |
| simplelogin | TXT | 10800 | v=spf1 include:simplelogin.co ~all | infra/dns/dnsconfig.json |
| t3code.host-bot.simeonwarren.users | CNAME | default | ingress.alwaldend.com. | users/simeonwarren/host_bot/dnsconfig.json |
| vault | CNAME | default | ingress.alwaldend.com. | infra/vault/dnsconfig.json |
| www | CNAME | 300 | alwaldend.com. | infra/dns/dnsconfig.json |
| www-staging | CNAME | 300 | alwaldend.github.io. | infra/dns/dnsconfig.json |
| yandex | MX | 21600 | 10 mx.yandex.net. | infra/dns/dnsconfig.json |
| yandex | TXT | 300 | v=spf1 redirect=_spf.yandex.net | infra/dns/dnsconfig.json |
| yandex | TXT | 300 | yandex-verification: b83672f59b3dbe16 | infra/dns/dnsconfig.json |
| yc.threexui | NS | default | ns1.yandexcloud.net. | infra/threexui/dnsconfig.json |
| yc.threexui | NS | default | ns2.yandexcloud.net. | infra/threexui/dnsconfig.json |
| yc1.nodes.threexui | CNAME | default | host1.nodes.yc.threexui.alwaldend.com. | infra/threexui/dnsconfig.json |
33.2 - Mikrotik DNS
Records declared for the internal dc1 view served by RouterOS
Every record this repository declares for the internal dc1 view, which RouterOS serves for that network.
This page is generated from the declarations; run bazel run //infra/dns/cmd/dump -- --write after changing them. The authoritative source is each owner’s dnsconfig.json.
| Domain | Type | TTL | Value | Declaration |
|---|
| @ | A | 300 | 185.199.108.153 | infra/dns/dnsconfig.json |
| @ | A | 300 | 185.199.109.153 | infra/dns/dnsconfig.json |
| @ | A | 300 | 185.199.110.153 | infra/dns/dnsconfig.json |
| @ | A | 300 | 185.199.111.153 | infra/dns/dnsconfig.json |
| @ | AAAA | 300 | 2606:50c0:8000::153 | infra/dns/dnsconfig.json |
| @ | AAAA | 300 | 2606:50c0:8001::153 | infra/dns/dnsconfig.json |
| @ | AAAA | 300 | 2606:50c0:8002::153 | infra/dns/dnsconfig.json |
| @ | AAAA | 300 | 2606:50c0:8003::153 | infra/dns/dnsconfig.json |
| @ | MX | 300 | 10 mail.protonmail.ch. | infra/dns/dnsconfig.json |
| @ | MX | 300 | 20 mailsec.protonmail.ch. | infra/dns/dnsconfig.json |
| @ | TXT | 300 | _globalsign-domain-verification=0QBJgVV_uwcFLTi1Rot3bb1LyJ5uW1WD0ygvIS4OM5 | infra/dns/dnsconfig.json |
| @ | TXT | 300 | protonmail-verification=bdcd133d3f472fa17f66328950d02fbeae1bef75 | infra/dns/dnsconfig.json |
| @ | TXT | 300 | v=spf1 include:_spf.protonmail.ch ~all | infra/dns/dnsconfig.json |
| _dmarc | TXT | 300 | v=DMARC1; p=quarantine; adkim=s | infra/dns/dnsconfig.json |
| _dmarc.simplelogin | TXT | 10800 | v=DMARC1; p=quarantine; pct=100; adkim=s; aspf=s | infra/dns/dnsconfig.json |
| automation.openhands | A | default | 192.168.10.92 | infra/openhands/dnsconfig.json |
| bm1.dc1 | A | default | 192.168.1.222 | infra/mikrotik/dnsconfig.json |
| bm2.dc1 | A | default | 192.168.1.216 | infra/pve/dnsconfig.json |
| bm2.dc1 | AAAA | default | fd2e:546d:5738:0:365a:60ff:fe08:6daa | infra/pve/dnsconfig.json |
| bm3.dc1 | A | default | 192.168.1.218 | infra/vault/dnsconfig.json |
| bm3.dc1 | AAAA | default | fd2e:546d:5738:0:e2be:3ff:fe2b:9a1a | infra/vault/dnsconfig.json |
| canvas.openhands | A | default | 192.168.10.90 | infra/openhands/dnsconfig.json |
| cloud | CNAME | default | nas.alwaldend.com. | infra/nas/dnsconfig.json |
| cloudinit-test.vm.pve1.dc1 | A | default | 192.168.10.10 | infra/pve/dnsconfig.json |
| dc1.automation.openhands | A | default | 192.168.10.92 | infra/openhands/dnsconfig.json |
| dc1.canvas.openhands | A | default | 192.168.10.90 | infra/openhands/dnsconfig.json |
| dc1.cloud | A | default | 192.168.1.209 | infra/nas/dnsconfig.json |
| dc1.host-bot.simeonwarren.users | A | default | 192.168.1.210 | users/simeonwarren/host_bot/dnsconfig.json |
| dc1.server.openhands | A | default | 192.168.10.91 | infra/openhands/dnsconfig.json |
| dc1.t3code.host-bot.simeonwarren.users | A | default | 192.168.1.210 | users/simeonwarren/host_bot/dnsconfig.json |
| dkim._domainkey.simplelogin | CNAME | 10800 | dkim._domainkey.simplelogin.co. | infra/dns/dnsconfig.json |
| dkim02._domainkey.simplelogin | CNAME | 10800 | dkim02._domainkey.simplelogin.co. | infra/dns/dnsconfig.json |
| dkim03._domainkey.simplelogin | CNAME | 10800 | dkim03._domainkey.simplelogin.co. | infra/dns/dnsconfig.json |
| flux | A | default | 192.168.10.60 | infra/flux/dnsconfig.json |
| forgejo | A | default | 192.168.10.40 | infra/forgejo/dnsconfig.json |
| git | A | default | 192.168.10.40 | infra/forgejo/dnsconfig.json |
| harbor | A | default | 192.168.10.50 | infra/harbor/dnsconfig.json |
| host-bot.simeonwarren.users | A | default | 192.168.1.210 | users/simeonwarren/host_bot/dnsconfig.json |
| host1.automation.openhands | A | default | 192.168.10.92 | infra/openhands/dnsconfig.json |
| host1.canvas.openhands | A | default | 192.168.10.90 | infra/openhands/dnsconfig.json |
| host1.cloud | CNAME | default | host1.nas.alwaldend.com. | infra/nas/dnsconfig.json |
| host1.flux | A | default | 192.168.10.60 | infra/flux/dnsconfig.json |
| host1.forgejo | A | default | 192.168.10.40 | infra/forgejo/dnsconfig.json |
| host1.harbor | A | default | 192.168.10.50 | infra/harbor/dnsconfig.json |
| host1.ingress | A | default | 81.26.185.118 | infra/ingress/dnsconfig.json |
| host1.nas | A | default | 192.168.1.209 | infra/nas/dnsconfig.json |
| host1.pve1.dc1 | CNAME | default | bm2.dc1.alwaldend.com. | infra/pve/dnsconfig.json |
| host1.server.openhands | A | default | 192.168.10.91 | infra/openhands/dnsconfig.json |
| host1.threexui | A | default | 192.168.10.80 | infra/threexui/dnsconfig.json |
| host1.vault.dc1 | A | default | 192.168.1.218 | infra/vault/dnsconfig.json |
| host1.xcp-ng | A | default | 192.168.1.213 | infra/xcp_ng/dnsconfig.json |
| host1.xoa.xcp-ng | A | default | 192.168.1.206 | infra/xcp_ng/dnsconfig.json |
| ingress | A | default | 81.26.185.118 | infra/ingress/dnsconfig.json |
| mail._domainkey.yandex | TXT | 300 | v=DKIM1; k=rsa; t=s; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCcYzFVgkeDOhaIIkWM8gNQjxVsv0/aXfU+ax5urB5y6hA6lSjRnjRo6tm0bXbkOJf41GmiwMNgdXpwRtzgzAlX1i2aJbtEr4b9jzibEGLQ7Cvqs44bOYES9f/K3ueQpnvdTOJmFqlRReFL7ZrUyDFCoQ7f4+7h4i8s01cCcRrt5wIDAQAB | infra/dns/dnsconfig.json |
| nas | A | default | 192.168.1.209 | infra/nas/dnsconfig.json |
| njalla1.nodes.threexui | A | default | 45.142.141.133 | infra/threexui/dnsconfig.json |
| njalla1.nodes.threexui | AAAA | default | 2a0a:3840:8078:141:0:2d8e:8d85:1337 | infra/threexui/dnsconfig.json |
| openid.flux | CNAME | default | flux.alwaldend.com. | infra/flux/dnsconfig.json |
| operator.flux | CNAME | default | flux.alwaldend.com. | infra/flux/dnsconfig.json |
| protonmail._domainkey | CNAME | 300 | protonmail.domainkey.djgwfzcu5fgjtpoijqqomgifmqj6zeiuwdd4mzim4hrxab3zsgwkq.domains.proton.ch. | infra/dns/dnsconfig.json |
| protonmail2._domainkey | CNAME | 300 | protonmail2.domainkey.djgwfzcu5fgjtpoijqqomgifmqj6zeiuwdd4mzim4hrxab3zsgwkq.domains.proton.ch. | infra/dns/dnsconfig.json |
| protonmail3._domainkey | CNAME | 300 | protonmail3.domainkey.djgwfzcu5fgjtpoijqqomgifmqj6zeiuwdd4mzim4hrxab3zsgwkq.domains.proton.ch. | infra/dns/dnsconfig.json |
| pve | A | default | 192.168.1.216 | infra/pve/dnsconfig.json |
| router1.dc1 | A | default | 192.168.1.1 | infra/mikrotik/dnsconfig.json |
| router1.dc1 | AAAA | default | fd2e:546d:5738::1 | infra/mikrotik/dnsconfig.json |
| runner1.forgejo-runner | A | default | 192.168.10.100 | infra/forgejo_runner/dnsconfig.json |
| server.openhands | A | default | 192.168.10.91 | infra/openhands/dnsconfig.json |
| simplelogin | MX | 10800 | 10 mx1.simplelogin.co. | infra/dns/dnsconfig.json |
| simplelogin | MX | 10800 | 20 mx2.simplelogin.co. | infra/dns/dnsconfig.json |
| simplelogin | TXT | 10800 | sl-verification=bxfzzfjiggzsxyzxhhmkmjqkaskjgy | infra/dns/dnsconfig.json |
| simplelogin | TXT | 10800 | v=spf1 include:simplelogin.co ~all | infra/dns/dnsconfig.json |
| switch1.dc1 | A | default | 192.168.1.254 | infra/mikrotik/dnsconfig.json |
| t3code.host-bot.simeonwarren.users | A | default | 192.168.1.210 | users/simeonwarren/host_bot/dnsconfig.json |
| threexui | A | default | 192.168.10.80 | infra/threexui/dnsconfig.json |
| vault | A | default | 192.168.1.218 | infra/vault/dnsconfig.json |
| vault.dc1 | A | default | 192.168.1.218 | infra/vault/dnsconfig.json |
| www | CNAME | 300 | alwaldend.com. | infra/dns/dnsconfig.json |
| www-staging | CNAME | 300 | alwaldend.github.io. | infra/dns/dnsconfig.json |
| xcp-ng | A | default | 192.168.1.213 | infra/xcp_ng/dnsconfig.json |
| xoa.xcp-ng | A | default | 192.168.1.206 | infra/xcp_ng/dnsconfig.json |
| yandex | MX | 21600 | 10 mx.yandex.net. | infra/dns/dnsconfig.json |
| yandex | TXT | 300 | v=spf1 redirect=_spf.yandex.net | infra/dns/dnsconfig.json |
| yandex | TXT | 300 | yandex-verification: b83672f59b3dbe16 | infra/dns/dnsconfig.json |
| yc.threexui | NS | default | ns1.yandexcloud.net. | infra/threexui/dnsconfig.json |
| yc.threexui | NS | default | ns2.yandexcloud.net. | infra/threexui/dnsconfig.json |
| yc1.nodes.threexui | CNAME | default | host1.nodes.yc.threexui.alwaldend.com. | infra/threexui/dnsconfig.json |
33.3 - OpenSpec
33.3.1 - Infrastructure DNS
Purpose
Describe owner-local Terraform DNS declarations and runtime source-ownership
validation for global and dc1 records. This contract describes checked-in
source; it does not establish live adoption or authorize infrastructure writes.
Sources: component documentation,
target definitions,
runtime linter, and
shared Terraform packaging.
Requirements
Requirement: Aggregate records from their owning components
DNS declarations SHALL remain in their owners’ dns/dnsconfig.json files. Runtime
inventory SHALL discover all canonical files, including nested modules and
empty declarations, without a checked-in ownership registry. The inventory
SHALL print a deterministic table of files, DNS names, types and views.
Project landing declarations retain their declared direct targets.
Scenario: A new project adds a canonical declaration
- WHEN the runtime linter scans a workspace containing the new file
- THEN it includes the file without requiring a registry update
Requirement: Preserve distinct global and site-local views
The Terraform module SHALL preserve Cloudflare global and MikroTik dc1 views.
It SHALL retain every type member, expand and deduplicate destinations, reject
unknown inputs and preserve effective values, TTLs, priorities and multiplicity.
Scenario: An entry declares A and AAAA in all views
- WHEN the shared module normalizes the entry
- THEN both types appear exactly once in each destination view
- WHEN a record names an unsupported destination
- THEN normalization fails with an actionable diagnostic
Requirement: Validate configuration without provider access
The linter and module tests SHALL validate source ownership, names, inputs,
normalization and provider mappings without credentials or live provider access.
Existing JSON-based VM consumers SHALL remain compatible.
Scenario: Validate a changed declaration
- WHEN offline checks run
- THEN they validate the declaration and fixtures without deploying records
Requirement: Inject credentials into operational wrappers
Owner Terraform roots SHALL use the existing AL/Vault authentication, backend
and credential injection workflow. They SHALL obtain only their required view
credentials. Operational provider initialization may require live credentials
even with resource creation disabled. Central DNSControl write entrypoints
SHALL be removed from the candidate.
Scenario: A global-only owner operates its root
- WHEN an authorized operator invokes the root after bootstrap
- THEN it uses that owner’s AppRole and Cloudflare credentials
- AND RouterOS credentials and resources are not required
Terraform-managed DNS SHALL use the shared DNS packaging with an owner-local
dns/ root and state. Terraform DNS commands SHALL use the owner’s Vault
AppRole and DNS credentials without selecting service provisioning settings.
Service commands SHALL retain their independent state and authentication.
The root SHALL consume the owner’s canonical
dns/dnsconfig.json and use the provider views that owner requires. Provider
instance keys SHALL remain stable across value-only changes. Empty inventories
do not require an operational root.
Scenario: DNS currently shares provisioning state
- WHEN the DNS configuration moves to its dedicated root
- THEN the old root SHALL relinquish DNS bindings without deleting records
- AND the operator SHALL complete the state transfer before ordinary plans or applies from the new revision
- AND an authorized transfer SHALL import the same provider IDs and verify a no-change plan
- AND provisioning SHALL retain any canonical declaration inputs it uses for host configuration
Scenario: An owner already has independent DNS state
- WHEN the owner adopts shared packaging
- THEN its existing backend and Terraform resource addresses SHALL be preserved
Requirement: One declaration file owns each DNS name
The runtime linter SHALL reject different files managing the same canonical
fully qualified DNS name, across types and views. Multiple records within one
file SHALL be allowed. Diagnostics SHALL identify both files.
Scenario: Different files split a name across types or views
- WHEN one file declares an A record and another an AAAA record or a
different view for the same name
- THEN lint fails and identifies both source files
Scenario: One file manages multiple records for a name
- WHEN one file declares several values, types or views for a name
- THEN ownership lint accepts the sole source
Requirement: Preserve live records during transfer
Operational cutover SHALL audit active and scheduled central writers, stop
identified competing writers, and coordinate one owner at a time. Evidence
SHALL state the audit’s coverage and unavailable observations. Each existing
record SHALL be imported using its actual provider ID into exactly one owner
state, followed by a no-change adoption plan before writes. Fresh complete
inventories MAY establish missing declarations for an exact additions-only
plan that preserves every existing record. Endpoint-owning batches SHALL
verify an independent authenticated recovery path first.
The shared apex and mail records owned by infra/dns SHALL remain disabled
by default in its tf root before the authorized adoption revision and SHALL
retain enabled ownership after import. Reconciliation against the adopted state
and unchanged declarations SHALL propose no record additions, changes,
replacements, or deletions and SHALL preserve unrelated provider records.
Scenario: An owner is adopted
- WHEN its authorized cutover runs
- THEN exact-ID imports preserve existing records
- AND the operator coordinates exclusive active writers and verifies
unrelated records remain unchanged
Scenario: Deploy verified missing declarations
- WHEN complete provider inventories establish that declared names are absent
and conflict-free
- THEN the reviewed DNS plan creates only those missing declarations
- AND every existing provider identity and attribute remains unchanged
- AND a follow-up DNS plan contains no changes
Scenario: Inspect the prepared shared-record defaults
- WHEN the shared
tf root uses its checked-in defaults before its
authorized adoption revision - THEN shared-record ownership is disabled and the root retains the
canonical shared declaration and module inputs
Scenario: Inspect adopted shared-record defaults
- WHEN the adopted shared
tf root uses its checked-in source defaults - THEN ownership is enabled for the shared apex and mail records in
their declared views
Scenario: Reconcile existing shared records
- WHEN the shared
tf root plans against adopted state and unchanged declarations - THEN it proposes no record additions, changes, replacements, or deletions
- AND unrelated provider records remain unchanged
Requirement: Avoid a separate DNS exporter
The implementation SHALL derive its declaration views from the owning
dnsconfig.json files rather than maintaining a normalized inventory or BIND
exporter. Historical provider snapshots SHALL NOT be presented as current
desired state, and no provider snapshot SHALL be committed as a declaration
source.
Scenario: Inspect declared ownership
- WHEN the runtime linter succeeds
- THEN its table reports the discovered declarations without an export step
Requirement: Publish declaration pages per destination view
The implementation SHALL render one documentation page per destination view
from the declared records, with the owning declaration for every record.
Regeneration SHALL require an explicit manual command. Ordinary validation
SHALL check declarations and ownership without requiring checked-in pages to
match the declarations or rewriting those pages. Documentation SHALL identify
the declarations as authoritative and explain that snapshots may lag.
Scenario: Regenerate a declaration page
- WHEN an operator explicitly runs the documentation generation command
- THEN each destination page lists the current declarations with their owner
- AND an explicit freshness check succeeds against the regenerated pages
Scenario: A declaration page is stale
- WHEN a declaration changes while its checked-in page remains unchanged
- THEN ordinary declaration validation does not fail because of that stale page
- AND the page is not rewritten unless regeneration is explicitly invoked
Scenario: Check freshness on demand
- WHEN an operator explicitly checks a stale page
- THEN the command reports that regeneration is needed
33.4 - Shared DNS Terraform
Owner state for common apex and mail records
This root consumes the canonical common declarations
through the reusable DNS module. It uses the src_infra_dns AppRole and its
existing Vault-backed HTTP state. Both Cloudflare and RouterOS credentials
are injected through the tf=1 stage label.
Shared apex and mail records were adopted on 2026-09-13. dns_enabled now
defaults to true; reconciliation against the adopted state and unchanged
declarations must propose no record changes. The adoption evidence
records 60 imports and preservation of both complete provider inventories.
Operational calls require the AppRole policy and Vault credential fields
described by the cutover procedure.
The module’s import_addresses output gives addresses relative to module.dns;
actual provider IDs come from the authorized adoption inventory.
Build the wrappers or run :tf_tests.fmt_test for offline validation. Import,
plan and apply follow the separately authorized adoption procedure.
33.5 - Shared Terraform DNS roots
Bazel entry point for owner-local DNS deployments
infra_terraform_dns packages a Terraform root in an owner’s dedicated DNS
Bazel package. Pass the owner’s AL configuration and declare the local
:dnsconfig filegroup for dnsconfig.json.
load("//infra/dns/terraform:defs.bzl", "infra_terraform_dns")
infra_terraform_dns(
name = "tf",
configs = [":al"],
)
The default root uses Cloudflare. Set dc1 = True when the owner also uses
RouterOS. The AL configuration must select the matching DNS credentials and
the owner’s Vault HTTP backend. The macro exposes the standard tf.*
commands and offline tf_tests.* checks.
Use infra_terraform_dns_config to compose the owner’s AppRole with a distinct
Vault backend and DNS-only credential injection selected by tf=dns.
Keep that configuration separate from service commands. Existing DNS-only
roots can pass their existing selectors and state configuration. Follow the
state transfer procedure before
operating a root extracted from service state.
34 - Mikrotik
DC1 RouterOS configuration, router DNS, and service accounts
The Terraform package prepares owner-local DNS management.
Router exports remain documentation inputs and are not applied by that package.
The separate accounts package provisions the dedicated
RouterOS account and Vault credential consumed by printers.
Printer DNS and its Wi-Fi exception belong to that project. Follow its
state migration before applying the DNS
root after this move.
DC1 architecture
This diagram describes the maintained architecture source, not live inventory or service health.
The Mermaid source is authoritative; Bazel renders its light and dark SVGs.


Deployment
- Open Winbox
- Open new terminal
- Run
/export - Copy output
Links
Exports
Router1
/interface bridge
add admin-mac=78:9A:18:38:6C:CA auto-mac=no comment="bridge1 (wired)" name=bridge1
add comment="bridge2 (wireless)" name=bridge2
/interface wifi
set [ find default-name=wifi1 ] channel.frequency=5000-5400 .skip-dfs-channels=10min-cac comment="wifi1 (5GHz)" configuration.country=Russia .mode=ap .ssid=divinity-5GHz datapath.client-isolation=yes disabled=no security.authentication-types=wpa2-psk,wpa3-psk .connect-priority=0 .ft=yes .ft-over-ds=yes
set [ find default-name=wifi2 ] channel.skip-dfs-channels=10min-cac comment="wifi2 (2GHz)" configuration.country=Russia .mode=ap .ssid=divinity-2GHz datapath.client-isolation=yes disabled=no security.authentication-types=wpa2-psk,wpa3-psk .connect-priority=0 .ft=yes .ft-over-ds=yes
/interface ethernet
set [ find default-name=ether1 ] comment=ether1 l2mtu=1500 mac-address=F4:28:53:7F:A4:59
set [ find default-name=ether2 ] comment=ether2
set [ find default-name=ether3 ] comment=ether3
set [ find default-name=ether4 ] comment=ether4
set [ find default-name=ether5 ] comment=ether5
/interface wireguard
add comment="tf[users/simeonwarren/hermes/tf_setup]" disabled=yes listen-port=13232 mtu=1420 name=hermes-vpc
add comment="tf[infra/ingress/tf]" listen-port=13231 mtu=1420 name=ingress-vpc
/interface ethernet switch
set switch1 cpu-flow-control=yes
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
add name=accept-forward-WAN
add name=accept-input-DNS
add name=accept-input-DHCP-server
add name=accept-input-ICMP
add name=accept-input-winbox
add name=accept-input-web-ui
add name=accept-input-mikrotik-neighbor-discovery
add name=accept-forward-LAN
add name=accept-output-LAN
add name=accept-input-NTP
add name=accept-input-API
/ip pool
add comment=bridge1 name=bridge1 ranges=192.168.1.10-192.168.1.254
add comment=bridge2 name=bridge2 ranges=192.168.2.10-192.168.2.254
/ip dhcp-server
add address-pool=bridge1 comment=bridge1 interface=bridge1 lease-time=10m name=bridge1
add address-pool=bridge2 interface=bridge2 name=bridge2
/ipv6 pool
add name=dc01 prefix=fd2e:546d:5738::/48 prefix-length=64
/user group
add comment=src_infra_dns name=src_infra_dns policy=read,write,api,rest-api,!local,!telnet,!ssh,!ftp,!reboot,!policy,!test,!winbox,!password,!web,!sniff,!sensitive,!romon
add comment=src_infra_ingress name=src_infra_ingress policy=read,write,api,rest-api,!local,!telnet,!ssh,!ftp,!reboot,!policy,!test,!winbox,!password,!web,!sniff,!sensitive,!romon
add comment=users_simeonwarren name=users_simeonwarren policy=read,write,api,rest-api,!local,!telnet,!ssh,!ftp,!reboot,!policy,!test,!winbox,!password,!web,!sniff,!sensitive,!romon
/interface bridge port
add bridge=bridge1 comment=bridge1-ether2 interface=ether2
add bridge=bridge1 comment=bridge1-ether3 interface=ether3
add bridge=bridge1 comment=bridge1-ether4 interface=ether4
add bridge=bridge1 comment=bridge1-ether5 interface=ether5
add bridge=bridge2 comment=bridge2-wifi1 interface=wifi1
add bridge=bridge2 comment=bridge2-wifi2 interface=wifi2
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface detect-internet
set detect-interface-list=WAN
/interface list member
add interface=bridge1 list=LAN
add interface=ether1 list=WAN
add interface=bridge2 list=LAN
add interface=bridge2 list=accept-forward-WAN
add interface=bridge1 list=accept-forward-WAN
add interface=bridge1 list=accept-input-DNS
add interface=bridge2 list=accept-input-DNS
add interface=bridge1 list=accept-input-DHCP-server
add interface=bridge2 list=accept-input-DHCP-server
add interface=bridge1 list=accept-input-ICMP
add interface=bridge2 list=accept-input-ICMP
add interface=bridge1 list=accept-input-winbox
add interface=bridge1 list=accept-input-web-ui
add interface=bridge1 list=accept-input-mikrotik-neighbor-discovery
add interface=bridge1 list=accept-forward-LAN
add interface=bridge1 list=accept-output-LAN
add interface=bridge1 list=accept-input-NTP
add interface=bridge1 list=accept-input-API
add comment="tf[infra/ingress/tf]" interface=ingress-vpc list=accept-input-ICMP
add comment="tf[infra/ingress/tf]" interface=ingress-vpc list=LAN
add comment="tf[infra/ingress/tf]" interface=ingress-vpc list=accept-forward-LAN
add comment="tf[users/simeonwarren/hermes/tf_setup]" interface=hermes-vpc list=accept-forward-LAN
add comment="tf[users/simeonwarren/hermes/tf_setup]" interface=hermes-vpc list=accept-input-ICMP
add comment="tf[users/simeonwarren/hermes/tf_setup]" interface=hermes-vpc list=LAN
/interface ovpn-server server
add mac-address=FE:B3:B4:C4:A4:48 name=ovpn-server1
/interface wireguard peers
add allowed-address=10.10.0.2/24 comment=host2 endpoint-address=103.76.53.6 endpoint-port=51820 interface=ingress-vpc name=ingress-vpc-host2 persistent-keepalive=5s public-key="Z2JamOjZYOGaf4tPZzchyHjLw/XlOtUtQObyROEQ9DM="
add allowed-address=10.10.0.1/24 comment=host1 endpoint-address=158.160.196.128 endpoint-port=51820 interface=ingress-vpc name=ingress-vpc-host1 persistent-keepalive=5s public-key="xmyl+frvngmzRB9z5yEURxQj4vTw47tKQV7EZrTAREw="
add allowed-address=10.20.0.1/24 comment=host1 endpoint-address=158.160.220.223 endpoint-port=51820 interface=hermes-vpc name=hermes-vpc-host1 persistent-keepalive=5s public-key="oA4ZpsmrclIOIWh3ECsb4ZFKH1hQMDtuW3xNXat3IyQ="
/ip settings
set send-redirects=no
/ip address
add address=192.168.1.1/24 comment="bridge1 (LAN)" interface=bridge1 network=192.168.1.0
add address=192.168.2.1/24 comment="bridge2 (Wireless)" interface=bridge2 network=192.168.2.0
add address=192.168.10.1/24 comment=host1.pve1.dc1.alwaldend.com interface=bridge1 network=192.168.10.0
add address=10.10.0.0/24 comment="tf[infra/ingress/tf]" interface=ingress-vpc network=10.10.0.0
add address=10.20.0.0/24 comment="tf[users/simeonwarren/hermes/tf_setup]" interface=hermes-vpc network=10.20.0.0
/ip dhcp-client
add comment=defconf interface=ether1 name=ether1 use-peer-dns=no
/ip dhcp-server lease
add address=192.168.1.250 client-id=1:2c:cf:67:67:b5:13 mac-address=2C:CF:67:67:B5:13 server=bridge1
add address=192.168.1.218 client-id=1:e0:be:3:2b:9a:1a mac-address=E0:BE:03:2B:9A:1A server=bridge1
add address=192.168.1.216 client-id=ff:60:8:6d:aa:0:1:0:1:31:93:31:1a:34:5a:60:8:6d:aa mac-address=34:5A:60:08:6D:AA server=bridge1
/ip dhcp-server network
add address=192.168.1.0/24 comment=defconf dns-server=192.168.1.1 gateway=192.168.1.1
add address=192.168.2.0/24 dns-server=192.168.2.1 gateway=192.168.2.1
/ip dns
set allow-remote-requests=yes servers=1.1.1.2,1.0.0.2 use-doh-server=https://odoh.cloudflare-dns.com/dns-query verify-doh-cert=yes
/ip dns static
add address=185.199.108.153 name=alwaldend.com ttl=5m type=A
add address=185.199.109.153 name=alwaldend.com ttl=5m type=A
add address=185.199.110.153 name=alwaldend.com ttl=5m type=A
add address=185.199.111.153 name=alwaldend.com ttl=5m type=A
add address=2606:50c0:8000::153 name=alwaldend.com ttl=5m type=AAAA
add address=2606:50c0:8001::153 name=alwaldend.com ttl=5m type=AAAA
add address=2606:50c0:8002::153 name=alwaldend.com ttl=5m type=AAAA
add address=2606:50c0:8003::153 name=alwaldend.com ttl=5m type=AAAA
add mx-exchange=mail.protonmail.ch mx-preference=10 name=alwaldend.com ttl=5m type=MX
add mx-exchange=mailsec.protonmail.ch mx-preference=20 name=alwaldend.com ttl=5m type=MX
add name=alwaldend.com text="_globalsign-domain-verification=0QBJgVV_uwcFLTi1Rot3bb1LyJ5uW1WD0ygvIS4OM5" ttl=5m type=TXT
add name=alwaldend.com text="protonmail-verification=bdcd133d3f472fa17f66328950d02fbeae1bef75" ttl=5m type=TXT
add name=alwaldend.com text="v=spf1 include:_spf.protonmail.ch ~all" ttl=5m type=TXT
add name=_dmarc.alwaldend.com text="v=DMARC1; p=quarantine; adkim=s" ttl=5m type=TXT
add cname=protonmail.domainkey.djgwfzcu5fgjtpoijqqomgifmqj6zeiuwdd4mzim4hrxab3zsgwkq.domains.proton.ch name=protonmail._domainkey.alwaldend.com ttl=5m type=CNAME
add cname=protonmail2.domainkey.djgwfzcu5fgjtpoijqqomgifmqj6zeiuwdd4mzim4hrxab3zsgwkq.domains.proton.ch name=protonmail2._domainkey.alwaldend.com ttl=5m type=CNAME
add cname=protonmail3.domainkey.djgwfzcu5fgjtpoijqqomgifmqj6zeiuwdd4mzim4hrxab3zsgwkq.domains.proton.ch name=protonmail3._domainkey.alwaldend.com ttl=5m type=CNAME
add address=192.168.1.222 name=bm1.dc1.alwaldend.com ttl=5m type=A
add address=192.168.1.216 name=bm2.dc1.alwaldend.com ttl=5m type=A
add address=fd2e:546d:5738:0:365a:60ff:fe08:6daa name=bm2.dc1.alwaldend.com ttl=10m type=AAAA
add address=192.168.1.218 name=bm3.dc1.alwaldend.com ttl=5m type=A
add address=fd2e:546d:5738:0:e2be:3ff:fe2b:9a1a name=bm3.dc1.alwaldend.com ttl=10m type=AAAA
add cname=bm2.dc1.alwaldend.com name=host1.pve1.dc1.alwaldend.com ttl=10m type=CNAME
add address=192.168.10.10 name=cloudinit-test.vm.pve1.dc1.alwaldend.com ttl=5m type=A
add address=192.168.1.1 name=router1.dc1.alwaldend.com ttl=5m type=A
add address=fd2e:546d:5738::1 name=router1.dc1.alwaldend.com ttl=10m type=AAAA
add address=192.168.1.254 name=switch1.dc1.alwaldend.com ttl=5m type=A
add address=192.168.1.218 name=vault.dc1.alwaldend.com ttl=5m type=A
add mx-exchange=mx1.simplelogin.co mx-preference=10 name=simplelogin.alwaldend.com ttl=3h type=MX
add mx-exchange=mx2.simplelogin.co mx-preference=20 name=simplelogin.alwaldend.com ttl=3h type=MX
add name=simplelogin.alwaldend.com text="sl-verification=bxfzzfjiggzsxyzxhhmkmjqkaskjgy" ttl=3h type=TXT
add name=simplelogin.alwaldend.com text="v=spf1 include:simplelogin.co ~all" ttl=3h type=TXT
add name=_dmarc.simplelogin.alwaldend.com text="v=DMARC1; p=quarantine; pct=100; adkim=s; aspf=s" ttl=3h type=TXT
add cname=dkim._domainkey.simplelogin.co name=dkim._domainkey.simplelogin.alwaldend.com ttl=3h type=CNAME
add cname=dkim02._domainkey.simplelogin.co name=dkim02._domainkey.simplelogin.alwaldend.com ttl=3h type=CNAME
add cname=dkim03._domainkey.simplelogin.co name=dkim03._domainkey.simplelogin.alwaldend.com ttl=3h type=CNAME
add cname=alwaldend.com name=www.alwaldend.com ttl=5m type=CNAME
add mx-exchange=mx.yandex.net mx-preference=10 name=yandex.alwaldend.com ttl=6h type=MX
add name=yandex.alwaldend.com text="v=spf1 redirect=_spf.yandex.net" ttl=5m type=TXT
add name=yandex.alwaldend.com text="yandex-verification: b83672f59b3dbe16" ttl=5m type=TXT
add name=mail._domainkey.yandex.alwaldend.com text="v=DKIM1; k=rsa; t=s; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCcYzFVgkeDOhaIIkWM8gNQjxVsv0/aXfU+ax5urB5y6hA6lSjRnjRo6tm0bXbkOJf41GmiwMNgdXpwRtzgzAlX1i2aJbtEr4b9jzibEGLQ7Cvqs44bOYES9f/K3ueQpnvdTOJmFqlRReFL7ZrUyDFCoQ7f4+7h4i8s01cCcRrt5wIDAQAB" ttl=5m type=TXT
add address=192.168.1.218 name=host1.vault.dc1.alwaldend.com ttl=5m type=A
add address=192.168.10.60 name=flux.alwaldend.com ttl=5m type=A
add address=192.168.10.60 name=host1.flux.alwaldend.com ttl=5m type=A
add cname=flux.alwaldend.com name=openid.flux.alwaldend.com ttl=10m type=CNAME
add cname=flux.alwaldend.com name=operator.flux.alwaldend.com ttl=10m type=CNAME
add address=192.168.10.40 name=forgejo.alwaldend.com ttl=5m type=A
add address=192.168.10.40 name=host1.forgejo.alwaldend.com ttl=5m type=A
add address=192.168.10.50 name=harbor.alwaldend.com ttl=5m type=A
add address=192.168.10.50 name=host1.harbor.alwaldend.com ttl=5m type=A
add address=192.168.1.216 name=pve.alwaldend.com ttl=5m type=A
add address=192.168.10.80 name=threexui.alwaldend.com ttl=5m type=A
add address=192.168.10.80 name=host1.threexui.alwaldend.com ttl=5m type=A
add address=45.142.141.133 name=njalla1.nodes.threexui.alwaldend.com ttl=5m type=A
add address=2a0a:3840:8078:141:0:2d8e:8d85:1337 name=njalla1.nodes.threexui.alwaldend.com ttl=10m type=AAAA
add address=192.168.1.218 name=vault.alwaldend.com ttl=5m type=A
add address=103.76.53.6 name=ingress.alwaldend.com ttl=5m type=A
add address=158.160.196.128 name=ingress.alwaldend.com ttl=5m type=A
add address=158.160.196.128 name=host1.ingress.alwaldend.com ttl=5m type=A
add address=103.76.53.6 name=host2.ingress.alwaldend.com ttl=5m type=A
add name=yc.threexui.alwaldend.com ns=ns1.yandexcloud.net ttl=5m type=NS
add name=yc.threexui.alwaldend.com ns=ns2.yandexcloud.net ttl=5m type=NS
add cname=host1.nodes.yc.threexui.alwaldend.com name=yc1.nodes.threexui.alwaldend.com ttl=10m type=CNAME
add address=192.168.10.100 name=runner1.forgejo-runner.alwaldend.com ttl=5m type=A
add cname=host1.yc.hermes.simeonwarren.users.alwaldend.com name=hermes.simeonwarren.users.alwaldend.com ttl=10m type=CNAME
add cname=host1.yc.hermes.simeonwarren.users.alwaldend.com name=host1.hermes.simeonwarren.users.alwaldend.com ttl=10m type=CNAME
add name=yc.hermes.simeonwarren.users.alwaldend.com ns=ns1.yandexcloud.net ttl=5m type=NS
add name=yc.hermes.simeonwarren.users.alwaldend.com ns=ns2.yandexcloud.net ttl=5m type=NS
/ip firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid log-prefix=drop-invalid
add action=accept chain=input comment="defconf: accept ICMP" in-interface-list=accept-input-ICMP protocol=icmp
add action=accept chain=input comment="defconf: accept to local loopback (for CAPsMAN)" dst-address=127.0.0.1
add action=drop chain=input comment="defconf: drop all not coming from LAN" in-interface-list=!LAN log-prefix=drop-not-coming-from-lan
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid log-prefix=drop-invalid
add action=drop chain=forward comment="defconf: drop all from WAN not DSTNATed" connection-nat-state=!dstnat connection-state=new in-interface-list=WAN log-prefix=drop-from-wan-not-dstnated
add action=accept chain=input in-interface-list=WAN protocol=gre
add action=accept chain=forward comment="accept forward WAN" in-interface-list=accept-forward-WAN out-interface-list=WAN
add action=accept chain=forward comment="accept forward LAN" in-interface-list=accept-forward-LAN out-interface-list=LAN
add action=accept chain=input comment="accept input DNS (udp)" dst-port=53 in-interface-list=accept-input-DNS protocol=udp
add action=accept chain=input comment="accept input DNS (tcp)" dst-port=53 in-interface-list=accept-input-DNS protocol=tcp
add action=accept chain=input comment=accept-input-NTP dst-port=123 in-interface-list=accept-input-NTP protocol=udp
add action=accept chain=input comment="accept input DHCP-server" dst-port=67 in-interface-list=accept-input-DHCP-server log-prefix=accept-DHCP protocol=udp
add action=accept chain=input comment="accept input winbox (tcp)" dst-port=8291 in-interface-list=accept-input-winbox protocol=tcp
add action=accept chain=input comment="accept input winbox (udp)" dst-port=20561 in-interface-list=accept-input-winbox protocol=udp
add action=accept chain=input comment="accept input web ui" dst-port=80,443 in-interface-list=accept-input-web-ui protocol=tcp
add action=accept chain=input comment="accept input mikrotik neighbor discovery" dst-port=5678 in-interface-list=accept-input-mikrotik-neighbor-discovery protocol=udp
add action=drop chain=forward comment="drop forward" log=yes log-prefix=drop-forward
add action=drop chain=input comment="drop input" log=yes log-prefix=drop-input
add action=accept chain=output comment=accept-output-LAN out-interface-list=LAN
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
/ip ipsec profile
set [ find default=yes ] dpd-interval=2m dpd-maximum-failures=5
/ip service
set www-ssl certificate=alwaldend.com_acme disabled=no
set reverse-proxy certificate=alwaldend.com_acme
set api-ssl certificate=alwaldend.com_acme
/ipv6 address
add address=::1 from-pool=dc01 interface=bridge1
add address=::1:0:0:0:1 from-pool=dc01 interface=bridge2
/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: discard only " list=bad_ipv6
add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6
/ipv6 firewall filter
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMPv6" in-interface-list=accept-input-ICMP protocol=icmpv6
add action=accept chain=input comment="defconf: accept UDP traceroute" dst-port=33434-33534 protocol=udp
add action=accept chain=input comment="defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 protocol=udp
add action=accept chain=input comment="defconf: accept ipsec AH" protocol=ipsec-ah
add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=ipsec-esp
add action=accept chain=input comment="defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=input comment="defconf: drop everything else not coming from LAN" in-interface-list=!LAN
add action=accept chain=forward comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="defconf: drop packets with bad src ipv6" src-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6" in-interface-list=accept-input-ICMP protocol=icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=ipsec-ah
add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=ipsec-esp
add action=accept chain=forward comment="defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment="defconf: drop everything else not coming from LAN" in-interface-list=!LAN
add action=accept chain=forward comment="accept forward WAN" in-interface-list=accept-forward-WAN out-interface-list=WAN
add action=accept chain=forward comment="accept forward LAN" in-interface-list=accept-forward-LAN out-interface-list=LAN
add action=accept chain=input comment="accept input DNS (udp)" dst-port=53 in-interface-list=accept-input-DNS protocol=udp
add action=accept chain=input comment="accept input DNS (tcp)" dst-port=53 in-interface-list=accept-input-DNS protocol=tcp
add action=accept chain=input comment=accept-input-NTP dst-port=123 in-interface-list=accept-input-NTP protocol=udp
add action=accept chain=input comment="accept input winbox (tcp)" dst-port=8291 in-interface-list=accept-input-winbox protocol=tcp
add action=accept chain=input comment="accept input winbox (udp)" dst-port=20561 in-interface-list=accept-input-winbox protocol=udp
add action=accept chain=input comment="accept input web ui" dst-port=80,443 in-interface-list=accept-input-web-ui protocol=tcp
add action=accept chain=input comment="accept input mikrotik neighbor discovery" dst-port=5678 in-interface-list=accept-input-mikrotik-neighbor-discovery protocol=udp
add action=drop chain=forward comment="drop forward" log=yes log-prefix=drop-forward-ipv6
add action=drop chain=input comment="drop input" log=yes log-prefix=drop-input-ipv6
add action=accept chain=output comment=accept-output-LAN out-interface-list=LAN
/ipv6 nd
set [ find default=yes ] advertise-dns=yes interface=bridge1
add advertise-dns=yes interface=bridge2
/system clock
set time-zone-name=Europe/Moscow
/system identity
set name=router1.dc1.alwaldend.com
/system ntp server
set enabled=yes
/system routerboard settings
set auto-upgrade=yes
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
Router2
# 2025-09-07 11:04:01 by RouterOS 7.19.4
# model = L009UiGS-2HaxD
/interface bridge
add name=bridge01
/port
set 0 name=serial0
/interface bridge port
add bridge=bridge01 interface=ether2
add bridge=bridge01 interface=ether3
add bridge=bridge01 interface=ether4
add bridge=bridge01 interface=ether5
add bridge=bridge01 interface=ether6
add bridge=bridge01 interface=ether7
add bridge=bridge01 interface=ether8
add bridge=bridge01 interface=ether1
/ip neighbor discovery-settings
set discover-interface-list=!dynamic
/ipv6 settings
set accept-router-advertisements=yes
/ip dhcp-client
add interface=bridge01
/system clock
set time-zone-name=Europe/Moscow
/system identity
set name=router02.dc01.alwaldend.com
/system routerboard settings
set enter-setup-on=delete-key
34.1 - DNS Terraform
This root packages the owner’s canonical DNS declaration
through the shared DNS module and keeps state in the owner AppRole’s Vault HTTP
backend. The root contains DNS resources only. dns_enabled defaults to true
after verified adoption. Keep it enabled to retain existing records; disabling
it would propose deletion.
Use the normal //infra/mikrotik/dns:tf.<operation> wrappers for this DNS-only
root. The DNS migration procedure owns credential
provisioning, reconciliation, and recovery. The
adoption record
contains the import and inventory-preservation evidence. The package exposes
//infra/mikrotik/dns:tf_tests.fmt_test for offline formatting checks.
Operational Terraform calls require the DNS AppRole policy grants and credential
fields described by the migration procedure. Provider configuration requires
real credentials and live access independently of the activation setting.
34.2 - OpenSpec
34.2.1 - Specifications
34.2.1.1 - Infra mikrotik
34.2.1.1.1 - Infrastructure MikroTik
Purpose
Describe the checked-in RouterOS export snapshots and site DNS declarations for
the dc1 routers. This package is a documentation and record-input owner: its
BUILD file declares no router deployment executable. Export contents are
historical source evidence, not a verification of current device configuration.
Baseline source revision: 550d7e79b1f5fdbc2b6017b75178471d6914082f.
Observation date: 2026-09-08. Sources are linked in full; no excerpts are used.
Sources: export workflow,
package targets,
router1 snapshot,
router2 snapshot, and
DNS declarations.
Requirements
Requirement: Preserve export snapshots as the package’s documented interface
The package SHALL retain the router export files as documentation inputs and
describe the RouterOS /export collection workflow. Documentation SHALL
distinguish these snapshots from automatically applied desired state. The
Terraform root SHALL manage DNS records only and SHALL NOT apply router exports.
Scenario: Inspect the router package
- WHEN a reader opens the component documentation
- THEN the reader can inspect both router export snapshots
- AND the Terraform package exposes owner-local DNS management while the
snapshots remain documentary inputs
Requirement: Describe the two routers according to their recorded topology
The baseline description SHALL identify router1’s separate wired and wireless
bridges with their own DHCP networks, and router2’s single bridge containing its
eight Ethernet interfaces with a DHCP client. It SHALL NOT infer additional
live devices or enabled topology from comments elsewhere in the repository.
Scenario: Compare the recorded network roles
- WHEN the two checked-in exports are compared
- THEN router1 records
bridge1 for wired ports and bridge2 for Wi-Fi ports - AND router2 records
bridge01 and an IP DHCP client on that bridge
Requirement: Retain the recorded router1 traffic-policy structure
The router1 snapshot SHALL describe named interface lists for input and
forwarding permissions, explicit terminal IPv4 input and forwarding drops,
and source NAT masquerading for WAN egress. This contract describes the export
and SHALL NOT be represented as a live firewall audit.
Scenario: Review router1’s recorded IPv4 policy
- WHEN a reader follows the IPv4 firewall section of the snapshot
- THEN the listed service permissions precede terminal input and forwarding
drop rules
- AND the NAT section declares masquerading for traffic leaving the WAN list
Requirement: Supply site-local DNS records to the DNS owner
The package SHALL expose its dnsconfig.json as a Bazel filegroup. Its router,
switch, and bare-metal records SHALL be assigned to the dc1 destination view.
Scenario: Assemble the dc1 DNS configuration
- WHEN the DNS owner consumes
//infra/mikrotik:dnsconfig - THEN router1 IPv4 and IPv6 records and the declared switch and bare-metal
IPv4 records are available for the dc1 view
34.2.1.2 - Owned dns
34.2.1.2.1 - owned-dns Specification
Purpose
Define MikroTik router DNS management through the owner’s tf root,
including canonical declarations, scoped credentials, and offline source checks
before adopting live records.
Requirements
Requirement: Owner-local DNS configuration
The tf root SHALL consume this owner’s canonical dnsconfig.json through
the shared DNS Terraform module, preserving declared record identities and views.
DNS resources SHALL default to disabled until the authorized adoption revision
and SHALL retain enabled ownership after existing records are imported into the
owner’s state. Reconciliation against unchanged declarations and adopted state
SHALL propose no record additions, changes, replacements, or deletions.
Scenario: Inspect the preparatory configuration
- WHEN the checked-in root is evaluated with default inputs before its
authorized adoption revision
- THEN it reads this owner’s declaration and disables managed DNS records
- AND the package contains the module and declaration inputs
Scenario: Adopt existing DNS records
- WHEN the authorized adoption audits competing writers within its documented
coverage, keeps identified competing writers stopped, and enables the owner’s
record management
- THEN the owning root imports existing records by exact provider ID into
its state while preserving their declared identities and views
Scenario: Inspect adopted source defaults
- WHEN the adopted root uses its checked-in source defaults
- THEN DNS ownership remains enabled and the package retains the module
and canonical declaration inputs
Scenario: Reconcile existing DNS records
- WHEN the owning root plans against its adopted state and unchanged declarations
- THEN it proposes no record additions, changes, replacements, or deletions
Requirement: Scoped DNS execution and offline checks
The DNS wrapper SHALL select src_infra_mikrotik through the repository AL flow and keep
secret values in injected variables. DNS injection SHALL select the root’s existing
Terraform stage label. Real DNS credentials and Vault policy grants SHALL be
prerequisites for operational Terraform calls. RouterOS DNS credentials SHALL be isolated
from unrelated RouterOS resources. The package SHALL expose a format test that
does not authenticate to Vault or contact DNS providers.
- WHEN the package format test executes
- THEN it checks the packaged Terraform configuration without live credentials
- AND existing non-DNS authentication and backend paths remain unchanged
- WHEN the wrapper selects its Terraform stage labels
- THEN it selects DNS credential injection through the owner AppRole
- AND disabled DNS resources do not imply offline provider configuration
34.3 - RouterOS accounts
This Terraform root provisions the src_infra_printers RouterOS group and user
on router1. Its group permits api, read, rest-api, and write. These are
router-wide configuration permissions: RouterOS does not scope them to the
printer firewall rule. The group excludes account-policy administration,
sensitive-value access, and shell or UI login permissions. RouterOS REST
authentication on the deployed router requires both api and rest-api.
The pinned Random provider generates a 32-character alphanumeric password once
per resource lifecycle. Ordinary plans preserve it. Deliberate replacement of
random_password.printers rotates the router password and the Vault KV v2
credential together. There are no credential outputs. Terraform state contains
the password and remains in the protected Vault backend.
The credential is stored at
secrets/alwaldend.com/vault1/approles/src_infra_mikrotik/printers, with fields
mikrotik_username and mikrotik_password. The MikroTik AppRole owns this
prefix; the printers AppRole receives read access to this exact secret through
the Vault definition.
Provisioning prerequisites
The tf=accounts wrapper authenticates as src_infra_mikrotik, uses its
tf_backend/accounts backend, and injects its token for the Vault provider.
RouterOS provisioning reads the operator-supplied administrator credential at
secrets/alwaldend.com/vault1/approles/src_infra_mikrotik/routeros_admin, with
fields mikrotik_username and mikrotik_password. Its existing owner-prefix
policy grants access; no cross-owner credential read is needed. The account
must permit user and group management (policy as well as read/write and REST
API access). Printers consumes only its separate generated credential.
Operational calls require explicit authority for their exact scope. With that
authority, review the owning //infra/mikrotik/accounts:tf.plan and interactive
tf.apply targets. These four resources are provisioned; an ordinary reconciliation now
reports no changes. The deployment receipt
records their creation and the completed state adoption.
The shared injection helper supplies MIKROTIK_HOST, MIKROTIK_USER, and
MIKROTIK_PASSWORD directly to the default RouterOS provider. No Terraform
credential variables are needed.
Offline validation
bazel test //infra/mikrotik/accounts:tf_tests.fmt_test \
//infra/mikrotik/accounts:tf_tests.validate_test
These checks package the pinned providers and omit only backend.tf so schema
validation needs no Vault authentication or router access. They do not create
an account or test its live permissions.