Skip to content

Commit

Permalink
Use RuntimeDirectory forbookdb-remote-sync-send
Browse files Browse the repository at this point in the history
  • Loading branch information
barrucadu committed Dec 15, 2024
1 parent 3d836f0 commit 8abd65e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions shared/bookdb/remote-sync-send.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ let
ExecStart = pkgs.writeShellScript "bookdb-sync" ''
set -ex
/run/wrappers/bin/sudo ${pkgs.coreutils}/bin/cp -r ${config.systemd.services.bookdb.environment.BOOKDB_UPLOADS_DIR}/ ~/bookdb-covers
trap "/run/wrappers/bin/sudo ${pkgs.coreutils}/bin/rm -rf ~/bookdb-covers" EXIT
cd $RUNTIME_DIRECTORY
/run/wrappers/bin/sudo ${pkgs.coreutils}/bin/cp -r ${config.systemd.services.bookdb.environment.BOOKDB_UPLOADS_DIR}/ bookdb-covers
trap "/run/wrappers/bin/sudo ${pkgs.coreutils}/bin/rm -rf bookdb-covers" EXIT
rsync -az\
-e "ssh -i $SSH_KEY_FILE -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \
~/bookdb-covers/ \
bookdb-covers/ \
bookdb-remote-sync-receive@${target}:~/bookdb-covers/
ssh -i "$SSH_KEY_FILE" \
-o UserKnownHostsFile=/dev/null \
Expand All @@ -36,6 +38,7 @@ let
receive-elasticsearch
'';
User = config.users.users.bookdb-remote-sync-send.name;
RuntimeDirectory = "bookdb-sync-${target}";
};
environment = {
ES_HOST = config.systemd.services.bookdb.environment.ES_HOST;
Expand All @@ -48,8 +51,6 @@ in
config = mkIf cfg.enable {
users.users.bookdb-remote-sync-send = {
uid = 985;
home = "/var/lib/bookdb-remote-sync-send";
createHome = true;
isSystemUser = true;
shell = pkgs.bashInteractive;
group = "nogroup";
Expand Down

0 comments on commit 8abd65e

Please sign in to comment.