2022-04-20 11:01:51 +00:00
|
|
|
#!/usr/bin/env ./sshtool
|
|
|
|
|
|
|
|
copy nix/configuration.nix /etc/nixos/configuration.nix
|
|
|
|
copy nix/deuxfleurs.nix /etc/nixos/deuxfleurs.nix
|
|
|
|
copy nix/remote-unlock.nix /etc/nixos/remote-unlock.nix
|
|
|
|
copy cluster/$CLUSTER/cluster.nix /etc/nixos/cluster.nix
|
|
|
|
copy cluster/$CLUSTER/node/$NIXHOST.nix /etc/nixos/node.nix
|
|
|
|
copy cluster/$CLUSTER/node/$NIXHOST.site.nix /etc/nixos/site.nix
|
|
|
|
|
2022-11-28 21:58:39 +00:00
|
|
|
if [ "$CLUSTER" = "staging" ]; then
|
2022-11-29 13:21:12 +00:00
|
|
|
copy nix/nomad-driver-nix2.nix /etc/nixos/nomad-driver-nix2.nix
|
2022-11-28 21:58:39 +00:00
|
|
|
fi
|
|
|
|
|
2022-12-22 22:59:51 +00:00
|
|
|
if [ "$CLUSTER" = "prod" ]; then
|
|
|
|
cmd nixos-rebuild boot
|
|
|
|
message "-------------------------------------------------------------------------------------"
|
|
|
|
message "New NixOS configuration hasn't been applied, to avoid disturbing production services."
|
|
|
|
message "Please apply the following procedure to node '$NIXHOST':"
|
|
|
|
message "1. Drain node in Nomad so that all jobs are relocated elsewhere"
|
|
|
|
message "2. Reboot node manually. You can also take the opportunity to upgrade with:"
|
|
|
|
message " REBOOT_NODES=yes ./upgrade_nixos prod $NIXHOST"
|
|
|
|
message "3. Mark node as eligible again in Nomad"
|
|
|
|
message "-------------------------------------------------------------------------------------"
|
|
|
|
else
|
|
|
|
cmd nixos-rebuild switch
|
|
|
|
fi
|