Merge pull request #297 from ryan4yin/feat/app-data-to-ssd

feat(youko): move the service data from the HDD to the SSD
This commit is contained in:
ryan4yin | 二花 authored and GitHub committed 2026-09-21 18:00:10 +08:00
commit 9ef7ba7112
8 files changed
+17 -17

No files matched your search

@@ -22,7 +22,7 @@ in
# Reload Caddy instead of restarting it when configuration file changes.
enableReload = true;
user = "caddy"; # User account under which caddy runs.
dataDir = "/data/apps/caddy";
dataDir = "/persistent/apps/caddy";
logDir = "/var/log/caddy";
# Additional lines of configuration appended to the global config section of the Caddyfile.
@@ -41,7 +41,7 @@ in
# https://caddyserver.com/docs/caddyfile/directives/file_server
virtualHosts."file.writefor.fun".extraConfig = ''
root * /data/apps/caddy/fileserver/
root * /persistent/apps/caddy/fileserver/
${hostCommonConfig}
file_server browse {
hide .git
@@ -110,15 +110,15 @@ in
# Create Directories
# https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html#Type
systemd.tmpfiles.rules = [
"d /data/apps/caddy/fileserver/ 0755 caddy caddy"
"d /persistent/apps/caddy/fileserver/ 0755 caddy caddy"
# directory for virtual machine's images
"d /data/apps/caddy/fileserver/vms 0755 caddy caddy"
"d /persistent/apps/caddy/fileserver/vms 0755 caddy caddy"
];
# Add all my wallpapers into /data/apps/caddy/fileserver/wallpapers
# Add all my wallpapers into /persistent/apps/caddy/fileserver/wallpapers
# Install the homepage-dashboard configuration files
system.activationScripts.installCaddyWallpapers = ''
mkdir -p /data/apps/caddy/fileserver/wallpapers
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F644 ${wallpapers}/ /data/apps/caddy/fileserver/wallpapers/
mkdir -p /persistent/apps/caddy/fileserver/wallpapers
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F644 ${wallpapers}/ /persistent/apps/caddy/fileserver/wallpapers/
'';
}
@@ -5,7 +5,7 @@
enable = true;
user = "gitea";
group = "gitea";
stateDir = "/data/apps/gitea";
stateDir = "/persistent/apps/gitea";
appName = "Ryan Yin's Gitea Service";
lfs.enable = true;
# Enable a timer that runs gitea dump to generate backup-files of the current gitea database and repositories.
@@ -13,7 +13,7 @@
services.grafana = {
enable = true;
dataDir = "/data/apps/grafana";
dataDir = "/persistent/apps/grafana";
provision.enable = true;
settings = {
server = {
@@ -19,20 +19,20 @@ let
in
{
# Since victoriametrics use DynamicUser, the user & group do not exists before the service starts.
# this group is used as a supplementary Unix group for the service to access our data dir(/data/apps/xxx)
# this group is used as a supplementary Unix group for the service to access our data dir(/persistent/apps/xxx)
users.groups.victoriametrics-data = { };
# Workaround for victoriametrics to store data in another place
# https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html#Type
systemd.tmpfiles.rules = [
"d /data/apps/victoriametrics 0770 root victoriametrics-data - -"
"d /persistent/apps/victoriametrics 0770 root victoriametrics-data - -"
];
# Symlinks do not work with DynamicUser, so we should use bind mount here.
# https://github.com/systemd/systemd/issues/25097#issuecomment-1929074961
systemd.services.victoriametrics.serviceConfig = {
SupplementaryGroups = [ "victoriametrics-data" ];
BindPaths = [ "/data/apps/victoriametrics:/var/lib/victoriametrics:rbind" ];
BindPaths = [ "/persistent/apps/victoriametrics:/var/lib/victoriametrics:rbind" ];
};
# https://victoriametrics.io/docs/victoriametrics/latest/configuration/configuration/
@@ -5,7 +5,7 @@
}:
let
user = "homepage";
configDir = "/data/apps/homepage-dashboard";
configDir = "/persistent/apps/homepage-dashboard";
in
{
users.groups.${user} = { };
@@ -1,7 +1,7 @@
{ config, ... }:
let
user = "kuma";
dataDir = "/data/apps/uptime-kuma";
dataDir = "/persistent/apps/uptime-kuma";
in
{
users.groups.${user} = { };
@@ -11,13 +11,13 @@ let
user = "postgres"; # postgresql's default system user
package = pkgs.postgresql_16;
dataDir = "/data/apps/postgresql/${package.psqlSchema}";
dataDir = "/persistent/apps/postgresql/${package.psqlSchema}";
in
{
# Create Directories
# https://www.freedesktop.org/software/systemd/man/latest/tmpfiles.d.html#Type
systemd.tmpfiles.rules = [
"d /data/apps/postgresql 0700 ${user} ${user}"
"d /persistent/apps/postgresql 0700 ${user} ${user}"
"d ${dataDir} 0700 ${user} ${user}"
];
@@ -1,7 +1,7 @@
{ config, lib, ... }:
let
user = "sftpgo";
dataDir = "/data/apps/sftpgo";
dataDir = "/persistent/apps/sftpgo";
in
{
# Read SFTPGO_DEFAULT_ADMIN_USERNAME and SFTPGO_DEFAULT_ADMIN_PASSWORD from a file