l blue-host: disable syncing

This commit is contained in:
lassulus 2020-09-27 15:32:38 +02:00
parent 63412ba8b9
commit 5b44319083

View File

@ -49,54 +49,54 @@ in {
};
systemd.services = builtins.listToAttrs (map (host:
let
in nameValuePair "sync-blue-${host}" {
bindsTo = [ "container@blue.service" ];
wantedBy = [ "container@blue.service" ];
# ssh needed for rsync
path = [ pkgs.openssh ];
serviceConfig = {
Restart = "always";
RestartSec = 10;
ExecStart = pkgs.writeDash "sync-blue-${host}" ''
set -efu
#make sure blue is running
/run/wrappers/bin/ping -c1 blue.r > /dev/null
#systemd.services = builtins.listToAttrs (map (host:
# let
# in nameValuePair "sync-blue-${host}" {
# bindsTo = [ "container@blue.service" ];
# wantedBy = [ "container@blue.service" ];
# # ssh needed for rsync
# path = [ pkgs.openssh ];
# serviceConfig = {
# Restart = "always";
# RestartSec = 10;
# ExecStart = pkgs.writeDash "sync-blue-${host}" ''
# set -efu
# #make sure blue is running
# /run/wrappers/bin/ping -c1 blue.r > /dev/null
#make sure the container is unlocked
${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep -q '^encfs on /var/lib/containers/blue'
# #make sure the container is unlocked
# ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep -q '^encfs on /var/lib/containers/blue'
#make sure our target is reachable
${pkgs.untilport}/bin/untilport ${host}.r 22 2>/dev/null
# #make sure our target is reachable
# ${pkgs.untilport}/bin/untilport ${host}.r 22 2>/dev/null
#start sync
${pkgs.lsyncd}/bin/lsyncd -log scarce ${pkgs.writeText "lsyncd-config.lua" ''
settings {
nodaemon = true,
inotifyMode = "CloseWrite or Modify",
}
sync {
default.rsyncssh,
source = "/var/lib/containers/.blue",
host = "${host}.r",
targetdir = "/var/lib/containers/.blue",
rsync = {
archive = true,
owner = true,
group = true,
};
ssh = {
binary = "${pkgs.openssh}/bin/ssh";
identityFile = "/var/lib/containers/blue/home/lass/.ssh/id_rsa",
},
}
''}
'';
};
unitConfig.ConditionPathExists = "!/var/run/ppp0.pid";
}
) remote_hosts);
# #start sync
# ${pkgs.lsyncd}/bin/lsyncd -log scarce ${pkgs.writeText "lsyncd-config.lua" ''
# settings {
# nodaemon = true,
# inotifyMode = "CloseWrite or Modify",
# }
# sync {
# default.rsyncssh,
# source = "/var/lib/containers/.blue",
# host = "${host}.r",
# targetdir = "/var/lib/containers/.blue",
# rsync = {
# archive = true,
# owner = true,
# group = true,
# };
# ssh = {
# binary = "${pkgs.openssh}/bin/ssh";
# identityFile = "/var/lib/containers/blue/home/lass/.ssh/id_rsa",
# },
# }
# ''}
# '';
# };
# unitConfig.ConditionPathExists = "!/var/run/ppp0.pid";
# }
#) remote_hosts);
environment.systemPackages = [
(pkgs.writeDashBin "start-blue" ''