nixos/gitlab: add services to systemd slice
Co-authored-by: Bjørn Forsman <bjorn.forsman@gmail.com>
This commit is contained in:
parent
03c0a80f39
commit
dd7a192b4f
@ -1127,6 +1127,11 @@ in {
|
|||||||
|
|
||||||
environment.systemPackages = [ gitlab-rake gitlab-rails cfg.packages.gitlab-shell ];
|
environment.systemPackages = [ gitlab-rake gitlab-rails cfg.packages.gitlab-shell ];
|
||||||
|
|
||||||
|
systemd.slices.system-gitlab = {
|
||||||
|
description = "GitLab DevOps Platform Slice";
|
||||||
|
documentation = [ "https://docs.gitlab.com/" ];
|
||||||
|
};
|
||||||
|
|
||||||
systemd.targets.gitlab = {
|
systemd.targets.gitlab = {
|
||||||
description = "Common target for all GitLab services.";
|
description = "Common target for all GitLab services.";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
@ -1197,6 +1202,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
User = pgsql.superUser;
|
User = pgsql.superUser;
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
@ -1220,6 +1226,9 @@ in {
|
|||||||
unitConfig = {
|
unitConfig = {
|
||||||
ConditionPathExists = "!${cfg.registry.certFile}";
|
ConditionPathExists = "!${cfg.registry.certFile}";
|
||||||
};
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Ensure Docker Registry launches after the certificate generation job
|
# Ensure Docker Registry launches after the certificate generation job
|
||||||
@ -1308,6 +1317,7 @@ in {
|
|||||||
TimeoutSec = "infinity";
|
TimeoutSec = "infinity";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
|
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
|
|
||||||
ExecStartPre = let
|
ExecStartPre = let
|
||||||
@ -1424,6 +1434,7 @@ in {
|
|||||||
TimeoutSec = "infinity";
|
TimeoutSec = "infinity";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
|
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
|
|
||||||
ExecStart = pkgs.writeShellScript "gitlab-db-config" ''
|
ExecStart = pkgs.writeShellScript "gitlab-db-config" ''
|
||||||
@ -1480,6 +1491,7 @@ in {
|
|||||||
TimeoutSec = "infinity";
|
TimeoutSec = "infinity";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
|
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
ExecStart = utils.escapeSystemdExecArgs (
|
ExecStart = utils.escapeSystemdExecArgs (
|
||||||
[
|
[
|
||||||
"${cfg.packages.gitlab}/share/gitlab/bin/sidekiq-cluster"
|
"${cfg.packages.gitlab}/share/gitlab/bin/sidekiq-cluster"
|
||||||
@ -1512,6 +1524,7 @@ in {
|
|||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
WorkingDirectory = gitlabEnv.HOME;
|
WorkingDirectory = gitlabEnv.HOME;
|
||||||
RuntimeDirectory = "gitaly";
|
RuntimeDirectory = "gitaly";
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
ExecStart = "${cfg.packages.gitaly}/bin/gitaly ${gitalyToml}";
|
ExecStart = "${cfg.packages.gitaly}/bin/gitaly ${gitalyToml}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -1573,6 +1586,7 @@ in {
|
|||||||
WorkingDirectory = gitlabEnv.HOME;
|
WorkingDirectory = gitlabEnv.HOME;
|
||||||
RuntimeDirectory = "gitlab-pages";
|
RuntimeDirectory = "gitlab-pages";
|
||||||
RuntimeDirectoryMode = "0700";
|
RuntimeDirectoryMode = "0700";
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1596,6 +1610,7 @@ in {
|
|||||||
TimeoutSec = "infinity";
|
TimeoutSec = "infinity";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
WorkingDirectory = gitlabEnv.HOME;
|
WorkingDirectory = gitlabEnv.HOME;
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
ExecStartPre = pkgs.writeShellScript "gitlab-workhorse-pre-start" ''
|
ExecStartPre = pkgs.writeShellScript "gitlab-workhorse-pre-start" ''
|
||||||
set -o errexit -o pipefail -o nounset
|
set -o errexit -o pipefail -o nounset
|
||||||
shopt -s dotglob nullglob inherit_errexit
|
shopt -s dotglob nullglob inherit_errexit
|
||||||
@ -1637,6 +1652,7 @@ in {
|
|||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
ExecStart = "${cfg.packages.gitlab.rubyEnv}/bin/bundle exec mail_room -c ${cfg.statePath}/config/mail_room.yml";
|
ExecStart = "${cfg.packages.gitlab.rubyEnv}/bin/bundle exec mail_room -c ${cfg.statePath}/config/mail_room.yml";
|
||||||
WorkingDirectory = gitlabEnv.HOME;
|
WorkingDirectory = gitlabEnv.HOME;
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1671,6 +1687,7 @@ in {
|
|||||||
TimeoutSec = "infinity";
|
TimeoutSec = "infinity";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
|
WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab";
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
ExecStart = concatStringsSep " " [
|
ExecStart = concatStringsSep " " [
|
||||||
"${cfg.packages.gitlab.rubyEnv}/bin/bundle" "exec" "puma"
|
"${cfg.packages.gitlab.rubyEnv}/bin/bundle" "exec" "puma"
|
||||||
"-e production"
|
"-e production"
|
||||||
@ -1695,6 +1712,7 @@ in {
|
|||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
|
Slice = "system-gitlab.slice";
|
||||||
ExecStart = "${gitlab-rake}/bin/gitlab-rake gitlab:backup:create";
|
ExecStart = "${gitlab-rake}/bin/gitlab-rake gitlab:backup:create";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user