diff --git a/example/flake.lock b/example/flake.lock index ff90248..c5955d9 100644 --- a/example/flake.lock +++ b/example/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1687274257, - "narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=", + "lastModified": 1693844670, + "narHash": "sha256-t69F2nBB8DNQUWHD809oJZJVE+23XBrth4QZuVd6IE0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5", + "rev": "3c15feef7770eb5500a4b8792623e2d6f598c9c1", "type": "github" }, "original": { @@ -70,11 +70,11 @@ }, "process-compose-flake": { "locked": { - "lastModified": 1692810585, - "narHash": "sha256-Zc8nDSVkTUskB5mp9fh1mmOIUvx2pJ5V/Uq/0kxQ6B0=", + "lastModified": 1693927910, + "narHash": "sha256-qPKHnWWzHS2bAi/SsFePQkGFeC2E1jklUjEidfQwYLc=", "owner": "Platonic-Systems", "repo": "process-compose-flake", - "rev": "2a84a6c2c91c6244e5db8fd46551d5e7f31a85d3", + "rev": "5494afa0b6a7bc4ccf82ef1c36fe1fcdb4217255", "type": "github" }, "original": { @@ -95,11 +95,11 @@ }, "services-flake": { "locked": { - "lastModified": 1689713819, - "narHash": "sha256-ZjDQNRGpbxYSEYoqKmCdIOx+fV2q5lyiYWznHQ0fMkk=", + "lastModified": 1693467006, + "narHash": "sha256-negT+528qZyomG5ZotqNx7l0IA7vbJ2fGAM6F5ortAY=", "owner": "juspay", "repo": "services-flake", - "rev": "321ef32a28ed0e59160cf130c3a7c55e3b979e85", + "rev": "5fdd56f0900f05ef5bf1b8a348fabbd280f0c60b", "type": "github" }, "original": { diff --git a/nix/apache-kafka_test.nix b/nix/apache-kafka_test.nix index 5f07fb2..70dd7e9 100644 --- a/nix/apache-kafka_test.nix +++ b/nix/apache-kafka_test.nix @@ -1,10 +1,13 @@ { pkgs, config, ... }: { services.zookeeper."z1".enable = true; + # To avoid conflicting with `zookeeper_test.nix` in case the tests are run in parallel + services.zookeeper."z1".port = 2182; services.apache-kafka."k1".enable = true; + services.apache-kafka."k1".zookeeper = "localhost:2182"; settings.processes.test = { command = pkgs.writeShellApplication { - runtimeInputs = [ pkgs.bash config.package ]; + runtimeInputs = [ pkgs.bash config.services.apache-kafka.k1.package ]; text = '' bash kafka-topics.sh --list --bootstrap-server localhost:9092 ''; diff --git a/nix/elasticsearch.nix b/nix/elasticsearch.nix index b808099..1cdcd6e 100644 --- a/nix/elasticsearch.nix +++ b/nix/elasticsearch.nix @@ -144,10 +144,10 @@ in startScript = pkgs.writeShellScript "es-startup" '' set -e + mkdir -m 0700 -p "${config.dataDir}" export ES_HOME=$(${pkgs.coreutils}/bin/realpath ${config.dataDir}) export ES_JAVA_OPTS="${toString config.extraJavaOptions}" export ES_PATH_CONF="${config.dataDir}/config" - mkdir -m 0700 -p "${config.dataDir}" # Install plugins rm -f "${config.dataDir}/plugins" ln -sf ${esPlugins}/plugins "${config.dataDir}/plugins" diff --git a/nix/postgres.nix b/nix/postgres.nix index 39f6ada..05a17d2 100644 --- a/nix/postgres.nix +++ b/nix/postgres.nix @@ -343,7 +343,8 @@ in initdbArgs = config.initdbArgs - ++ (lib.optionals (config.superuser != null) [ "-U" config.superuser ]); + ++ (lib.optionals (config.superuser != null) [ "-U" config.superuser ]) + ++ ["-D" config.dataDir ]; setupScript = pkgs.writeShellScriptBin "setup-postgres" '' set -euo pipefail @@ -351,6 +352,7 @@ in if [[ ! -d "$PGDATA" ]]; then set -x + mkdir -p ${config.dataDir} initdb ${lib.concatStringsSep " " initdbArgs} set +x diff --git a/nix/zookeeper.nix b/nix/zookeeper.nix index f75dced..4147c3d 100644 --- a/nix/zookeeper.nix +++ b/nix/zookeeper.nix @@ -112,6 +112,7 @@ with lib; ${config.extraConf} ${config.servers} admin.enableServer=false + 4lw.commands.whitelist=stat ''; configDir = pkgs.buildEnv { @@ -136,8 +137,7 @@ with lib; command = "${startScript}/bin/start-zookeeper"; readiness_probe = { - # TODO: need to find a better way to check if zookeeper is ready, maybe `zkCli.sh`? - exec.command = "${pkgs.netcat.nc}/bin/nc -z localhost ${toString config.port}"; + exec.command = "echo stat | ${pkgs.netcat.nc}/bin/nc localhost ${toString config.port}"; initial_delay_seconds = 2; period_seconds = 10; timeout_seconds = 4; diff --git a/nix/zookeeper_test.nix b/nix/zookeeper_test.nix index 22e9b82..848ac9c 100644 --- a/nix/zookeeper_test.nix +++ b/nix/zookeeper_test.nix @@ -3,9 +3,9 @@ settings.processes.test = { command = pkgs.writeShellApplication { - runtimeInputs = [ pkgs.bash config.package ]; + runtimeInputs = [ config.services.zookeeper.z1.package pkgs.netcat.nc ]; text = '' - bash zkCli.sh -server localhost:2181 get / + echo stat | nc localhost 2181 ''; name = "zookeeper-test"; }; diff --git a/test/flake.lock b/test/flake.lock index ae98ebc..e446779 100644 --- a/test/flake.lock +++ b/test/flake.lock @@ -54,11 +54,11 @@ }, "process-compose-flake": { "locked": { - "lastModified": 1692810585, - "narHash": "sha256-Zc8nDSVkTUskB5mp9fh1mmOIUvx2pJ5V/Uq/0kxQ6B0=", + "lastModified": 1693927910, + "narHash": "sha256-qPKHnWWzHS2bAi/SsFePQkGFeC2E1jklUjEidfQwYLc=", "owner": "Platonic-Systems", "repo": "process-compose-flake", - "rev": "2a84a6c2c91c6244e5db8fd46551d5e7f31a85d3", + "rev": "5494afa0b6a7bc4ccf82ef1c36fe1fcdb4217255", "type": "github" }, "original": {