diff --git a/.deploy b/.deploy new file mode 100755 index 00000000..64a62fd5 --- /dev/null +++ b/.deploy @@ -0,0 +1,3 @@ +#!/bin/sh +gem install package_cloud +package_cloud push FreifunkBremen/yanic/debian/jessie $GOPATH/src/github.com/FreifunkBremen/yanic/build/*/yanic*.deb diff --git a/.gitignore b/.gitignore index d7fdc539..1824fe62 100644 --- a/.gitignore +++ b/.gitignore @@ -22,5 +22,8 @@ _testmain.go *.exe *.test *.prof + +/build +/profile.cov webroot /config.toml diff --git a/.goxc.json b/.goxc.json new file mode 100644 index 00000000..62a5f8d3 --- /dev/null +++ b/.goxc.json @@ -0,0 +1,20 @@ +{ + "AppName": "yanic", + "ArtifactsDest": "./build", + "TasksExclude": [ + "validate" + ], + "BuildConstraints": "linux", + "TaskSettings": { + "deb": { + "metadata": { + "description": "Yet another node info collector", + "maintainer": "FreifunkBremen \u003cgeno+ffhb@fireorbit.de\u003e" + }, + "other-mapped-files": { + "/": "contrib/packages/debian" + } + } + }, + "ConfigVersion": "0.9" +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 3c3818a3..9c4a3d21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,20 @@ language: go go: - - 1.8.x - - master + - tip install: - - go get -t github.com/FreifunkBremen/yanic/... - - go get github.com/mattn/goveralls - - go get golang.org/x/tools/cmd/cover +- go get -t github.com/FreifunkBremen/yanic/... +- go get github.com/mattn/goveralls +- go get golang.org/x/tools/cmd/cover script: - - ./.test-coverage - - go install github.com/FreifunkBremen/yanic/cmd/yanic - - go install github.com/FreifunkBremen/yanic/cmd/yanic-query +- "./.test-coverage" +- go install github.com/FreifunkBremen/yanic/cmd/yanic +- go install github.com/FreifunkBremen/yanic/cmd/yanic-query +before_deploy: +- go get github.com/laher/goxc +- goxc -pv=$(date +%Y%m%d) +deploy: + provider: script + script: "./.deploy" + skip_cleanup: true + on: + branch: package diff --git a/config_example.toml b/config_example.toml index eb31c9a2..55a3f876 100644 --- a/config_example.toml +++ b/config_example.toml @@ -23,7 +23,7 @@ webroot = "/var/www/html/meshviewer" enable = true # state-version of nodes.json to store cached data, # these is the directly collected respondd data -state_path = "/var/lib/collector/state.json" +state_path = "/var/lib/yanic/state.json" # Export nodes and graph periodically save_interval = "5s" diff --git a/contrib/packages/archlinux/.gitignore b/contrib/packages/archlinux/.gitignore new file mode 100644 index 00000000..bbd571a4 --- /dev/null +++ b/contrib/packages/archlinux/.gitignore @@ -0,0 +1,3 @@ +pkg/ +src/ +yanic*.pkg.tar diff --git a/contrib/packages/archlinux/PKGBUILD b/contrib/packages/archlinux/PKGBUILD new file mode 100644 index 00000000..8411816d --- /dev/null +++ b/contrib/packages/archlinux/PKGBUILD @@ -0,0 +1,37 @@ +# $Id$ +# Maintainer Geno + +pkgname=yanic +pkgver=0.1 +pkgrel=1 +pkgdesc='Yet an nother node info collector' +url='https://github.com/FreifunkBremen/yanic' +arch=('x86_64' 'i686') +makedepends=('git' 'go') +backup=("etc/yanic.conf") +source=("yanic.conf" + "yanic.service") +md5sums=('SKIP' + 'SKIP') + +install='yanic.install' + +prepare () { + msg2 "patch config to default http" + sed -e 's/\/var\/www\/html\//\/srv\/http\//g' yanic.conf > yanic-tmp.conf + sed -e 's/\/opt\/go\/bin/\/usr\/bin/g' yanic.service > yanic-tmp.service +} + +build() { + msg2 "GOPATH setup" + export GOPATH="$srcdir/gopath" + export PATH+=":$GOPATH/bin" + go get -v -u github.com/FreifunkBremen/yanic/cmd/... +} + +package() { + install -Dm644 yanic-tmp.conf "$pkgdir/etc/yanic.conf" + install -Dm644 yanic-tmp.service "$pkgdir/usr/lib/systemd/system/yanic.service" + install -Dsm755 "$GOPATH/bin/yanic" "$pkgdir/usr/bin/yanic" + install -Dsm755 "$GOPATH/bin/yanic-query" "$pkgdir/usr/bin/yanic-query" +} diff --git a/contrib/packages/archlinux/yanic.conf b/contrib/packages/archlinux/yanic.conf new file mode 120000 index 00000000..15d13c1c --- /dev/null +++ b/contrib/packages/archlinux/yanic.conf @@ -0,0 +1 @@ +../../../config_example.toml \ No newline at end of file diff --git a/contrib/packages/archlinux/yanic.install b/contrib/packages/archlinux/yanic.install new file mode 100644 index 00000000..9b8d14fd --- /dev/null +++ b/contrib/packages/archlinux/yanic.install @@ -0,0 +1,13 @@ +post_install() { + getent group yanic >/dev/null || groupadd yanic + getent passwd yanic >/dev/null || useradd -d /var/lib/yanic -g yanic -r -M -s /bin/false yanic + + mkdir -p /srv/http/meshviewer/data /var/lib/yanic + chown yanic:yanic /var/lib/yanic /etc/yanic.conf + chown yanic:http /srv/http/meshviewer/data + chown http:http /srv/http/meshviewer +} + +post_upgrade() { + systemctl daemon-reload +} diff --git a/contrib/packages/archlinux/yanic.service b/contrib/packages/archlinux/yanic.service new file mode 120000 index 00000000..0a95c223 --- /dev/null +++ b/contrib/packages/archlinux/yanic.service @@ -0,0 +1 @@ +../../init/linux-systemd/yanic.service \ No newline at end of file diff --git a/contrib/packages/debian/etc/yanic.conf b/contrib/packages/debian/etc/yanic.conf new file mode 120000 index 00000000..21baf885 --- /dev/null +++ b/contrib/packages/debian/etc/yanic.conf @@ -0,0 +1 @@ +../../../../config_example.toml \ No newline at end of file diff --git a/contrib/packages/debian/lib/systemd/system/yanic.service b/contrib/packages/debian/lib/systemd/system/yanic.service new file mode 100644 index 00000000..3853f277 --- /dev/null +++ b/contrib/packages/debian/lib/systemd/system/yanic.service @@ -0,0 +1,11 @@ +[Unit] +Description=yanic + +[Service] +Type=simple +ExecStart=/usr/bin/yanic -config /etc/yanic.conf +Restart=always +Environment=PATH=/usr/bin:/usr/local/bin + +[Install] +WantedBy=multi-user.target diff --git a/contrib/packages/debian/var/lib/yanic/state.empty b/contrib/packages/debian/var/lib/yanic/state.empty new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/contrib/packages/debian/var/lib/yanic/state.empty @@ -0,0 +1 @@ +{} diff --git a/contrib/packages/debian/var/www/html/meshviewer/data/index.html b/contrib/packages/debian/var/www/html/meshviewer/data/index.html new file mode 100644 index 00000000..05bed6e8 --- /dev/null +++ b/contrib/packages/debian/var/www/html/meshviewer/data/index.html @@ -0,0 +1,5 @@ +

Yanic - Meshviewer output

+