Skip to content

Commit

Permalink
Merge pull request #1101 from morucci/start-kibana
Browse files Browse the repository at this point in the history
nix - add kibana-start command
  • Loading branch information
mergify[bot] authored Jan 6, 2024
2 parents 86fb2f0 + 7e9a717 commit a9289ac
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
44 changes: 41 additions & 3 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 ];
Expand Down

0 comments on commit a9289ac

Please sign in to comment.