diff options
author | talyz <kim.lindberger@gmail.com> | 2021-06-02 14:33:13 +0200 |
---|---|---|
committer | talyz <kim.lindberger@gmail.com> | 2021-09-13 13:57:01 +0200 |
commit | 3a1e1f062432fbc867502187972b37f7a6f9fe63 (patch) | |
tree | c4bbf92d5f6c166b0a6d997533b7331dae53b920 /nixos/modules/services/search | |
parent | 5c61b9f3cb6ea038efc1390bd26f1f65f135c717 (diff) | |
download | nixpkgs-3a1e1f062432fbc867502187972b37f7a6f9fe63.tar nixpkgs-3a1e1f062432fbc867502187972b37f7a6f9fe63.tar.gz nixpkgs-3a1e1f062432fbc867502187972b37f7a6f9fe63.tar.bz2 nixpkgs-3a1e1f062432fbc867502187972b37f7a6f9fe63.tar.lz nixpkgs-3a1e1f062432fbc867502187972b37f7a6f9fe63.tar.xz nixpkgs-3a1e1f062432fbc867502187972b37f7a6f9fe63.tar.zst nixpkgs-3a1e1f062432fbc867502187972b37f7a6f9fe63.zip |
nixos/elasticsearch: Wait for elasticsearch to start up properly
Other services that depend on elasticsearch should be started after it, but since the versions we're packaging have to run as "Type=simple", they're started as soon as the elasticsearch binary has been executed, likely winning the race against it. This makes sure elasticsearch is up and running, responding to a simple query, before dependents are started.
Diffstat (limited to 'nixos/modules/services/search')
-rw-r--r-- | nixos/modules/services/search/elasticsearch.nix | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix index 1d7a28d5d24..3f676db2752 100644 --- a/nixos/modules/services/search/elasticsearch.nix +++ b/nixos/modules/services/search/elasticsearch.nix @@ -201,6 +201,13 @@ in if [ "$(id -u)" = 0 ]; then chown -R elasticsearch:elasticsearch ${cfg.dataDir}; fi ''; + postStart = '' + # Make sure elasticsearch is up and running before dependents + # are started + while ! ${pkgs.curl}/bin/curl -sS -f http://localhost:${toString cfg.port} 2>/dev/null; do + sleep 1 + done + ''; }; environment.systemPackages = [ cfg.package ]; |