serokell / deploy-rs

A simple multi-profile Nix-flake deploy tool.
Other
1.33k stars 101 forks source link

deploy-rs stalls if ssh uses ControlMaster option... #233

Closed boxofrox closed 12 months ago

boxofrox commented 1 year ago

Steps to reproduce:

  1. Use ~/.ssh/config to enable ControlMaster yes for deploy recipient host (e.g. prod-1).
  2. Connect to recipient host to establish control master. E.g. ssh root@prod-1.
  3. Initiate deployment from administration host. E.g. deploy -s .#prod-1

Actual outcome:

Progress hangs at Copying profile.

$ deploy -s .#prod-1
🚀 ℹ️ [deploy] [INFO] Evaluating flake in .
🚀 ℹ️ [deploy] [INFO] The following profiles are going to be deployed:
[prod-1.system]
user = "root"
ssh_user = "root"
path = "/nix/store/0lf4flfq6lza9a99hq04qhwchz76b14f-activatable-nixos-system-prod-1-23.05.20230724.a58eb89"
hostname = "prod-1"
ssh_opts = []

🚀 ℹ️ [deploy] [INFO] Building profile `system` for node `prod-1`
🚀 ℹ️ [deploy] [INFO] Copying profile `system` to node `prod-1`

Expected outcome:

Finish deploy, then activate, then terminate program.

$ deploy -s .#prod-1
🚀 ℹ️ [deploy] [INFO] Evaluating flake in .
🚀 ℹ️ [deploy] [INFO] The following profiles are going to be deployed:
[prod-1.system]
user = "root"
ssh_user = "root"
path = "/nix/store/0lf4flfq6lza9a99hq04qhwchz76b14f-activatable-nixos-system-prod-1-23.05.20230724.a58eb89"
hostname = "prod-1"
ssh_opts = []

🚀 ℹ️ [deploy] [INFO] Building profile `system` for node `prod-1`
🚀 ℹ️ [deploy] [INFO] Copying profile `system` to node `prod-1`
🚀 ℹ️ [deploy] [INFO] Activating profile `system` for node `prod-1`
⭐ ℹ️ [activate] [INFO] Activating profile
stopping the following units: container@rev-proxy.service
activating the configuration...
setting up /etc...
sops-install-secrets: Imported /etc/ssh/ssh_host_rsa_key as GPG key with fingerprint ****
sops-install-secrets: Imported /etc/ssh/ssh_host_ed25519_key as age key with fingerprint  ****
reloading user units for root...
setting up tmpfiles
starting the following units: container@rev-proxy.service
⭐ ℹ️ [activate] [INFO] Activation succeeded!
🚀 ℹ️ [deploy] [INFO] Success activating, done!

Work around

  1. Use ssh root@prod-1 -O exit to kill existing ControlMaster.
  2. Use deploy -s .#prod-1 to establish new ControlMaster, deploy, activate, and terminate.
rvem commented 1 year ago

Seems like https://github.com/serokell/deploy-rs/issues/226 which is caused by the nix issue