nixos/services.gitlab: loosen the coupling between gitlab and postgres/ redis to avoid restarts and races
Gitlab stays running at redis and postgresql restarts as if these components were on a different host anyways. Handling reconnetctions is part of the application logic. Co-authored-by: Kim Lindberger <kim.lindberger@gmail.com> for formatting fixes and test failure debugging.
This commit is contained in:
parent
d5245c0ef7
commit
13ba002dd0
2 changed files with 7 additions and 9 deletions
|
@ -1386,10 +1386,8 @@ in {
|
||||||
|
|
||||||
systemd.services.gitlab-db-config = {
|
systemd.services.gitlab-db-config = {
|
||||||
after = [ "gitlab-config.service" "gitlab-postgresql.service" "postgresql.service" ];
|
after = [ "gitlab-config.service" "gitlab-postgresql.service" "postgresql.service" ];
|
||||||
bindsTo = [
|
wants = optional (cfg.databaseHost == "") "postgresql.service" ++ optional databaseActuallyCreateLocally "gitlab-postgresql.service";
|
||||||
"gitlab-config.service"
|
bindsTo = [ "gitlab-config.service" ];
|
||||||
] ++ optional (cfg.databaseHost == "") "postgresql.service"
|
|
||||||
++ optional databaseActuallyCreateLocally "gitlab-postgresql.service";
|
|
||||||
wantedBy = [ "gitlab.target" ];
|
wantedBy = [ "gitlab.target" ];
|
||||||
partOf = [ "gitlab.target" ];
|
partOf = [ "gitlab.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
@ -1422,10 +1420,10 @@ in {
|
||||||
"gitlab-db-config.service"
|
"gitlab-db-config.service"
|
||||||
];
|
];
|
||||||
bindsTo = [
|
bindsTo = [
|
||||||
"redis-gitlab.service"
|
|
||||||
"gitlab-config.service"
|
"gitlab-config.service"
|
||||||
"gitlab-db-config.service"
|
"gitlab-db-config.service"
|
||||||
] ++ optional (cfg.databaseHost == "") "postgresql.service";
|
];
|
||||||
|
wants = [ "redis-gitlab.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service";
|
||||||
wantedBy = [ "gitlab.target" ];
|
wantedBy = [ "gitlab.target" ];
|
||||||
partOf = [ "gitlab.target" ];
|
partOf = [ "gitlab.target" ];
|
||||||
environment = gitlabEnv // (optionalAttrs cfg.sidekiq.memoryKiller.enable {
|
environment = gitlabEnv // (optionalAttrs cfg.sidekiq.memoryKiller.enable {
|
||||||
|
@ -1612,10 +1610,10 @@ in {
|
||||||
"gitlab-db-config.service"
|
"gitlab-db-config.service"
|
||||||
];
|
];
|
||||||
bindsTo = [
|
bindsTo = [
|
||||||
"redis-gitlab.service"
|
|
||||||
"gitlab-config.service"
|
"gitlab-config.service"
|
||||||
"gitlab-db-config.service"
|
"gitlab-db-config.service"
|
||||||
] ++ optional (cfg.databaseHost == "") "postgresql.service";
|
];
|
||||||
|
wants = [ "redis-gitlab.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service";
|
||||||
requiredBy = [ "gitlab.target" ];
|
requiredBy = [ "gitlab.target" ];
|
||||||
partOf = [ "gitlab.target" ];
|
partOf = [ "gitlab.target" ];
|
||||||
environment = gitlabEnv;
|
environment = gitlabEnv;
|
||||||
|
|
|
@ -419,7 +419,7 @@ in {
|
||||||
gitlab.systemctl("start gitlab-backup.service")
|
gitlab.systemctl("start gitlab-backup.service")
|
||||||
gitlab.wait_for_unit("gitlab-backup.service")
|
gitlab.wait_for_unit("gitlab-backup.service")
|
||||||
gitlab.wait_for_file("${nodes.gitlab.services.gitlab.statePath}/backup/dump_gitlab_backup.tar")
|
gitlab.wait_for_file("${nodes.gitlab.services.gitlab.statePath}/backup/dump_gitlab_backup.tar")
|
||||||
gitlab.systemctl("stop postgresql.service gitlab.target")
|
gitlab.systemctl("stop postgresql.service gitlab-config.service gitlab.target")
|
||||||
gitlab.succeed(
|
gitlab.succeed(
|
||||||
"find ${nodes.gitlab.services.gitlab.statePath} -mindepth 1 -maxdepth 1 -not -name backup -execdir rm -r {} +"
|
"find ${nodes.gitlab.services.gitlab.statePath} -mindepth 1 -maxdepth 1 -not -name backup -execdir rm -r {} +"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue