From 3dfb2c685a69afc1b8655f96f8e6c8ff0cddda21 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Mon, 5 Aug 2024 17:37:12 +0200 Subject: [PATCH] nixos/pretix: restart web and worker unit on failure Found a few instances, where celery intermittently complained about a misconfigured redis instance and exited. > redis.exceptions.ResponseError: MISCONF Redis is configured to save RDB > snapshots, but it's currently unable to persist to disk. Commands that > may modify the data set are disabled, because this instance is > configured to report errors during writes if RDB snapshotting fails > (stop-writes-on-bgsave-error option). Please check the Redis logs for > details about the RDB error. --- nixos/modules/services/web-apps/pretix.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/web-apps/pretix.nix b/nixos/modules/services/web-apps/pretix.nix index 853611c41ef7..d298caab5b86 100644 --- a/nixos/modules/services/web-apps/pretix.nix +++ b/nixos/modules/services/web-apps/pretix.nix @@ -538,6 +538,7 @@ in TimeoutStartSec = "15min"; ExecStart = "${getExe' pythonEnv "gunicorn"} --bind unix:/run/pretix/pretix.sock ${cfg.gunicorn.extraArgs} pretix.wsgi"; RuntimeDirectory = "pretix"; + Restart = "on-failure"; }; }; @@ -559,7 +560,10 @@ in "postgresql.service" ]; wantedBy = [ "multi-user.target" ]; - serviceConfig.ExecStart = "${getExe' pythonEnv "celery"} -A pretix.celery_app worker ${cfg.celery.extraArgs}"; + serviceConfig = { + ExecStart = "${getExe' pythonEnv "celery"} -A pretix.celery_app worker ${cfg.celery.extraArgs}"; + Restart = "on-failure"; + }; }; nginx.serviceConfig.SupplementaryGroups = mkIf cfg.nginx.enable [ "pretix" ];