bring back garage

make it work with my fork
This commit is contained in:
cy 2025-01-11 22:40:51 -05:00
parent 0dd68a7d25
commit 396886a028
8 changed files with 109 additions and 0 deletions

View file

@ -77,3 +77,13 @@ cache.cything.io {
import common
reverse_proxy localhost:8090
}
s3.cy7.sh {
import common
reverse_proxy localhost:3900
}
admin.s3.cy7.sh {
import common
reverse_proxy localhost:3903
}

View file

@ -25,6 +25,7 @@
./element.nix
./attic.nix
./forgejo.nix
./garage.nix
];
sops.age.keyFile = "/root/.config/sops/age/keys.txt";
@ -65,6 +66,10 @@
"attic/env" = {
sopsFile = ../../secrets/services/attic.yaml;
};
"garage/env" = {
sopsFile = ../../secrets/services/garage.yaml;
};
};
boot.loader.grub.enable = true;

18
hosts/chunk/garage.nix Normal file
View file

@ -0,0 +1,18 @@
{config, pkgs, ...}: {
services.garage = {
enable = true;
package = pkgs.garage;
settings = {
data_dir = "/mnt/garage";
s3_api = {
s3_region = "earth";
api_bind_addr = "[::]:3900";
};
admin.api_bind_addr = "[::]:3903";
rpc_bind_addr = "[::]:3901";
replication_factor = 1;
db_engine = "lmdb";
};
environmentFile = config.sops.secrets."garage/env".path;
};
}

View file

@ -38,5 +38,23 @@
ExecStop = "${lib.getExe' pkgs.fuse "fusermount"} -u /mnt/attic";
};
};
systemd.services.garage-mount = {
enable = true;
description = "Mount the garage data remote";
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
requiredBy = [ "garage.service" ];
before = [ "garage.service" ];
serviceConfig = {
Type = "notify";
ExecStartPre = "/usr/bin/env mkdir -p /mnt/garage";
ExecStart = "${lib.getExe pkgs.rclone} mount --config ${
config.sops.secrets."rclone/config".path
} --cache-dir /var/cache/rclone --transfers=32 --checkers=32 --vfs-cache-mode writes --vfs-cache-max-size 5G --allow-other rsyncnet:garage /mnt/garage ";
ExecStop = "${lib.getExe' pkgs.fuse "fusermount"} -u /mnt/garage";
};
};
programs.fuse.userAllowOther = true;
}