Make forgejo persist data
This commit is contained in:
parent
b67a4abbe3
commit
93cc8ebf36
2 changed files with 44 additions and 40 deletions
|
@ -69,17 +69,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persistent" = {
|
||||
directories = [
|
||||
# TODO: Backup onto CEPH cluster periodically. Or maybe move fully, if performance allows it.
|
||||
{
|
||||
directory = "/appdata/forgejo";
|
||||
user = "forgejo";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
let
|
||||
forgejo-cli = pkgs.writeShellScriptBin "forgejo-cli" ''
|
||||
|
@ -87,16 +76,20 @@
|
|||
echo "No arguments supplied"
|
||||
exit 1
|
||||
fi
|
||||
sudo -u forgejo -- ${lib.getExe pkgs.forgejo} --config /appdata/forgejo/custom/conf/app.ini $@
|
||||
sudo -u forgejo -- ${lib.getExe pkgs.forgejo} --config /cephfs/appdata/forgejo/custom/conf/app.ini $@
|
||||
'';
|
||||
in
|
||||
[
|
||||
forgejo-cli
|
||||
];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /cephfs/appdata/forgejo - forgejo forgejo - -"
|
||||
];
|
||||
|
||||
services.forgejo = {
|
||||
enable = true;
|
||||
stateDir = "/appdata/forgejo";
|
||||
stateDir = "/cephfs/appdata/forgejo";
|
||||
lfs.enable = true;
|
||||
|
||||
database = {
|
||||
|
|
|
@ -2,36 +2,47 @@
|
|||
...
|
||||
}:
|
||||
{
|
||||
boot.supportedFilesystems = [ "btrfs" ];
|
||||
boot.supportedFilesystems = [ "btrfs" ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "none";
|
||||
fsType = "tmpfs";
|
||||
options = [ "defaults" "mode=755" ];
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "none";
|
||||
fsType = "tmpfs";
|
||||
options = [
|
||||
"defaults"
|
||||
"mode=755"
|
||||
];
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-label/boot";
|
||||
fsType = "vfat";
|
||||
};
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-label/boot";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
fileSystems."/nix" = {
|
||||
device = "/dev/disk/by-label/btrfs";
|
||||
fsType = "btrfs";
|
||||
options = [ "compress=zstd" "subvol=nix" "noatime" ];
|
||||
};
|
||||
fileSystems."/nix" = {
|
||||
device = "/dev/disk/by-label/btrfs";
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
"subvol=nix"
|
||||
"noatime"
|
||||
];
|
||||
};
|
||||
|
||||
fileSystems."/persistent" = {
|
||||
device = "/dev/disk/by-label/btrfs";
|
||||
fsType = "btrfs";
|
||||
options = [ "compress=zstd" "subvol=persistent" "noatime" ];
|
||||
autoResize = true;
|
||||
neededForBoot = true;
|
||||
};
|
||||
fileSystems."/persistent" = {
|
||||
device = "/dev/disk/by-label/btrfs";
|
||||
fsType = "btrfs";
|
||||
options = [
|
||||
"compress=zstd"
|
||||
"subvol=persistent"
|
||||
"noatime"
|
||||
];
|
||||
autoResize = true;
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
fileSystems."/media" = {
|
||||
device = "vm@b9b22d11-3492-49a6-92b7-b36cdf0161fe.cephfs=/media";
|
||||
fsType = "ceph";
|
||||
options = [ "nofail" ];
|
||||
};
|
||||
fileSystems."/cephfs" = {
|
||||
device = "vm@b9b22d11-3492-49a6-92b7-b36cdf0161fe.cephfs=/";
|
||||
fsType = "ceph";
|
||||
options = [ "nofail" ];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue