mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 13:15:30 +03:00
VictoriaMetrics: init at v1.32.5, add module, tests (#78038)
VictoriaMetrics: init at v1.32.5, add module, tests
This commit is contained in:
commit
32718c9992
6 changed files with 126 additions and 0 deletions
|
@ -281,6 +281,7 @@
|
||||||
./services/databases/riak.nix
|
./services/databases/riak.nix
|
||||||
./services/databases/riak-cs.nix
|
./services/databases/riak-cs.nix
|
||||||
./services/databases/stanchion.nix
|
./services/databases/stanchion.nix
|
||||||
|
./services/databases/victoriametrics.nix
|
||||||
./services/databases/virtuoso.nix
|
./services/databases/virtuoso.nix
|
||||||
./services/desktops/accountsservice.nix
|
./services/desktops/accountsservice.nix
|
||||||
./services/desktops/bamf.nix
|
./services/desktops/bamf.nix
|
||||||
|
|
70
nixos/modules/services/databases/victoriametrics.nix
Normal file
70
nixos/modules/services/databases/victoriametrics.nix
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
let cfg = config.services.victoriametrics; in
|
||||||
|
{
|
||||||
|
options.services.victoriametrics = with lib; {
|
||||||
|
enable = mkEnableOption "victoriametrics";
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.victoriametrics;
|
||||||
|
defaultText = "pkgs.victoriametrics";
|
||||||
|
description = ''
|
||||||
|
The VictoriaMetrics distribution to use.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
listenAddress = mkOption {
|
||||||
|
default = ":8428";
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
The listen address for the http interface.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
retentionPeriod = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 1;
|
||||||
|
description = ''
|
||||||
|
Retention period in months.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
extraOptions = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
Extra options to pass to VictoriaMetrics. See the README: <link
|
||||||
|
xlink:href="https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/README.md" />
|
||||||
|
or <command>victoriametrics -help</command> for more
|
||||||
|
information.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.victoriametrics = {
|
||||||
|
description = "VictoriaMetrics time series database";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 1;
|
||||||
|
StartLimitBurst = 5;
|
||||||
|
StateDirectory = "victoriametrics";
|
||||||
|
DynamicUser = true;
|
||||||
|
ExecStart = ''
|
||||||
|
${cfg.package}/bin/victoria-metrics \
|
||||||
|
-storageDataPath=/var/lib/victoriametrics \
|
||||||
|
-httpListenAddr ${cfg.listenAddress}
|
||||||
|
-retentionPeriod ${toString cfg.retentionPeriod}
|
||||||
|
${lib.escapeShellArgs cfg.extraOptions}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
postStart =
|
||||||
|
let
|
||||||
|
bindAddr = (lib.optionalString (lib.hasPrefix ":" cfg.listenAddress) "127.0.0.1") + cfg.listenAddress;
|
||||||
|
in
|
||||||
|
lib.mkBefore ''
|
||||||
|
until ${lib.getBin pkgs.curl}/bin/curl -s -o /dev/null http://${bindAddr}/ping; do
|
||||||
|
sleep 1;
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -293,6 +293,7 @@ in
|
||||||
upnp = handleTest ./upnp.nix {};
|
upnp = handleTest ./upnp.nix {};
|
||||||
uwsgi = handleTest ./uwsgi.nix {};
|
uwsgi = handleTest ./uwsgi.nix {};
|
||||||
vault = handleTest ./vault.nix {};
|
vault = handleTest ./vault.nix {};
|
||||||
|
victoriametrics = handleTest ./victoriametrics.nix {};
|
||||||
virtualbox = handleTestOn ["x86_64-linux"] ./virtualbox.nix {};
|
virtualbox = handleTestOn ["x86_64-linux"] ./virtualbox.nix {};
|
||||||
wireguard = handleTest ./wireguard {};
|
wireguard = handleTest ./wireguard {};
|
||||||
wireguard-generated = handleTest ./wireguard/generated.nix {};
|
wireguard-generated = handleTest ./wireguard/generated.nix {};
|
||||||
|
|
31
nixos/tests/victoriametrics.nix
Normal file
31
nixos/tests/victoriametrics.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# This test runs influxdb and checks if influxdb is up and running
|
||||||
|
|
||||||
|
import ./make-test-python.nix ({ pkgs, ...} : {
|
||||||
|
name = "victoriametrics";
|
||||||
|
meta = with pkgs.stdenv.lib.maintainers; {
|
||||||
|
maintainers = [ yorickvp ];
|
||||||
|
};
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
one = { ... }: {
|
||||||
|
services.victoriametrics.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
start_all()
|
||||||
|
|
||||||
|
one.wait_for_unit("victoriametrics.service")
|
||||||
|
|
||||||
|
# write some points and run simple query
|
||||||
|
out = one.succeed(
|
||||||
|
"curl -d 'measurement,tag1=value1,tag2=value2 field1=123,field2=1.23' -X POST 'http://localhost:8428/write'"
|
||||||
|
)
|
||||||
|
cmd = """curl -s -G 'http://localhost:8428/api/v1/export' -d 'match={__name__!=""}'"""
|
||||||
|
# data takes a while to appear
|
||||||
|
one.wait_until_succeeds(f"[[ $({cmd} | wc -l) -ne 0 ]]")
|
||||||
|
out = one.succeed(cmd)
|
||||||
|
assert '"values":[123]' in out
|
||||||
|
assert '"values":[1.23]' in out
|
||||||
|
'';
|
||||||
|
})
|
21
pkgs/servers/nosql/victoriametrics/default.nix
Normal file
21
pkgs/servers/nosql/victoriametrics/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ lib, buildGoModule, fetchFromGitHub }:
|
||||||
|
|
||||||
|
buildGoModule rec {
|
||||||
|
pname = "VictoriaMetrics";
|
||||||
|
version = "1.32.5";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = pname;
|
||||||
|
repo = pname;
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "1i3l8bkii3x8wnq9a8yn48cchni5h0gy3rrpvg0jgm4kmm5dlq4y";
|
||||||
|
};
|
||||||
|
|
||||||
|
modSha256 = "0696p1hv5z3dvawizvw0yi4xzl41bsmszkdqayzb37nm5cfk8riq";
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = "https://victoriametrics.com/";
|
||||||
|
description = "fast, cost-effective and scalable time series database, long-term remote storage for Prometheus";
|
||||||
|
license = licenses.asl20;
|
||||||
|
maintainers = [ maintainers.yorickvp ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -15886,6 +15886,8 @@ in
|
||||||
unifiStable;
|
unifiStable;
|
||||||
unifi = unifiStable;
|
unifi = unifiStable;
|
||||||
|
|
||||||
|
victoriametrics = callPackage ../servers/nosql/victoriametrics { };
|
||||||
|
|
||||||
virtlyst = libsForQt5.callPackage ../servers/web-apps/virtlyst { };
|
virtlyst = libsForQt5.callPackage ../servers/web-apps/virtlyst { };
|
||||||
|
|
||||||
virtuoso6 = callPackage ../servers/sql/virtuoso/6.x.nix {
|
virtuoso6 = callPackage ../servers/sql/virtuoso/6.x.nix {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue