/ raspberry

Grafana: Build newer release for Raspberry

Step 1 - Install Phantom Js

PhantomJs is used as prebuilt binary:

curl -L https://raw.githubusercontent.com/fg2it/phantomjs-on-raspberry/master/jessie/b483dd673a1ca589ff10c5f73dfea1e43bfa3225/phantomjs_2.0.0_armhf.deb -o /tmp/phantomjs_2.0.0_armhf.deb
sudo dpkg -i /tmp/phantomjs_2.0.0_armhf.deb

Step 2 - Patch Phantom Js

export PHJSOFFSET=$(grep -aboF `phantomjs -v` `which phantomjs`|cut -d':' -f1)
printf "2.1.1\00" | sudo dd of=`which phantomjs` obs=1 seek=${PHJSOFFSET} conv=notrunc

Be aware, this is not a specially robust way for at least 2 reasons :

  • we expect to find only one match of the version string, and accordingly we use the offset of the first match.
  • we expect the original string to be at least as long as the new one.

Step 3 - Build Grafana

export GOPATH=/tmp/graf-build
mkdir -p $GOPATH
cd $GOPATH
go get github.com/grafana/grafana
cd $GOPATH/src/github.com/grafana/grafana
git checkout v3.0-beta5
go run build.go setup
$GOPATH/bin/godep restore
npm install
npm install -g grunt-cli grunt

Finally

go run build.go build package

When errors displayed in the style of

./node_modules/.bin/grunt release --pkgVer=3.0.0-beta71462546313
module.js:339
    throw err;
    ^

Error: Cannot find module 'resolve'

then run

npm install <modulename> -g`
npm link <modulename>

for the "missing" packages.

The built packages can be found in folder ./dist.

When grunt is not found try:

npm link grunt-cli grunt  grunt-jscs

Originally taken from Github/fg2it

Adapted from https://github.com/grafana/grafana-packer/blob/master/build.sh

First install rvm

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable

Build Grafana package

GOPATH=~/go
REPOPATH=$GOPATH/src/github.com/grafana/grafana
mkdir -p ~/go/src/github.com/grafana
cd ~/go/src/github.com/grafana
git clone https://github.com/grafana/grafana.git
git checkout v3.0.2

cd $REPOPATH
go get github.com/tools/godep
go run build.go build

npm install --unsafe-perm --dev

source /home/pi/.rvm/scripts/rvm

rvm use 2.1.9 --default
gem install fpm -v 1.4

go run build.go package latest