Refactor
This commit is contained in:
@@ -24,55 +24,60 @@ let
|
||||
};
|
||||
|
||||
in {
|
||||
sops = true;
|
||||
db = true;
|
||||
paths = [{
|
||||
path="${serverCfg.path.config}/invidious";
|
||||
mode = "0755";
|
||||
}];
|
||||
requires = {
|
||||
secrets = [ name ];
|
||||
databases = [ name ];
|
||||
};
|
||||
|
||||
containers = {
|
||||
server = builder.mkContainer {
|
||||
subdomain = containerCfg.subdomain;
|
||||
imageStream = image;
|
||||
port = 3000;
|
||||
secret = name;
|
||||
extraLabels = {
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.rule" = "Host(`${containerCfg.subdomain}.${serverCfg.domain}`) && Path(`/login`) ";
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.middlewares" = if serverCfg.containers?authentik then "authentik" else "";
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.priority" = "100";
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.entrypoints" = "web-secure";
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.tls" = "true";
|
||||
runtime = {
|
||||
paths = [{
|
||||
path="${serverCfg.path.config}/invidious";
|
||||
mode = "0755";
|
||||
}];
|
||||
|
||||
containers = {
|
||||
server = builder.mkContainer {
|
||||
subdomain = containerCfg.subdomain;
|
||||
imageStream = image;
|
||||
port = 3000;
|
||||
secret = name;
|
||||
extraLabels = {
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.rule" = "Host(`${containerCfg.subdomain}.${serverCfg.domain}`) && Path(`/login`) ";
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.middlewares" = if serverCfg.containers?authentik then "authentik" else "";
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.priority" = "100";
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.entrypoints" = "web-secure";
|
||||
"traefik.http.routers.${containerCfg.subdomain}-login.tls" = "true";
|
||||
};
|
||||
extraEnv = {
|
||||
INVIDIOUS_CONFIG_FILE = "/data/config.yml";
|
||||
};
|
||||
overrides = {
|
||||
volumes = [
|
||||
"${serverCfg.path.config}/invidious:/data:ro"
|
||||
];
|
||||
};
|
||||
};
|
||||
extraEnv = {
|
||||
INVIDIOUS_CONFIG_FILE = "/data/config.yml";
|
||||
};
|
||||
overrides = {
|
||||
volumes = [
|
||||
"${serverCfg.path.config}/invidious:/data:ro"
|
||||
|
||||
companion = builder.mkContainer {
|
||||
image = "quay.io/invidious/invidious-companion:latest";
|
||||
port = 8282;
|
||||
secret = name; #SERVER_SECRET_KEY = INVIDIOUS_COMPANION_KEY
|
||||
extraOptions = [
|
||||
"--cap-drop=all"
|
||||
"--security-opt=no-new-privileges"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
companion = builder.mkContainer {
|
||||
image = "quay.io/invidious/invidious-companion:latest";
|
||||
port = 8282;
|
||||
secret = name; #SERVER_SECRET_KEY = INVIDIOUS_COMPANION_KEY
|
||||
extraOptions = [
|
||||
"--cap-drop=all"
|
||||
"--security-opt=no-new-privileges"
|
||||
];
|
||||
setup = {
|
||||
trigger = "server";
|
||||
envFile = [ config.sops.secrets."INVIDIOUS".path config.sops.secrets."CUSTOM".path ];
|
||||
script = pkgs.writeShellScript "setup" ''
|
||||
export DB_HOST=${builder.host}
|
||||
export INVIDIOUS_DOMAIN=${containerCfg.subdomain}.${serverCfg.domain}
|
||||
|
||||
${pkgs.gettext}/bin/envsubst < "${../data/invidious/config.yml}" > "${serverCfg.path.config}/invidious/config.yml"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
setup = {
|
||||
trigger = "server";
|
||||
envFile = [ config.sops.secrets."INVIDIOUS".path config.sops.secrets."CUSTOM".path ];
|
||||
script = pkgs.writeShellScript "setup" ''
|
||||
export DB_HOST=${builder.host}
|
||||
export INVIDIOUS_DOMAIN=${containerCfg.subdomain}.${serverCfg.domain}
|
||||
|
||||
${pkgs.gettext}/bin/envsubst < "${../data/invidious/config.yml}" > "${serverCfg.path.config}/invidious/config.yml"
|
||||
'';
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user