WIP
This commit is contained in:
1 parent
13e407847f
commit
374428658a
80 files changed
+2517
-1058
No files matched your search
@@ -2,7 +2,8 @@
|
||||
with lib;
|
||||
let
|
||||
common = config.selfhosted.common;
|
||||
cfg = config.selfhosted.seafile;
|
||||
rootCfg = config.selfhosted.seafile;
|
||||
cfg = rootCfg.notification;
|
||||
hostDataPath = "${common.dataDir}/seafile";
|
||||
in
|
||||
{
|
||||
@@ -17,11 +18,11 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
virtualisation.oci-containers.containers.${cfg.notification.name} = {
|
||||
config = mkIf rootCfg.enable {
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
image = "docker.io/seafileltd/notification-server:13.0-latest";
|
||||
ports = [
|
||||
"0.0.0.0:${toString cfg.notification.hostHttpPort}:8083"
|
||||
"0.0.0.0:${toString cfg.hostHttpPort}:8083"
|
||||
];
|
||||
environmentFiles = [ config.sops.templates."seafile-notification.env".path ];
|
||||
volumes = [
|
||||
@@ -33,29 +34,25 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services."${common.backend}-${cfg.notification.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"
|
||||
"${common.backend}-${cfg.server.name}.service"
|
||||
];
|
||||
wantedBy = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
partOf = [ "${common.backend}-${rootCfg.targetName}.target" ];
|
||||
requires = [
|
||||
"${common.backend}-network-${common.network.name}.service"
|
||||
"${common.backend}-${config.selfhosted.traefik.name}.service"
|
||||
"${common.backend}-${cfg.mariadb.name}.service"
|
||||
"${common.backend}-${cfg.server.name}.service"
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.server.name}.service"
|
||||
];
|
||||
after = [
|
||||
"${common.backend}-${rootCfg.mariadb.name}.service"
|
||||
"${common.backend}-${rootCfg.server.name}.service"
|
||||
];
|
||||
partOf = [ "${common.backend}-${cfg.targetName}.target" ];
|
||||
wantedBy = [ "${common.backend}-${cfg.targetName}.target" ];
|
||||
path = with pkgs; [ curl gawk ];
|
||||
preStart = ''
|
||||
echo "Waiting for Seafile server to be ready..."
|
||||
for i in {1..60}; do
|
||||
status=$(curl -sI --max-time 5 "http://localhost:${toString cfg.server.hostHttpPort}" | head -1 | awk '{print $2}')
|
||||
status=$(curl -sI --max-time 5 "http://localhost:${toString rootCfg.server.hostHttpPort}" | head -1 | awk '{print $2}')
|
||||
|
||||
if [[ "$status" =~ ^(200|301|302)$ ]]; then
|
||||
echo "Seafile server is up (HTTP $status, attempt $i)"
|
||||
|
||||
Reference in new issue
Block a user