From 9c1943fb6fc9cd82cf121d06a6d16e945929ea56 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Mon, 16 Nov 2015 12:59:30 +0100 Subject: influxdb: 0.8.3 -> 0.9.4, fix module --- nixos/modules/services/databases/influxdb.nix | 239 ++++++++++---------------- pkgs/development/tools/remarshal/default.nix | 24 +++ pkgs/servers/nosql/influxdb/default.nix | 52 +++--- pkgs/top-level/all-packages.nix | 8 +- pkgs/top-level/go-packages.nix | 18 -- 5 files changed, 140 insertions(+), 201 deletions(-) create mode 100644 pkgs/development/tools/remarshal/default.nix diff --git a/nixos/modules/services/databases/influxdb.nix b/nixos/modules/services/databases/influxdb.nix index 08963f7aab7f..8d63f14c67b5 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") { diff --git a/pkgs/development/tools/remarshal/default.nix b/pkgs/development/tools/remarshal/default.nix new file mode 100644 index 000000000000..91aedac1748f --- /dev/null +++ b/pkgs/development/tools/remarshal/default.nix @@ -0,0 +1,24 @@ +{ lib, goPackages, fetchFromGitHub }: + +goPackages.buildGoPackage rec { + name = "remarshal-${rev}"; + rev = "0.3.0"; + goPackagePath = "github.com/dbohdan/remarshal"; + + src = fetchFromGitHub { + rev = "v${rev}"; + owner = "dbohdan"; + repo = "remarshal"; + sha256 = "0lhsqca3lq3xvdwsmrngv4p6b7k2lkbfnxnk5qj6jdd5y7f4b496"; + }; + + buildInputs = with goPackages; [ toml yaml-v2 ]; + + meta = with lib; { + description = "Convert between TOML, YAML and JSON"; + license = licenses.mit; + homepage = https://github.com/dbohdan/remarshal; + maintainers = with maintainers; [ offline ]; + platforms = with platforms; linux; + }; +} diff --git a/pkgs/servers/nosql/influxdb/default.nix b/pkgs/servers/nosql/influxdb/default.nix index 92b1b73d0a0f..d3843b0b2523 100644 --- a/pkgs/servers/nosql/influxdb/default.nix +++ b/pkgs/servers/nosql/influxdb/default.nix @@ -1,37 +1,29 @@ -{ stdenv, fetchurl, makeWrapper, zlib, bzip2 }: - -assert stdenv.isLinux; - -stdenv.mkDerivation rec { - name = "influxdb-${version}"; - version = "0.8.3"; - arch = if stdenv.system == "x86_64-linux" then "amd64" else "386"; - - src = fetchurl { - url = "http://s3.amazonaws.com/influxdb/${name}.${arch}.tar.gz"; - sha256 = if arch == "amd64" then - "e625902d403434c799f9d9ffc2592a3880f82d435423fde7174e5e4fe0f41148" else - "5abe9f432553e66c8aff86c4311eba16b874678d04b52bfe9e2019c01059ec78"; +{ lib, goPackages, fetchFromGitHub }: + +goPackages.buildGoPackage rec { + name = "influxdb-${rev}"; + rev = "v0.9.4"; + goPackagePath = "github.com/influxdb/influxdb"; + + src = fetchFromGitHub { + inherit rev; + owner = "influxdb"; + repo = "influxdb"; + sha256 = "0yarymppnlpf2xab57i8jx595v47s5mdwnf13719mc1fv3q84yqn"; }; - buildInputs = [ makeWrapper ]; + excludedPackages = "test"; - installPhase = '' - install -D influxdb $out/bin/influxdb - patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/influxdb - wrapProgram "$out/bin/influxdb" \ - --prefix LD_LIBRARY_PATH : "${stdenv.cc.cc}/lib:${stdenv.cc.cc}/lib64:${zlib}/lib:${bzip2}/lib" + propagatedBuildInputs = with goPackages; [ + raft raft-boltdb snappy crypto gogo.protobuf pool pat toml + gollectd statik liner + ]; - mkdir -p $out/share/influxdb - cp -R admin scripts config.toml $out/share/influxdb - ''; - - meta = with stdenv.lib; { - description = "Scalable datastore for metrics, events, and real-time analytics"; - homepage = http://influxdb.com/; + meta = with lib; { + description = "An open-source distributed time series database"; license = licenses.mit; - - maintainers = [ maintainers.offline ]; - platforms = ["i686-linux" "x86_64-linux"]; + homepage = https://influxdb.com/; + maintainers = with maintainers; [ offline ]; + platforms = with platforms; linux; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 66382269ebaa..85d4f42bc54f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2774,6 +2774,8 @@ let pytrainer = callPackage ../applications/misc/pytrainer { }; + remarshal = (callPackage ../development/tools/remarshal { }).bin // { outputs = [ "bin" ]; }; + openmpi = callPackage ../development/libraries/openmpi { }; openmodelica = callPackage ../applications/science/misc/openmodelica { }; @@ -9291,9 +9293,7 @@ let riak = callPackage ../servers/nosql/riak/1.3.1.nix { }; riak2 = callPackage ../servers/nosql/riak/2.1.1.nix { }; - influxdb = callPackage ../servers/nosql/influxdb { }; - - influxdb-backup = goPackages.influxdb-backup.bin // { outputs = [ "bin" ]; }; + influxdb = (callPackage ../servers/nosql/influxdb { }).bin // { outputs = [ "bin" ]; }; hyperdex = callPackage ../servers/nosql/hyperdex { }; @@ -9378,7 +9378,7 @@ let pyMAILt = builderDefsPackage (callPackage ../servers/xmpp/pyMAILt) {}; - qpid-cpp = callPackage ../servers/amqp/qpid-cpp { + qpid-cpp = callPackage ../servers/amqp/qpid-cpp { boost = boost155; }; diff --git a/pkgs/top-level/go-packages.nix b/pkgs/top-level/go-packages.nix index 700a07cb73bb..fb1ebb79a3a7 100644 --- a/pkgs/top-level/go-packages.nix +++ b/pkgs/top-level/go-packages.nix @@ -1639,15 +1639,6 @@ let goPackageAliases = [ "github.com/go-inf/inf" ]; }; - influxdb = buildFromGitHub { - rev = "v0.9.3"; - owner = "influxdb"; - repo = "influxdb"; - sha256 = "0hsvm8ls1g12j1d5ap396vqfpvd0g72hymhczdqg6z96h3zi90bx"; - propagatedBuildInputs = [ raft raft-boltdb snappy crypto gogo.protobuf pool pat toml gollectd statik liner ]; - excludedPackages = "test"; - }; - influxdb8-client = buildFromGitHub{ rev = "v0.8.8"; owner = "influxdb"; @@ -1656,15 +1647,6 @@ let subPackages = [ "client" ]; }; - influxdb-backup = buildFromGitHub { - rev = "4556edbffa914a8c17fa1fa1564962a33c6c7596"; - date = "2014-07-28"; - owner = "eckardt"; - repo = "influxdb-backup"; - sha256 = "2928063e6dfe4be7b69c8e72e4d6a5fc557f0c75e9625fadf607d59b8e80e34b"; - buildInputs = [ eckardt.influxdb-go ]; - }; - eckardt.influxdb-go = buildGoPackage rec { rev = "8b71952efc257237e077c5d0672e936713bad38f"; name = "influxdb-go-${stdenv.lib.strings.substring 0 7 rev}"; -- cgit 1.4.1