Skip to content

Deploy from an alternative host

By default, a single admin workstation deploys the entire fleet (see Deployment). A single deployer is a single point of failure: if it goes down, no just apply is possible anymore. You can promote an alternative host, typically a powerful and always-available server, into a standalone backup deployer capable of managing the fleet in place of the admin workstation.

A deployer relies on only four elements. Two already exist on each host, two are prepared once.

ElementDetailTo do
Toolingcolmena, just, sops (via an admin profile)Enable a flag
Binary cacheharmonia specific to the deployerEnable a service
Workspaceclone of the repository (config + framework)Clone + sync
SSH identity nixalready authorized on all hostsCopy the private key

The target topology : two deployers fed by a common source, each capable of deploying the fleet.

Diagram

Deployment tools ship with an admin home profile (e.g. nix-admin), but remain hidden until the host declares itself an admin host. Enable this flag on the alternative host:

# usr/machines/<hôte>/features.nix
darkone.admin.nix.enable = true;
  • The user who will deploy must have an admin home profile.
  • On a headless server, the graphical packages of the profile are automatically excluded: the installed tooling stays lightweight.

Recommended: give the deployer its own binary cache. It builds the fleet, then re-serves its derivations to other hosts.

etc/config.yaml
services:
harmonia:
global: true
  • global: true makes the cache reachable cross-zone via VPN, useful when the deployer and its targets are not in the same zone.
  • The signing key is already managed by sops, common to the whole network: nothing new to provision.
  1. Declare and deploy. From the admin workstation, apply the two options above, regenerate, then deploy the alternative host:

    Fenêtre de terminal
    just generate
    just apply <hôte>
  2. Clone the workspace on the alternative host, at the same path as on the admin workstation, with the framework sub-repository in the same location.

  3. Share the source. A common git remote, or regular pull from the admin workstation, keeps both deployers in sync. Only committed state is deployed.

  4. Copy the private key of the deployment user (nix) to the alternative host, with 600 permissions and owned by nix:

    Fenêtre de terminal
    # on the alternative host
    /home/nix/.ssh/id_ed25519

    Its public key is already authorized across the entire fleet, so no redeployment of access rights is needed.

  5. Validate from the alternative host:

    Fenêtre de terminal
    colmena --version
    just apply <cible-témoin> test
UsageAdmin sops key
Deploy and inspect (apply, exec, enter, reboot)Not required
Edit or manage secretsRequired

Deployment alone does not need the admin key: secrets are decrypted on each target using its infra key. Only copy the admin key to the alternative host if you also want to manage secrets there.