Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix - add kibana-start command #1101

Merged
merged 2 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading