Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Build OS packages #53

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .deploy
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ _testmain.go
*.exe
*.test
*.prof

/build
/profile.cov
webroot
/config.toml
20 changes: 20 additions & 0 deletions .goxc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"AppName": "yanic",
"ArtifactsDest": "./build",
"TasksExclude": [
"validate"
],
"BuildConstraints": "linux",
"TaskSettings": {
"deb": {
"metadata": {
"description": "Yet another node info collector",
"maintainer": "FreifunkBremen \[email protected]\u003e"
},
"other-mapped-files": {
"/": "contrib/packages/debian"
}
}
},
"ConfigVersion": "0.9"
}
24 changes: 16 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion config_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions contrib/packages/archlinux/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pkg/
src/
yanic*.pkg.tar
37 changes: 37 additions & 0 deletions contrib/packages/archlinux/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# $Id$
# Maintainer Geno <[email protected]>

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"
}
1 change: 1 addition & 0 deletions contrib/packages/archlinux/yanic.conf
13 changes: 13 additions & 0 deletions contrib/packages/archlinux/yanic.install
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions contrib/packages/archlinux/yanic.service
1 change: 1 addition & 0 deletions contrib/packages/debian/etc/yanic.conf
11 changes: 11 additions & 0 deletions contrib/packages/debian/lib/systemd/system/yanic.service
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions contrib/packages/debian/var/lib/yanic/state.empty
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1>Yanic - Meshviewer output</h1>
<ul>
<il><a href="nodes.json">nodes.json</a></il>
<il><a href="graph.json">graph.json</a></il>
</ul>