This commit is contained in:
aloslider committed 2026-10-01 13:59:54 +03:00
1 parent 13e407847f
commit 374428658a
80 files changed
+2517 -1058

No files matched your search

@@ -1,17 +1,20 @@
{ config, ... }:
{ config, lib, ... }:
with lib;
let
cfg = config.selfhosted.seafile;
rootCfg = config.selfhosted.seafile;
in
{
sops.templates."seadoc.env".content = ''
DB_HOST=${cfg.mariadb.name}
DB_PORT=3306
DB_USER=seafile
DB_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
DB_NAME=seahub_db
TIME_ZONE=${config.time.timeZone}
JWT_PRIVATE_KEY=${config.sops.placeholder."seafile/jwt_private_key"}
NON_ROOT=false
SEAHUB_SERVICE_URL=http://${cfg.server.name}
'';
config = mkIf rootCfg.enable {
sops.templates."seadoc.env".content = ''
DB_HOST=${rootCfg.mariadb.name}
DB_PORT=3306
DB_USER=seafile
DB_PASSWORD=${config.sops.placeholder."seafile/mysql_password"}
DB_NAME=seahub_db
TIME_ZONE=${config.time.timeZone}
JWT_PRIVATE_KEY=${config.sops.placeholder."seafile/jwt_private_key"}
NON_ROOT=false
SEAHUB_SERVICE_URL=http://${rootCfg.server.name}
'';
};
}
@@ -2,7 +2,8 @@
with lib;
let
common = config.selfhosted.common;
cfg = config.selfhosted.seafile;
rootCfg = config.selfhosted.seafile;
cfg = rootCfg.seadoc;
hostDataPath = "${common.dataDir}/seafile";
in
{
@@ -17,11 +18,11 @@ in
};
};
config = {
virtualisation.oci-containers.containers.${cfg.seadoc.name} = {
config = mkIf rootCfg.enable {
virtualisation.oci-containers.containers.${cfg.name} = {
image = "docker.io/seafileltd/sdoc-server:2.0-latest";
ports = [
"0.0.0.0:${toString cfg.seadoc.hostHttpPort}:80"
"0.0.0.0:${toString cfg.hostHttpPort}:80"
];
volumes = [
"${hostDataPath}/seadoc/shared:/shared"
@@ -33,22 +34,14 @@ in
];
};
systemd.services."${common.backend}-${cfg.seadoc.name}" = {
systemd.services."${common.backend}-${cfg.name}" = {
serviceConfig = {
Restart = lib.mkOverride 90 "always";
};
after = [
"${common.backend}-network-${common.network.name}.service"
"${common.backend}-${config.selfhosted.traefik.name}.service"
"${common.backend}-${cfg.mariadb.name}.service"
];
requires = [
"${common.backend}-network-${common.network.name}.service"
"${common.backend}-${config.selfhosted.traefik.name}.service"
"${common.backend}-${cfg.mariadb.name}.service"
];
partOf = [ "${common.backend}-${cfg.targetName}.target" ];
wantedBy = [ "${common.backend}-${cfg.targetName}.target" ];
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
requires = [ "${common.backend}-${rootCfg.mariadb.name}.service" ];
after = [ "${common.backend}-${rootCfg.mariadb.name}.service" ];
preStart = ''
mkdir -p ${hostDataPath}/seadoc/shared
'';