-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #903 from soebbing/influxdb
Add influxdb module
- Loading branch information
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
devenv up & | ||
DEVENV_PID=$! | ||
export DEVENV_PID | ||
|
||
function stop() { | ||
pkill -P "$DEVENV_PID" | ||
} | ||
|
||
trap stop EXIT | ||
|
||
# We test for the none-default port, configured in the nix file | ||
timeout 60 bash -c 'until echo > /dev/tcp/localhost/8087; do sleep 0.5; done' | ||
|
||
influx --port 8087 --execute "CREATE DATABASE devenv" | ||
DATABASES=$(influx --port 8087 --execute "SHOW DATABASES" | grep devenv) | ||
|
||
if [[ "$DATABASES" != "devenv" ]]; then | ||
echo "The influxdb database was not created" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ pkgs, config, ... }: | ||
|
||
let | ||
cfg = config.services.influxdb; | ||
in | ||
{ | ||
packages = [ | ||
pkgs.influxdb | ||
]; | ||
|
||
services.influxdb.enable = true; | ||
services.influxdb.config = '' | ||
[meta] | ||
dir = "/tmp/influxdb/meta" | ||
[data] | ||
dir = "/tmp/influxdb/data" | ||
wal-dir = "/tmp/influxdb/wal" | ||
query-log-enabled = true | ||
cache-max-memory-size = 1048576000 | ||
cache-snapshot-memory-size = 26214400 | ||
cache-snapshot-write-cold-duration = "10m" | ||
compact-full-write-cold-duration = "4h" | ||
[coordinator] | ||
write-timeout = "10s" | ||
max-concurrent-queries = 0 | ||
query-timeout = "0s" | ||
log-queries-after = "0s" | ||
max-select-point = 0 | ||
max-select-series = 0 | ||
max-select-buckets = 0 | ||
[retention] | ||
enabled = true | ||
check-interval = "30m" | ||
[shard-precreation] | ||
enabled = true | ||
check-interval = "10m" | ||
advance-period = "30m" | ||
[monitor] | ||
store-enabled = true | ||
store-database = "_internal" | ||
store-interval = "10s" | ||
[http] | ||
enabled = true | ||
bind-address = ":8087" | ||
auth-enabled = false | ||
log-enabled = true | ||
write-tracing = false | ||
pprof-enabled = true | ||
https-enabled = false | ||
[logging] | ||
format = "auto" | ||
level = "info" | ||
suppress-logo = false | ||
[[graphite]] | ||
enabled = false | ||
[[collectd]] | ||
enabled = false | ||
[[opentsdb]] | ||
enabled = false | ||
[[udp]] | ||
enabled = false | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
inputs: | ||
nixpkgs: | ||
url: github:NixOS/nixpkgs/nixpkgs-unstable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ pkgs, lib, config, ... }: | ||
|
||
let | ||
cfg = config.services.influxdb; | ||
types = lib.types; | ||
in | ||
{ | ||
options.services.influxdb = { | ||
enable = lib.mkEnableOption "influxdb"; | ||
|
||
package = lib.mkOption { | ||
type = types.package; | ||
description = "An open-source distributed time series database"; | ||
default = pkgs.influxdb; | ||
defaultText = lib.literalExpression "pkgs.influxdb"; | ||
}; | ||
|
||
config = lib.mkOption { | ||
type = types.lines; | ||
default = ""; | ||
description = "Configuration for InfluxDB-server"; | ||
}; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
processes.influxdb-server.exec = "${cfg.package}/bin/influxd -config ${pkgs.writeText "influxdb.conf" cfg.config}"; | ||
}; | ||
} |