diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 787498edd..31f6be65b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -182,6 +182,17 @@ export CRAWLERS_API_KEY=$(uuidgen) ghcid --set ":set args api" --test 'CLI.main' ``` +## Run Kibana to introspect Elasticsearch indices + + +Start Kibana with: + +```ShellSession +nix develop --command kibana-start +``` + +Then access http://localhost:5601 + ## Fake data provisionning Provisonning fake data (only fake changes are supported) can be done using the repl: diff --git a/nix/default.nix b/nix/default.nix index 8ce7e4277..5138a7eff 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -93,11 +93,12 @@ in rec { hExtend = haskellExtend; # DB + elk7Version = "7.17.5"; info = pkgs.lib.splitString "-" pkgs.stdenv.hostPlatform.system; arch = pkgs.lib.elemAt info 0; plat = pkgs.lib.elemAt info 1; elasticsearch = pkgsNonFree.elasticsearch7.overrideAttrs (old: rec { - version = "7.17.5"; + version = elk7Version; name = "elasticsearch-${version}"; src = pkgs.fetchurl { url = @@ -134,6 +135,38 @@ in rec { cat ${elasticsearchConf} > $ES_HOME/config/elasticsearch.yml exec ${elasticsearch}/bin/elasticsearch ''; + # DB Companion + kibana = pkgsNonFree.kibana7.overrideAttrs (old: rec { + version = elk7Version; + name = "kibana-${version}"; + src = pkgs.fetchurl { + url = + "https://artifacts.elastic.co/downloads/kibana/${name}-${plat}-${arch}.tar.gz"; + sha256 = "Oobbs3es1AegTFmzG2ln+iuJaRZrONamzDQOXKRF2Tk="; + }; + }); + kibana-home = "~/.local/share/monocle/kibana-home"; + kibanaConf = pkgs.writeTextFile { + name = "kibana.yml"; + text = '' + path.data: ${kibana-home}/data + elasticsearch.hosts: [ "http://localhost:${toString elasticsearch-port}" ] + ''; + }; + kibanaStart = pkgs.writeScriptBin "kibana-start" '' + ${headers} + + ${mkHome kibana-home} + + mkdir -p ${kibana-home}/config + mkdir -p ${kibana-home}/data + + cat ${kibanaConf} > ${kibana-home}/config/kibana.yml + + export KBN_PATH_CONF=${kibana-home}/config + export DATA_PATH=${kibana-home}/data + exec ${kibana}/bin/kibana + ''; # Prometheus promConf = pkgs.writeTextFile { @@ -321,8 +354,13 @@ in rec { exec ${pkgs.nodejs}/bin/npm start ''; - services-req = - [ elasticsearchStart monocleReplStart monocleWebStart monocleGhcid ]; + services-req = [ + kibanaStart + elasticsearchStart + monocleReplStart + monocleWebStart + monocleGhcid + ]; # define the base requirements base-req = [ pkgs.bashInteractive hspkgs.coreutils pkgs.gnumake ];