Skip to content

Commit

Permalink
Revert "refactor: consolidate all settings in defaultProcessSettings (
Browse files Browse the repository at this point in the history
#348)"

This reverts commit 1e682a8.
  • Loading branch information
shivaraj-bh committed Oct 27, 2024
1 parent deaa2b8 commit daf8bd0
Show file tree
Hide file tree
Showing 21 changed files with 154 additions and 12 deletions.
12 changes: 0 additions & 12 deletions nix/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions nix/services/apache-kafka.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
10 changes: 10 additions & 0 deletions nix/services/cassandra.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
};
Expand Down
10 changes: 10 additions & 0 deletions nix/services/clickhouse/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
};
Expand Down
8 changes: 8 additions & 0 deletions nix/services/elasticsearch.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
};
Expand Down
8 changes: 8 additions & 0 deletions nix/services/grafana.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
};
Expand Down
5 changes: 5 additions & 0 deletions nix/services/memcached.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions nix/services/mysql/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions nix/services/nginx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
Expand Down
5 changes: 5 additions & 0 deletions nix/services/ollama.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 5 additions & 0 deletions nix/services/open-webui.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
10 changes: 10 additions & 0 deletions nix/services/pgadmin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
};
Expand Down
10 changes: 10 additions & 0 deletions nix/services/postgres/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
};
Expand Down
10 changes: 10 additions & 0 deletions nix/services/prometheus.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
};
Expand Down
10 changes: 10 additions & 0 deletions nix/services/redis-cluster.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions nix/services/redis.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
};
Expand Down
5 changes: 5 additions & 0 deletions nix/services/searxng.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
Expand Down
3 changes: 3 additions & 0 deletions nix/services/tempo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 5 additions & 0 deletions nix/services/tika.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
Expand Down
10 changes: 10 additions & 0 deletions nix/services/weaviate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
Expand Down
5 changes: 5 additions & 0 deletions nix/services/zookeeper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit daf8bd0

Please sign in to comment.