aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nomad
diff options
context:
space:
mode:
authorMatthias Neugebauer <mtneug@mailbox.org>2019-09-17 12:29:23 +0200
committerRasmus Thomsen <oss@cogitri.dev>2019-10-06 13:00:22 +0200
commit9cf030c0125db320ba4f344a189ab55dd9cd1100 (patch)
tree3a354091f0cf319a412159dec8521a323bc82fd7 /testing/nomad
parent966c30eff15a2885de24ff11ed297fcb1a24a02a (diff)
downloadaports-9cf030c0125db320ba4f344a189ab55dd9cd1100.tar.bz2
aports-9cf030c0125db320ba4f344a189ab55dd9cd1100.tar.xz
testing/nomad: new aport
An easy-to-use, flexible, and performant workload orchestrator https://www.nomadproject.io/
Diffstat (limited to 'testing/nomad')
-rw-r--r--testing/nomad/APKBUILD54
-rw-r--r--testing/nomad/nomad.confd1
-rw-r--r--testing/nomad/nomad.initd38
-rw-r--r--testing/nomad/nvidia-driver.patch21
-rw-r--r--testing/nomad/server.hcl12
-rw-r--r--testing/nomad/static-assets.patch15
6 files changed, 141 insertions, 0 deletions
diff --git a/testing/nomad/APKBUILD b/testing/nomad/APKBUILD
new file mode 100644
index 0000000000..932ecbb31f
--- /dev/null
+++ b/testing/nomad/APKBUILD
@@ -0,0 +1,54 @@
+# Contributor: Matthias Neugebauer <mtneug@mailbox.org>
+# Maintainer: Matthias Neugebauer <mtneug@mailbox.org>
+pkgname=nomad
+pkgver=0.9.5
+pkgrel=0
+pkgdesc="An easy-to-use, flexible, and performant workload orchestrator"
+url="https://www.nomadproject.io/"
+arch="all"
+license="MPL-2.0"
+depends="cni-plugins"
+makedepends="linux-headers bash make go python2 yarn npm go-bindata-assetfs"
+subpackages="$pkgname-openrc"
+options="!check" # cannot produce environment for testing in CI
+source="$pkgname-$pkgver.tar.gz::https://github.com/hashicorp/$pkgname/archive/v$pkgver.tar.gz
+ nomad.initd
+ nomad.confd
+ nvidia-driver.patch
+ server.hcl
+ static-assets.patch"
+builddir="$srcdir/src/github.com/hashicorp/$pkgname"
+
+prepare() {
+ mkdir -p "$srcdir/src/github.com/hashicorp"
+ mv "$srcdir"/$pkgname-$pkgver "$builddir"/
+ default_prepare
+}
+
+build() {
+ make ember-dist
+ GOPATH="$srcdir" CGO_ENABLED=1 GO_TAGS="ui release" make static-assets
+ GOPATH="$srcdir" CGO_ENABLED=1 go build -v -o bin/$pkgname \
+ -ldflags "-X github.com/hashicorp/nomad/version.GitCommit='$pkgver'" \
+ -tags "ui release"
+}
+
+check() {
+ GOPATH="$srcdir" CGO_ENABLED=1 go test -timeout=15m "./..."
+}
+
+package() {
+ install -m755 -D "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname"
+ install -m644 -D "$srcdir/$pkgname.confd" "$pkgdir/etc/conf.d/$pkgname"
+
+ install -m750 -o root -g root -D bin/$pkgname "$pkgdir/usr/sbin/$pkgname"
+ install -m640 -o root -g root -D "$srcdir/server.hcl" "$pkgdir/etc/nomad.d/server.hcl"
+ install -m750 -o root -g root -d "$pkgdir/var/lib/$pkgname"
+}
+
+sha512sums="97d3539c0446a7b89ebc6fea4270a93ed3588e0632162e653b11a38fff1754eb25e0f9ee9618f639fd633d66f1eb72c66e7b114713c5f4922462c0524f51508a nomad-0.9.5.tar.gz
+ac969c81150ba57871c1f75f17c11d06ffc7bcc872882416c7c0d9d43f5e352ca1b7e7bfd75e32a9d01a826496c77a657dc298f5e048f85b4d9e85bc3afee51d nomad.initd
+a4fcc9f319926e8e5257dcc902cf3e1cbacd8bee82097b7a9719611d52037431a7e953a4b0fa90fc25475d2590cd14877c8e4c87bd909dd0099a754ba6f5063c nomad.confd
+e9c0161c2a9c0e1933c266520a410764a709c7b4f65b1a81c1fb2494eae89daa847ffca5df46d6eea61d855f35d21e66433ec0afe8c08017187c917e952b8544 nvidia-driver.patch
+c2ba7db5bb0858547bf346819945d24626ac761541f38350b40408e1b26227549f6aa4d6946baadbf856329c0ac9f81f84164597d11361224b62a1697f17e726 server.hcl
+3810c6e0d3e5c202567ac95d04e363b4f28bf39e37a746c5c50b38c18bec3b6256d25f9e0a7fcbe7b7b12dbb007cdefe029a8b74fe8190d019c717d77a9a77fd static-assets.patch"
diff --git a/testing/nomad/nomad.confd b/testing/nomad/nomad.confd
new file mode 100644
index 0000000000..3161e31c3c
--- /dev/null
+++ b/testing/nomad/nomad.confd
@@ -0,0 +1 @@
+nomad_opts="agent -server -config=/etc/nomad.d"
diff --git a/testing/nomad/nomad.initd b/testing/nomad/nomad.initd
new file mode 100644
index 0000000000..05949fd87a
--- /dev/null
+++ b/testing/nomad/nomad.initd
@@ -0,0 +1,38 @@
+#!/sbin/openrc-run
+name="Nomad"
+description="An easy-to-use, flexible, and performant workload orchestrator"
+description_healthcheck="Check health status"
+description_reload="Reload configuration"
+
+extra_started_commands="healthcheck reload"
+
+command="/usr/sbin/${RC_SVCNAME}"
+command_args="${nomad_opts}"
+command_user="root:root"
+
+supervisor=supervise-daemon
+output_log="/var/log/${RC_SVCNAME}.log"
+error_log="/var/log/${RC_SVCNAME}.log"
+respawn_max=0
+respawn_delay=10
+healthcheck_timer=60
+
+depend() {
+ need net
+ after firewall
+}
+
+start_pre() {
+ checkpath -f -m 0644 -o "$command_user" "$output_log" "$error_log"
+}
+
+healthcheck() {
+ $command agent-info > /dev/null 2>&1
+}
+
+reload() {
+ start_pre \
+ && ebegin "Reloading $RC_SVCNAME configuration" \
+ && $supervisor "$RC_SVCNAME" --signal HUP
+ eend $?
+}
diff --git a/testing/nomad/nvidia-driver.patch b/testing/nomad/nvidia-driver.patch
new file mode 100644
index 0000000000..6ce01343fe
--- /dev/null
+++ b/testing/nomad/nvidia-driver.patch
@@ -0,0 +1,21 @@
+Disable the Nvidia GPU device plugin as this requires NVIDIA drivers.
+diff --git a/devices/gpu/nvidia/nvml/driver_default.go b/devices/gpu/nvidia/nvml/driver_default.go
+index e67efa22e..215ccfc53 100644
+--- a/devices/gpu/nvidia/nvml/driver_default.go
++++ b/devices/gpu/nvidia/nvml/driver_default.go
+@@ -1,5 +1,3 @@
+-// +build !linux
+-
+ package nvml
+
+ // Initialize nvml library by locating nvml shared object file and calling ldopen
+diff --git a/devices/gpu/nvidia/nvml/driver_linux.go b/devices/gpu/nvidia/nvml/driver_linux.go
+index bdd777561..ad68efa32 100644
+--- a/devices/gpu/nvidia/nvml/driver_linux.go
++++ b/devices/gpu/nvidia/nvml/driver_linux.go
+@@ -1,3 +1,5 @@
++// +build !linux
++
+ package nvml
+
+ import (
diff --git a/testing/nomad/server.hcl b/testing/nomad/server.hcl
new file mode 100644
index 0000000000..61602fb036
--- /dev/null
+++ b/testing/nomad/server.hcl
@@ -0,0 +1,12 @@
+data_dir = "/var/lib/nomad"
+disable_update_check = true
+enable_syslog = true
+
+server {
+ enabled = true
+ bootstrap_expect = 1
+}
+
+client {
+ enabled = true
+}
diff --git a/testing/nomad/static-assets.patch b/testing/nomad/static-assets.patch
new file mode 100644
index 0000000000..8068ece4ee
--- /dev/null
+++ b/testing/nomad/static-assets.patch
@@ -0,0 +1,15 @@
+This patch removes the custom output name option that is handled properly only
+in the master branch of go-bindata-assetfs (see https://github.com/elazarl/go-bindata-assetfs/pull/32)
+diff --git a/GNUmakefile b/GNUmakefile
+index 2168ed8de..76bb2c3cd 100644
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -317,7 +317,7 @@ testcluster: ## Bring up a Linux test cluster using Vagrant. Set PROVIDER if nec
+ .PHONY: static-assets
+ static-assets: ## Compile the static routes to serve alongside the API
+ @echo "--> Generating static assets"
+- @go-bindata-assetfs -pkg agent -prefix ui -modtime 1480000000 -tags ui -o bindata_assetfs.go ./ui/dist/...
++ @go-bindata-assetfs -pkg agent -prefix ui -modtime 1480000000 -tags ui ./ui/dist/...
+ @mv bindata_assetfs.go command/agent
+
+ .PHONY: test-website