From 08148eea8972ce1101d0782d54e1e9709daf2950 Mon Sep 17 00:00:00 2001 From: Guo-Rong Koh <5484552+gkoh@users.noreply.github.com> Date: Tue, 20 Aug 2024 08:52:23 +0000 Subject: [PATCH] Add VictoriaMetrics package, a time series database. Package multiple pieces of the Prometheus compatible VictoriaMetrics suite: - victoria-metrics - vmagent - vmbackup - vmrestore - vmctl Whilst here, correct a minor spelling error in functions.sh. --- build/victoriametrics/build.sh | 75 ++++++++ build/victoriametrics/files/README.install | 17 ++ .../victoria-metrics-profile-template.xml | 40 +++++ .../files/victoriametrics-template.xml | 162 ++++++++++++++++++ .../victoriametrics/files/vmagent-profile.xml | 36 ++++ build/victoriametrics/local.mog | 32 ++++ doc/baseline | 1 + doc/idlist.md | 2 + doc/packages.md | 1 + lib/functions.sh | 2 +- 10 files changed, 367 insertions(+), 1 deletion(-) create mode 100755 build/victoriametrics/build.sh create mode 100644 build/victoriametrics/files/README.install create mode 100644 build/victoriametrics/files/victoria-metrics-profile-template.xml create mode 100644 build/victoriametrics/files/victoriametrics-template.xml create mode 100644 build/victoriametrics/files/vmagent-profile.xml create mode 100644 build/victoriametrics/local.mog diff --git a/build/victoriametrics/build.sh b/build/victoriametrics/build.sh new file mode 100755 index 000000000..692fb51ca --- /dev/null +++ b/build/victoriametrics/build.sh @@ -0,0 +1,75 @@ +#!/usr/bin/bash +# +# {{{ CDDL HEADER +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# }}} + +# Copyright 2024 Guo-Rong Koh + +. ../../lib/build.sh + +PROG=victoriametrics +VER=1.102.2 +PKG=ooce/database/victoriametrics +SUMMARY="VictoriaMetrics" +DESC="Fast, cost-effective monitoring solution and time series database." + +DATA=var/${PREFIX#/}/$PROG + +set_arch 64 +set_gover + +XFORM_ARGS=" + -DPREFIX=${PREFIX#/} + -DPROG=$PROG + -DUSER=$PROG + -DGROUP=$PROG + -DDATA=$DATA + -DVERSION=$VER + -DVM=victoria-metrics + -DVMAGENT=vmagent +" + +build() { + pushd $TMPDIR/$BUILDDIR > /dev/null + + logmsg "Building $PROG" + export CGO_ENABLED=0 + export GOOS=illumos + + logcmd $MAKE victoria-metrics-pure \ + || logerr "Unable to build victoria-metrics-pure" + logcmd $MAKE vmutils-pure \ + || logerr "Unable to build vmutils-pure" + + popd >/dev/null +} + +# make it so +init +clone_go_source VictoriaMetrics VictoriaMetrics v$VER +prep_build +build +install_go bin/victoria-metrics-pure victoria-metrics +install_go bin/vmagent-pure vmagent +install_go bin/vmbackup-pure vmbackup +install_go bin/vmctl-pure vmctl +install_go bin/vmrestore-pure vmrestore +xform files/$PROG-template.xml > $TMPDIR/$PROG.xml +install_smf application $PROG.xml +xform files/victoria-metrics-profile-template.xml \ + > $TMPDIR/victoria-metrics-profile.xml +add_notes README.install +make_package +clean_up + +# Vim hints +# vim:ts=4:sw=4:et:fdm=marker diff --git a/build/victoriametrics/files/README.install b/build/victoriametrics/files/README.install new file mode 100644 index 000000000..c7e5dc208 --- /dev/null +++ b/build/victoriametrics/files/README.install @@ -0,0 +1,17 @@ +----------------------------------------- +VictoriaMetrics and vmagent Configuration +----------------------------------------- + +VictoriaMetrics and vmagent are not configured by configuration files. +Configuration is achieved via command-line arguments or equivalent environment variables. + +For SMF service integration, service profiles with appropriate environment variables can be used. +Example profiles are provided in `/share/victoriametrics`. + +These can edited and applied with: +``` +svcadm apply victoria-metrics-profile.xml +svcadm apply vmagent-profile.xml +``` + +vmagent _requires_ at least the envvar `VM_remoteWrite_url`, an example is provided that can be applied. diff --git a/build/victoriametrics/files/victoria-metrics-profile-template.xml b/build/victoriametrics/files/victoria-metrics-profile-template.xml new file mode 100644 index 000000000..387ef04a6 --- /dev/null +++ b/build/victoriametrics/files/victoria-metrics-profile-template.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/build/victoriametrics/files/victoriametrics-template.xml b/build/victoriametrics/files/victoriametrics-template.xml new file mode 100644 index 000000000..6cbbe21fb --- /dev/null +++ b/build/victoriametrics/files/victoriametrics-template.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/victoriametrics/files/vmagent-profile.xml b/build/victoriametrics/files/vmagent-profile.xml new file mode 100644 index 000000000..b831ed76f --- /dev/null +++ b/build/victoriametrics/files/vmagent-profile.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + diff --git a/build/victoriametrics/local.mog b/build/victoriametrics/local.mog new file mode 100644 index 000000000..e5f7bd197 --- /dev/null +++ b/build/victoriametrics/local.mog @@ -0,0 +1,32 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. + +# Copyright 2024 Guo-Rong Koh + +license LICENSE license=Apache2 + +dir path=$(DATA) owner=$(USER) group=$(GROUP) mode=0700 + +group groupname=$(GROUP) gid=93 +user ftpuser=false username=$(USER) uid=93 group=$(GROUP) \ + gcos-field="VictoriaMetrics user" \ + home-dir=/$(DATA) password=NP + +file ./tmp/victoria-metrics-profile.xml \ + path=$(PREFIX)/share/$(PROG)/victoria-metrics-profile.xml \ + owner=$(USER) group=$(GROUP) mode=0444 +file files/vmagent-profile.xml \ + path=$(PREFIX)/share/$(PROG)/vmagent-profile.xml \ + owner=$(USER) group=$(GROUP) mode=0444 + + \ + set restart_fmri svc:/application/$(PROG):victoria-metrics> + \ + set restart_fmri svc:/application/$(PROG):vmagent> diff --git a/doc/baseline b/doc/baseline index a5b51975c..060cb387e 100644 --- a/doc/baseline +++ b/doc/baseline @@ -63,6 +63,7 @@ extra.omnios ooce/database/postgresql-16/mysql_fdw extra.omnios ooce/database/postgresql-16/pg_repack extra.omnios ooce/database/postgresql-common extra.omnios ooce/database/rrdtool +extra.omnios ooce/database/victoriametrics extra.omnios ooce/developer/aarch64-gcc10 extra.omnios ooce/developer/aarch64-gnu-binutils extra.omnios ooce/developer/aarch64-linker diff --git a/doc/idlist.md b/doc/idlist.md index ed9994a0f..170c7dbb7 100644 --- a/doc/idlist.md +++ b/doc/idlist.md @@ -58,6 +58,7 @@ | extra | 90 | postgres | extra | 91 | subversion | omnios | 92 | sshd +| extra | 93 | victoriametrics | illumos | 95 | svctag | illumos | 96 | unknown | pkg5 | 97 | pkg5srv @@ -122,6 +123,7 @@ | extra | 90 | postgres | extra | 91 | subversion | omnios | 92 | sshd +| extra | 93 | victoriametrics | illumos | 95 | slocate | illumos | 96 | unknown | pkg5 | 97 | pkg5srv diff --git a/doc/packages.md b/doc/packages.md index 8eedac134..984c85f3f 100644 --- a/doc/packages.md +++ b/doc/packages.md @@ -47,6 +47,7 @@ | ooce/database/postgresql-XX/mysql_fdw | 2.9.1 | https://github.com/EnterpriseDB/mysql_fdw/releases | [omniosorg](https://github.com/omniosorg) | ooce/database/postgresql-XX/pg_repack | 1.5.0 | https://github.com/reorg/pg_repack/tags | [omniosorg](https://github.com/omniosorg) | ooce/database/rrdtool | 1.9.0 | https://github.com/oetiker/rrdtool-1.x/releases | [omniosorg](https://github.com/omniosorg) +| ooce/database/victoriametrics | 1.102.2 | https://github.com/VictoriaMetrics/VictoriaMetrics | [gkoh](https://github.com/gkoh) | ooce/developer/autoconf-archive | 2023.02.20 | https://ftp.gnu.org/gnu/autoconf-archive/ | [omniosorg](https://github.com/omniosorg) | ooce/developer/autogen | 5.18.16 | https://ftp.gnu.org/gnu/autogen/ | [omniosorg](https://github.com/omniosorg) | ooce/developer/bazel | 6.3.2 | https://github.com/bazelbuild/bazel/releases | [omniosorg](https://github.com/omniosorg) diff --git a/lib/functions.sh b/lib/functions.sh index 7e34872c4..c6385169a 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -219,7 +219,7 @@ logerr() { # Print an error message and ask the user if they wish to continue logmsg -e "$@" >> /dev/stderr if [ -z "$BATCH" ]; then - ask_to_continue "An Error occured in the build. " + ask_to_continue "An Error occurred in the build. " else exit 1 fi