Nix module: make systemd units wait for redis/postges conditionally
If createLocally is not set, do not wait for the units, in case they're not actually on current server.
This commit is contained in:
parent
2c335f5505
commit
10895f6fea
1 changed files with 10 additions and 9 deletions
|
@ -39,6 +39,8 @@ let
|
||||||
EMAIL_HOST_PASSWORD = cfg.email.passwordFile;
|
EMAIL_HOST_PASSWORD = cfg.email.passwordFile;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
redisCreateLocally = cfg.celeryRedis.createLocally || cfg.activityRedis.createLocally;
|
||||||
|
|
||||||
loadEnv = (pkgs.writeScript "load-bookwyrm-env" ''
|
loadEnv = (pkgs.writeScript "load-bookwyrm-env" ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
${lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "export ${n}='${v}'") env)}
|
${lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "export ${n}='${v}'") env)}
|
||||||
|
@ -368,12 +370,12 @@ in
|
||||||
"redis.service"
|
"redis.service"
|
||||||
"postgresql.service"
|
"postgresql.service"
|
||||||
"bookwyrm-celery.service"
|
"bookwyrm-celery.service"
|
||||||
];
|
] ++ optional redisCreateLocally "redis.service"
|
||||||
|
++ optional cfg.database.createLocally "postgresql.service";
|
||||||
bindsTo = [
|
bindsTo = [
|
||||||
"redis.service"
|
|
||||||
"postgresql.service"
|
|
||||||
"bookwyrm-celery.service"
|
"bookwyrm-celery.service"
|
||||||
];
|
] ++ optional redisCreateLocally "redis.service"
|
||||||
|
++ optional cfg.database.createLocally "postgresql.service";
|
||||||
wantedBy = [ "bookwyrm.target" ];
|
wantedBy = [ "bookwyrm.target" ];
|
||||||
partOf = [ "bookwyrm.target" ];
|
partOf = [ "bookwyrm.target" ];
|
||||||
environment = env;
|
environment = env;
|
||||||
|
@ -403,9 +405,8 @@ in
|
||||||
description = "Celery service for bookwyrm.";
|
description = "Celery service for bookwyrm.";
|
||||||
after = [
|
after = [
|
||||||
"network.target"
|
"network.target"
|
||||||
"redis.service"
|
] ++ optional redisCreateLocally "redis.service";
|
||||||
];
|
bindsTo = optionals redisCreateLocally [
|
||||||
bindsTo = [
|
|
||||||
"redis.service"
|
"redis.service"
|
||||||
];
|
];
|
||||||
wantedBy = [ "bookwyrm.target" ];
|
wantedBy = [ "bookwyrm.target" ];
|
||||||
|
@ -432,8 +433,8 @@ in
|
||||||
"network.target"
|
"network.target"
|
||||||
"redis.service"
|
"redis.service"
|
||||||
"bookwyrm-celery.service"
|
"bookwyrm-celery.service"
|
||||||
];
|
] ++ optional redisCreateLocally "redis.service";
|
||||||
bindsTo = [
|
bindsTo = optionals redisCreateLocally [
|
||||||
"redis.service"
|
"redis.service"
|
||||||
];
|
];
|
||||||
wantedBy = [ "bookwyrm.target" ];
|
wantedBy = [ "bookwyrm.target" ];
|
||||||
|
|
Loading…
Add table
Reference in a new issue