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 =
|
environment.systemPackages =
|
||||||
let
|
let
|
||||||
forgejo-cli = pkgs.writeShellScriptBin "forgejo-cli" ''
|
forgejo-cli = pkgs.writeShellScriptBin "forgejo-cli" ''
|
||||||
|
@ -87,16 +76,20 @@
|
||||||
echo "No arguments supplied"
|
echo "No arguments supplied"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
in
|
||||||
[
|
[
|
||||||
forgejo-cli
|
forgejo-cli
|
||||||
];
|
];
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d /cephfs/appdata/forgejo - forgejo forgejo - -"
|
||||||
|
];
|
||||||
|
|
||||||
services.forgejo = {
|
services.forgejo = {
|
||||||
enable = true;
|
enable = true;
|
||||||
stateDir = "/appdata/forgejo";
|
stateDir = "/cephfs/appdata/forgejo";
|
||||||
lfs.enable = true;
|
lfs.enable = true;
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
|
|
|
@ -7,7 +7,10 @@
|
||||||
fileSystems."/" = {
|
fileSystems."/" = {
|
||||||
device = "none";
|
device = "none";
|
||||||
fsType = "tmpfs";
|
fsType = "tmpfs";
|
||||||
options = [ "defaults" "mode=755" ];
|
options = [
|
||||||
|
"defaults"
|
||||||
|
"mode=755"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
fileSystems."/boot" = {
|
||||||
|
@ -18,19 +21,27 @@
|
||||||
fileSystems."/nix" = {
|
fileSystems."/nix" = {
|
||||||
device = "/dev/disk/by-label/btrfs";
|
device = "/dev/disk/by-label/btrfs";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = [ "compress=zstd" "subvol=nix" "noatime" ];
|
options = [
|
||||||
|
"compress=zstd"
|
||||||
|
"subvol=nix"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/persistent" = {
|
fileSystems."/persistent" = {
|
||||||
device = "/dev/disk/by-label/btrfs";
|
device = "/dev/disk/by-label/btrfs";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = [ "compress=zstd" "subvol=persistent" "noatime" ];
|
options = [
|
||||||
|
"compress=zstd"
|
||||||
|
"subvol=persistent"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
autoResize = true;
|
autoResize = true;
|
||||||
neededForBoot = true;
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/media" = {
|
fileSystems."/cephfs" = {
|
||||||
device = "vm@b9b22d11-3492-49a6-92b7-b36cdf0161fe.cephfs=/media";
|
device = "vm@b9b22d11-3492-49a6-92b7-b36cdf0161fe.cephfs=/";
|
||||||
fsType = "ceph";
|
fsType = "ceph";
|
||||||
options = [ "nofail" ];
|
options = [ "nofail" ];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue