diff options
author | Jaka Hudoklin <jakahudoklin@gmail.com> | 2015-11-16 12:59:30 +0100 |
---|---|---|
committer | Jaka Hudoklin <jakahudoklin@gmail.com> | 2015-11-16 14:22:08 +0100 |
commit | 9c1943fb6fc9cd82cf121d06a6d16e945929ea56 (patch) | |
tree | 3372a1fa87ce04eb0dda09919dc12c1644217078 /nixos/modules/services/databases/influxdb.nix | |
parent | 88f5cfc1268dfd75556f8d890d841efe56243fd4 (diff) | |
download | nixpkgs-9c1943fb6fc9cd82cf121d06a6d16e945929ea56.tar nixpkgs-9c1943fb6fc9cd82cf121d06a6d16e945929ea56.tar.gz nixpkgs-9c1943fb6fc9cd82cf121d06a6d16e945929ea56.tar.bz2 nixpkgs-9c1943fb6fc9cd82cf121d06a6d16e945929ea56.tar.lz nixpkgs-9c1943fb6fc9cd82cf121d06a6d16e945929ea56.tar.xz nixpkgs-9c1943fb6fc9cd82cf121d06a6d16e945929ea56.tar.zst nixpkgs-9c1943fb6fc9cd82cf121d06a6d16e945929ea56.zip |
influxdb: 0.8.3 -> 0.9.4, fix module
Diffstat (limited to 'nixos/modules/services/databases/influxdb.nix')
-rw-r--r-- | nixos/modules/services/databases/influxdb.nix | 239 |
1 files changed, 90 insertions, 149 deletions
diff --git a/nixos/modules/services/databases/influxdb.nix b/nixos/modules/services/databases/influxdb.nix index 08963f7aab7..8d63f14c67b 100644 --- a/nixos/modules/services/databases/influxdb.nix +++ b/nixos/modules/services/databases/influxdb.nix @@ -5,43 +5,103 @@ with lib; let cfg = config.services.influxdb; - influxdbConfig = pkgs.writeText "config.toml" '' - bind-address = "${cfg.bindAddress}" + configOptions = recursiveUpdate { + meta = { + bind-address = ":8088"; + commit-timeout = "50ms"; + dir = "${cfg.dataDir}/meta"; + election-timeout = "1s"; + heartbeat-timeout = "1s"; + hostname = "localhost"; + leader-lease-timeout = "500ms"; + retention-autocreate = true; + }; + + data = { + dir = "${cfg.dataDir}/data"; + wal-dir = "${cfg.dataDir}/wal"; + max-wal-size = 104857600; + wal-enable-logging = true; + wal-flush-interval = "10m"; + wal-partition-flush-delay = "2s"; + }; + + cluster = { + shard-writer-timeout = "5s"; + write-timeout = "5s"; + }; - [logging] - level = "info" - file = "stdout" + retention = { + enabled = true; + check-interval = "30m"; + }; - [admin] - port = ${toString cfg.adminPort} - assets = "${pkgs.influxdb}/share/influxdb/admin" + http = { + enabled = true; + auth-enabled = false; + bind-address = ":8086"; + https-enabled = false; + log-enabled = true; + pprof-enabled = false; + write-tracing = false; + }; - [api] - port = ${toString cfg.apiPort} - ${cfg.apiExtraConfig} + monitor = { + store-enabled = false; + store-database = "_internal"; + store-interval = "10s"; + }; - [input_plugins] - ${cfg.inputPluginsConfig} + admin = { + enabled = true; + bind-address = ":8083"; + https-enabled = false; + }; - [raft] - dir = "${cfg.dataDir}/raft" - ${cfg.raftConfig} + graphite = [{ + enabled = false; + }]; - [storage] - dir = "${cfg.dataDir}/db" - ${cfg.storageConfig} + udp = [{ + enabled = false; + }]; - [cluster] - ${cfg.clusterConfig} + collectd = { + enabled = false; + typesdb = "${pkgs.collectd}/share/collectd/types.db"; + database = "collectd_db"; + port = 25826; + }; - [sharding] - ${cfg.shardingConfig} + opentsdb = { + enabled = false; + }; - [wal] - dir = "${cfg.dataDir}/wal" - ${cfg.walConfig} + continuous_queries = { + enabled = true; + log-enabled = true; + recompute-previous-n = 2; + recompute-no-older-than = "10m"; + compute-runs-per-interval = 10; + compute-no-more-than = "2m"; + }; - ${cfg.extraConfig} + hinted-handoff = { + enabled = true; + dir = "${cfg.dataDir}/hh"; + max-size = 1073741824; + max-age = "168h"; + retry-rate-limit = 0; + retry-interval = "1s"; + }; + } cfg.extraConfig; + + configFile = pkgs.runCommand "config.toml" { + buildInputs = [ pkgs.remarshal ]; + } '' + remarshal -if json -of toml \ + < ${pkgs.writeText "config.json" (builtins.toJSON configOptions)} \ + > $out ''; in { @@ -82,124 +142,10 @@ in type = types.path; }; - bindAddress = mkOption { - default = "127.0.0.1"; - description = "Address where influxdb listens"; - type = types.str; - }; - - adminPort = mkOption { - default = 8083; - description = "The port where influxdb admin listens"; - type = types.int; - }; - - apiPort = mkOption { - default = 8086; - description = "The port where influxdb api listens"; - type = types.int; - }; - - apiExtraConfig = mkOption { - default = '' - read-timeout = "5s" - ''; - description = "Extra influxdb api configuration"; - example = '' - ssl-port = 8084 - ssl-cert = /path/to/cert.pem - read-timeout = "5s" - ''; - type = types.lines; - }; - - inputPluginsConfig = mkOption { - default = ""; - description = "Configuration of influxdb extra plugins"; - example = '' - [input_plugins.graphite] - enabled = true - port = 2003 - database = "graphite" - ''; - }; - - raftConfig = mkOption { - default = '' - port = 8090 - ''; - description = "Influxdb raft configuration"; - type = types.lines; - }; - - storageConfig = mkOption { - default = '' - write-buffer-size = 10000 - ''; - description = "Influxdb raft configuration"; - type = types.lines; - }; - - clusterConfig = mkOption { - default = '' - protobuf_port = 8099 - protobuf_timeout = "2s" - protobuf_heartbeat = "200ms" - protobuf_min_backoff = "1s" - protobuf_max_backoff = "10s" - - write-buffer-size = 10000 - max-response-buffer-size = 100 - - concurrent-shard-query-limit = 10 - ''; - description = "Influxdb cluster configuration"; - type = types.lines; - }; - - leveldbConfig = mkOption { - default = '' - max-open-files = 40 - lru-cache-size = "200m" - max-open-shards = 0 - point-batch-size = 100 - write-batch-size = 5000000 - ''; - description = "Influxdb leveldb configuration"; - type = types.lines; - }; - - shardingConfig = mkOption { - default = '' - replication-factor = 1 - - [sharding.short-term] - duration = "7d" - split = 1 - - [sharding.long-term] - duration = "30d" - split = 1 - ''; - description = "Influxdb sharding configuration"; - type = types.lines; - }; - - walConfig = mkOption { - default = '' - flush-after = 1000 - bookmark-after = 1000 - index-after = 1000 - requests-per-logfile = 10000 - ''; - description = "Influxdb write-ahead log configuration"; - type = types.lines; - }; - extraConfig = mkOption { - default = ""; + default = {}; description = "Extra configuration options for influxdb"; - type = types.string; + type = types.attrs; }; }; @@ -215,7 +161,7 @@ in wantedBy = [ "multi-user.target" ]; after = [ "network-interfaces.target" ]; serviceConfig = { - ExecStart = ''${cfg.package}/bin/influxdb -config "${influxdbConfig}"''; + ExecStart = ''${cfg.package}/bin/influxd -config "${configFile}"''; User = "${cfg.user}"; Group = "${cfg.group}"; PermissionsStartOnly = true; @@ -224,11 +170,6 @@ in mkdir -m 0770 -p ${cfg.dataDir} if [ "$(id -u)" = 0 ]; then chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}; fi ''; - postStart = mkBefore '' - until ${pkgs.curl}/bin/curl -s -o /dev/null 'http://${cfg.bindAddress}:${toString cfg.apiPort}/'; do - sleep 1; - done - ''; }; users.extraUsers = optional (cfg.user == "influxdb") { |