deployerbot: use vpn for actual deploying anyway

This commit is contained in:
Motiejus Jakštys 2023-09-20 14:43:04 +03:00
parent dba036a102
commit 21e96199bb
3 changed files with 5 additions and 7 deletions

View File

@ -89,7 +89,7 @@ in {
enable = true; enable = true;
uidgid = myData.uidgid.updaterbot-deployee; uidgid = myData.uidgid.updaterbot-deployee;
publicKey = myData.hosts."vno1-oh2.servers.jakst".publicKey; publicKey = myData.hosts."vno1-oh2.servers.jakst".publicKey;
sshAllowSubnets = with myData.subnets; [tailscale.sshPattern vno1.sshPattern]; sshAllowSubnets = with myData.subnets; [tailscale.sshPattern];
}; };
}; };

View File

@ -189,7 +189,7 @@
deployIfPresent = [ deployIfPresent = [
{ {
derivationTarget = ".#fwminex"; derivationTarget = ".#fwminex";
altHostname = myData.hosts."fwminex.motiejus.jakst".vno1IP; pingTarget = myData.hosts."fwminex.motiejus.jakst".vno1IP;
} }
]; ];
}; };

View File

@ -2,20 +2,18 @@
config, config,
lib, lib,
pkgs, pkgs,
myData,
... ...
}: let }: let
cfg = config.mj.services.deployerbot; cfg = config.mj.services.deployerbot;
mkOptional = { mkOptional = {
derivationTarget, derivationTarget,
altHostname, pingTarget,
}: '' }: ''
if ${pkgs.inetutils}/bin/ping -c 1 ${altHostname}; then if ${pkgs.inetutils}/bin/ping -c 1 ${pingTarget}; then
${pkgs.deploy-rs}/bin/deploy \ ${pkgs.deploy-rs}/bin/deploy \
--ssh-opts="-i ''${CREDENTIALS_DIRECTORY}/ssh-key" \ --ssh-opts="-i ''${CREDENTIALS_DIRECTORY}/ssh-key" \
--ssh-user=deployerbot-follower \ --ssh-user=deployerbot-follower \
--confirm-timeout 60 \ --confirm-timeout 60 \
--hostname ${altHostname} \
--targets ${derivationTarget} -- \ --targets ${derivationTarget} -- \
--accept-flake-config --accept-flake-config
fi fi
@ -29,7 +27,7 @@ in {
{...}: { {...}: {
options = { options = {
derivationTarget = lib.mkOption {type = str;}; derivationTarget = lib.mkOption {type = str;};
altHostname = lib.mkOption {type = str;}; pingTarget = lib.mkOption {type = str;};
}; };
} }
)); ));