summaryrefslogtreecommitdiff
path: root/community/victoria-metrics/APKBUILD
blob: b679811816ece4c917286dca7175c44b93836441 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Contributor: Konstantin Kulikov <k.kulikov2@gmail.com>
# Maintainer: Konstantin Kulikov <k.kulikov2@gmail.com>
pkgname=victoria-metrics
pkgver=1.103.0
pkgrel=0
provides="victoriametrics=$pkgver-r$pkgrel"
pkgdesc="Fast, cost-effective and scalable time series database"
url="https://github.com/VictoriaMetrics/VictoriaMetrics"
# Test failures on other archs, FP precision mostly.
arch="x86_64 aarch64"
license="Apache-2.0"
makedepends="go"
subpackages="$pkgname-openrc $pkgname-tools:_tools $pkgname-backup-tools:_backup_tools"
install="$pkgname.pre-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/VictoriaMetrics/VictoriaMetrics/archive/v$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	"
builddir="$srcdir/VictoriaMetrics-$pkgver"

# Depends on cgo zstd package that ships prebuilt object files built against glibc.
# It is possible to rebuild it against musl, but
# pure go zstd lib works well enough and is not written in C.
export CGO_ENABLED=0

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	local ldflags="-X github.com/VictoriaMetrics/VictoriaMetrics/lib/buildinfo.Version=v$pkgver-r$pkgrel"
	local bin
	for bin in victoria-metrics vmagent vmalert vmauth vmctl vmrestore vmbackup; do
		go build -ldflags="$ldflags" -o bin/$bin ./app/$bin &
	done
	wait
}

check() {
	# TestStorageAddRowsConcurrent takes 140sec on x86_64 and times out.
	# TestConfigReload flakes in CI a lot.
	go test -short -parallel 4 -skip '^TestStorageAddRowsConcurrent$|^TestConfigReload$' ./...
}

package() {
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname

	cd bin
	install -Dm755 -t "$pkgdir"/usr/bin \
		victoria-metrics \
		vmagent \
		vmalert \
		vmauth \
		vmbackup \
		vmctl \
		vmrestore
}

_tools() {
	pkgdesc="$pkgdesc (vmagent, vmalert, vmauth, vmctl)"
	amove \
		usr/bin/vmagent \
		usr/bin/vmalert \
		usr/bin/vmauth \
		usr/bin/vmctl
}

_backup_tools() {
	pkgdesc="$pkgdesc (vmbackup, vmrestore)"
	amove \
		usr/bin/vmbackup \
		usr/bin/vmrestore
}

sha512sums="
4c603f033a7f01a1574683b1c8dd430a0ece81b6846041b2dd9c56d831edfe3bc50a8bd434c1a47ba5f4e238ec8cb26fb921ccf6c2d2f6d4e5ce541831d22dc3  victoria-metrics-1.103.0.tar.gz
d727de5653e0ed9c7d7448dce6ab3766683d14e8d946935929691709c8b077572d5eb73c26749593cd7995820d370d46851be487fc03b663e495129c6a9e0244  victoria-metrics.initd
85bd8696eb701ad4a23063334a688a9915846558e3a57b0dbdf59c36c38cf435edcfdf66f8cb18611820b944ab529dedc0817b1f565050eeea2aec25ebda52ce  victoria-metrics.confd
"