diff --git a/nix/lib.nix b/nix/lib.nix index 908a060d..a9078f48 100644 --- a/nix/lib.nix +++ b/nix/lib.nix @@ -38,18 +38,6 @@ ''; default = { namespace = lib.mkDefault config.namespace; - # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy - availability = { - restart = lib.mkDefault "on_failure"; - max_restarts = lib.mkDefault 5; - }; - readiness_probe = { - initial_delay_seconds = lib.mkDefault 2; - period_seconds = lib.mkDefault 10; - timeout_seconds = lib.mkDefault 4; - success_threshold = lib.mkDefault 1; - failure_threshold = lib.mkDefault 5; - }; }; }; settings = lib.mkOption { diff --git a/nix/services/apache-kafka.nix b/nix/services/apache-kafka.nix index 51d45bd6..642cbf80 100644 --- a/nix/services/apache-kafka.nix +++ b/nix/services/apache-kafka.nix @@ -170,6 +170,11 @@ with lib; readiness_probe = { # TODO: need to find a better way to check if kafka is ready. Maybe use one of the scripts in bin? exec.command = "${pkgs.netcat.nc}/bin/nc -z localhost ${builtins.toString config.port}"; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; availability = { diff --git a/nix/services/cassandra.nix b/nix/services/cassandra.nix index 184c6f01..8c23b3ca 100644 --- a/nix/services/cassandra.nix +++ b/nix/services/cassandra.nix @@ -146,8 +146,18 @@ in exec.command = '' echo 'show version;' | CQLSH_HOST=${config.listenAddress} CQLSH_PORT=${toString config.nativeTransportPort} ${config.package}/bin/cqlsh ''; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; }; }; diff --git a/nix/services/clickhouse/default.nix b/nix/services/clickhouse/default.nix index 14c37f4b..f31bbf0b 100644 --- a/nix/services/clickhouse/default.nix +++ b/nix/services/clickhouse/default.nix @@ -154,8 +154,18 @@ in host = "localhost"; port = if (lib.hasAttr "http_port" config.extraConfig) then config.extraConfig.http_port else 8123; }; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; depends_on."${name}-init".condition = "process_completed_successfully"; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; }; }; diff --git a/nix/services/elasticsearch.nix b/nix/services/elasticsearch.nix index 4186bdc1..07da86b0 100644 --- a/nix/services/elasticsearch.nix +++ b/nix/services/elasticsearch.nix @@ -185,9 +185,17 @@ in readiness_probe = { exec.command = "${pkgs.curl}/bin/curl -f -k http://${config.listenAddress}:${toString config.port}"; initial_delay_seconds = 15; + period_seconds = 10; timeout_seconds = 2; + success_threshold = 1; + failure_threshold = 5; }; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; }; }; diff --git a/nix/services/grafana.nix b/nix/services/grafana.nix index c89e52e9..8170e88b 100644 --- a/nix/services/grafana.nix +++ b/nix/services/grafana.nix @@ -167,9 +167,17 @@ in path = "/api/health"; }; initial_delay_seconds = 15; + period_seconds = 10; timeout_seconds = 2; + success_threshold = 1; + failure_threshold = 5; }; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; }; }; diff --git a/nix/services/memcached.nix b/nix/services/memcached.nix index bcd08cc7..be6b7103 100644 --- a/nix/services/memcached.nix +++ b/nix/services/memcached.nix @@ -45,6 +45,11 @@ in exec.command = '' echo -e "stats\nquit" | ${pkgs.netcat}/bin/nc ${config.bind} ${toString config.port} > /dev/null 2>&1 ''; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy diff --git a/nix/services/mysql/default.nix b/nix/services/mysql/default.nix index e4d1ce2a..d3c6fcbc 100644 --- a/nix/services/mysql/default.nix +++ b/nix/services/mysql/default.nix @@ -284,8 +284,18 @@ in # Turns out using `--defaults-file` alone doesn't make the readiness_probe work unless `MYSQL_UNIX_PORT` is set. # Hence the use of `--socket`. exec.command = "${config.package}/bin/mysqladmin --socket=${config.socketDir}/mysql.sock ping -h localhost"; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; "${name}-configure" = { command = configureScript; diff --git a/nix/services/nginx/default.nix b/nix/services/nginx/default.nix index f1738f1f..47453d2c 100644 --- a/nix/services/nginx/default.nix +++ b/nix/services/nginx/default.nix @@ -102,6 +102,16 @@ in readiness_probe = { # FIXME need a better health check exec.command = "[ -e ${config.dataDir}/nginx/nginx.pid ]"; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; + }; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; }; }; }; diff --git a/nix/services/ollama.nix b/nix/services/ollama.nix index b4330579..639a0804 100644 --- a/nix/services/ollama.nix +++ b/nix/services/ollama.nix @@ -104,6 +104,11 @@ in host = config.host; port = config.port; }; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; availability = { restart = "on_failure"; diff --git a/nix/services/open-webui.nix b/nix/services/open-webui.nix index 44b0b929..d63511bd 100644 --- a/nix/services/open-webui.nix +++ b/nix/services/open-webui.nix @@ -83,6 +83,11 @@ in host = config.host; port = config.port; }; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; availability = { restart = "on_failure"; diff --git a/nix/services/pgadmin.nix b/nix/services/pgadmin.nix index 09a37bdc..bff99243 100644 --- a/nix/services/pgadmin.nix +++ b/nix/services/pgadmin.nix @@ -151,8 +151,18 @@ in port = config.port; path = "/misc/ping"; }; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; depends_on."${name}-init".condition = "process_completed_successfully"; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; }; }; diff --git a/nix/services/postgres/default.nix b/nix/services/postgres/default.nix index 72c12222..f170efe7 100644 --- a/nix/services/postgres/default.nix +++ b/nix/services/postgres/default.nix @@ -326,8 +326,18 @@ in shutdown.signal = 2; readiness_probe = { exec.command = "${config.package}/bin/pg_isready ${lib.concatStringsSep " " pg_isreadyArgs}"; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; depends_on."${name}-init".condition = "process_completed_successfully"; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; }; }; diff --git a/nix/services/prometheus.nix b/nix/services/prometheus.nix index 4cfb1e9c..cf04b21a 100644 --- a/nix/services/prometheus.nix +++ b/nix/services/prometheus.nix @@ -82,8 +82,18 @@ in port = config.port; path = "/-/ready"; }; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; }; }; diff --git a/nix/services/redis-cluster.nix b/nix/services/redis-cluster.nix index 9d8f6711..9afba325 100644 --- a/nix/services/redis-cluster.nix +++ b/nix/services/redis-cluster.nix @@ -103,8 +103,18 @@ in readiness_probe = { exec.command = "${config.package}/bin/redis-cli -p ${port} ping"; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; hosts = lib.mapAttrsToList (_: cfg: "${config.bind}:${builtins.toString cfg.port}") config.nodes; clusterCreateScript = pkgs.writeShellApplication { diff --git a/nix/services/redis.nix b/nix/services/redis.nix index f4444177..6b5c3039 100644 --- a/nix/services/redis.nix +++ b/nix/services/redis.nix @@ -104,7 +104,17 @@ in "${config.package}/bin/redis-cli -s ${transformedSocketPath} ${toString config.port} ping" else "${config.package}/bin/redis-cli -p ${toString config.port} ping"; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; + }; }; }; }; diff --git a/nix/services/searxng.nix b/nix/services/searxng.nix index 573a1edd..1b30b0ac 100644 --- a/nix/services/searxng.nix +++ b/nix/services/searxng.nix @@ -72,6 +72,11 @@ in host = config.host; port = config.port; }; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; }; }; diff --git a/nix/services/tempo.nix b/nix/services/tempo.nix index 1d12bbdb..22e6e966 100644 --- a/nix/services/tempo.nix +++ b/nix/services/tempo.nix @@ -112,7 +112,10 @@ in path = "/ready"; }; initial_delay_seconds = 15; + period_seconds = 10; timeout_seconds = 2; + success_threshold = 1; + failure_threshold = 5; }; availability = { restart = "on_failure"; diff --git a/nix/services/tika.nix b/nix/services/tika.nix index 754330cb..9eac4a9f 100644 --- a/nix/services/tika.nix +++ b/nix/services/tika.nix @@ -58,6 +58,11 @@ in host = config.host; port = config.port; }; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; }; }; diff --git a/nix/services/weaviate.nix b/nix/services/weaviate.nix index 9b410cdd..94c6d0ce 100644 --- a/nix/services/weaviate.nix +++ b/nix/services/weaviate.nix @@ -73,6 +73,16 @@ in path = "/v1/.well-known/ready"; }; initial_delay_seconds = 3; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; + }; + + # https://github.com/F1bonacc1/process-compose#-auto-restart-if-not-healthy + availability = { + restart = "on_failure"; + max_restarts = 5; }; }; }; diff --git a/nix/services/zookeeper.nix b/nix/services/zookeeper.nix index 2eb07768..0ddc1b3b 100644 --- a/nix/services/zookeeper.nix +++ b/nix/services/zookeeper.nix @@ -132,6 +132,11 @@ with lib; readiness_probe = { exec.command = "echo stat | ${pkgs.netcat.nc}/bin/nc localhost ${toString config.port}"; + initial_delay_seconds = 2; + period_seconds = 10; + timeout_seconds = 4; + success_threshold = 1; + failure_threshold = 5; }; availability = {