├── .editorconfig ├── docker ├── v3.x │ ├── GRAFANA_META │ ├── build.sh │ ├── Dockerfile │ ├── run.sh │ └── README.md ├── v4.x │ ├── custom │ │ └── Dockerfile │ ├── grafana.yaml │ ├── Dockerfile │ ├── run.sh │ ├── build.py │ └── README.md └── README.md ├── ci ├── createImage.py ├── createDescriptionFile.py ├── Dockerfile ├── build.sh └── README.md ├── old-versions ├── README.md ├── wheezy │ ├── v2.6.0 │ │ └── README.md │ ├── v2.1.2 │ │ └── README.md │ └── v3.1.1 │ │ └── README.md ├── wheezy-jessie │ └── README.md └── jessie │ ├── v3.x │ └── README.md │ └── v2.6.0 │ └── README.md ├── trigger-ci-test.py ├── update.sh ├── README.md └── .travis.yml /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [Makefile] 13 | indent_style = tab 14 | -------------------------------------------------------------------------------- /docker/v3.x/GRAFANA_META: -------------------------------------------------------------------------------- 1 | GRAFANA_VERSION=3.1.1 2 | GRAFANA_STAMP=1470786449 3 | 4 | #GRAFANA_VERSION=3.1.0 5 | #GRAFANA_STAMP=1470780578 6 | 7 | #GRAFANA_VERSION=3.1.0-beta1 8 | #GRAFANA_STAMP=1466707812 9 | 10 | #GRAFANA_VERSION=3.0.4 11 | #GRAFANA_STAMP=1464202710 12 | 13 | #GRAFANA_VERSION=3.0.3 14 | #GRAFANA_STAMP=1464034780 15 | 16 | #GRAFANA_VERSION=3.0.2 17 | #GRAFANA_STAMP=1463517851 18 | 19 | -------------------------------------------------------------------------------- /docker/v4.x/custom/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG GRAFANA_VERSION 2 | 3 | FROM fg2it/grafana-armhf:${GRAFANA_VERSION} 4 | 5 | USER grafana 6 | 7 | ARG GF_INSTALL_PLUGINS="" 8 | 9 | RUN if [ ! -z "${GF_INSTALL_PLUGINS}" ]; then \ 10 | OLDIFS=$IFS; \ 11 | IFS=','; \ 12 | for plugin in ${GF_INSTALL_PLUGINS}; do \ 13 | IFS=$OLDIFS; \ 14 | grafana-cli --pluginsDir "$GF_PATHS_PLUGINS" plugins install ${plugin}; \ 15 | done; \ 16 | fi 17 | -------------------------------------------------------------------------------- /docker/v3.x/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | _grafana_version=$1 3 | _grafana_stamp=$2 4 | _grafana_tag=$3 5 | _pkg_name=$1 6 | 7 | if [ -z "${_grafana_version}" ]; then 8 | source GRAFANA_META 9 | _grafana_version=$GRAFANA_VERSION 10 | _grafana_stamp=$GRAFANA_STAMP 11 | _grafana_tag=v$GRAFANA_VERSION 12 | if [[ $GRAFANA_VERSION == *beta* ]]; then 13 | _pkg_name=${GRAFANA_VERSION/-beta/-${GRAFANA_STAMP}beta} 14 | else 15 | _pkg_name=${GRAFANA_VERSION}-${GRAFANA_STAMP} 16 | fi 17 | fi 18 | 19 | echo "GRAFANA PACKAGE NAME: ${_pkg_name}" 20 | echo "DOCKER TAG: ${_grafana_tag}" 21 | 22 | docker build \ 23 | --build-arg GRAFANA_VERSION=${_grafana_version} \ 24 | --build-arg PKG_NAME=${_pkg_name} \ 25 | --tag "fg2it/grafana-armhf:${_grafana_tag}" . 26 | -------------------------------------------------------------------------------- /docker/v3.x/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/armv7hf-debian:jessie 2 | 3 | ARG GRAFANA_VERSION 4 | ARG PKG_NAME 5 | 6 | RUN apt-get update && \ 7 | apt-get -y --no-install-recommends install libfontconfig curl ca-certificates libicu52 libjpeg62-turbo libpng12-0 && \ 8 | curl -L https://github.com/fg2it/grafana-on-raspberry/releases/download/v${GRAFANA_VERSION}-jessie/grafana_${PKG_NAME}_armhf.deb > /tmp/grafana.deb && \ 9 | curl -o /usr/sbin/gosu -fsSL "https://github.com/tianon/gosu/releases/download/1.9/gosu-$(dpkg --print-architecture)" && \ 10 | chmod +x /usr/sbin/gosu && \ 11 | apt-get remove -y curl && \ 12 | apt-get autoremove -y && \ 13 | dpkg -i /tmp/grafana.deb || true && \ 14 | rm /tmp/grafana.deb 15 | 16 | 17 | VOLUME ["/var/lib/grafana", "/var/lib/grafana/plugins", "/var/log/grafana", "/etc/grafana"] 18 | 19 | EXPOSE 3000 20 | 21 | COPY ./run.sh /run.sh 22 | 23 | ENTRYPOINT ["/run.sh"] 24 | -------------------------------------------------------------------------------- /docker/v4.x/grafana.yaml: -------------------------------------------------------------------------------- 1 | - v5.1.4 2 | - v5.1.3 3 | - v5.1.2 4 | - v5.1.1 5 | - v5.1.0 6 | - v5.1.0-beta1-testing 7 | - v5.0.4 8 | - v5.0.3 9 | - v5.0.2 10 | - v5.0.1 11 | - v5.0.0 12 | - v5.0.0-beta5-testing 13 | - v5.0.0-beta4-testing 14 | - v5.0.0-beta3-testing 15 | - v5.0.0-beta2-testing 16 | - v5.0.0-beta1-testing 17 | - v4.6.3 18 | - v4.6.2 19 | - v4.6.1 20 | - v4.6.0 21 | - v4.6.0-beta3-testing 22 | - v4.6.0-beta2-testing 23 | - v4.6.0-beta1-testing 24 | - v4.5.2 25 | - v4.5.1 26 | - v4.5.0 27 | - v4.5.0-beta1-testing 28 | - v4.4.3 29 | - v4.4.2 30 | - v4.4.1 31 | - v4.4.0 32 | - v4.3.2 33 | - v4.3.1 34 | - v4.3.0 35 | - v4.3.0-beta1-testing 36 | - v4.2.0 37 | - v4.2.0-beta1-testing 38 | - 39 | - v4.1.2 40 | - 1487023783 41 | - 42 | - v4.1.1 43 | - 1484347088 44 | - 45 | - v4.1.0 46 | - 1484083445 47 | - 48 | - v4.1.0-beta1-testing 49 | - 1482275966 50 | - 51 | - v4.0.2 52 | - 1481228559 53 | - 54 | - v4.0.1 55 | - 1480722482 56 | - 57 | - v4.0.0-beta2-testing 58 | - 1479761438 59 | - 60 | - v4.0.0-beta1-testing 61 | - 1479422285 62 | -------------------------------------------------------------------------------- /ci/createImage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import os 3 | import re 4 | import sys 5 | 6 | d={} 7 | 8 | name = os.getenv("TRAVIS_TAG") 9 | # expect tag(-component)? 10 | # or commit((-branch)?-component)? 11 | # consider we have the second if commit match [0-9a-f]{6} 12 | # component must be either main, testing or experimental 13 | # eg : 14 | # name = 'a5f7ed-master-main' 15 | # name = 'a5f7ed-master' 16 | # name = 'a5f7ed' 17 | # name = 'v4.0.0-beta1-testing' 18 | # name = 'v4.0.1' 19 | 20 | if not name : 21 | if len(sys.argv)>1 : 22 | name=sys.argv[1] 23 | else : 24 | name='master' 25 | 26 | version = name 27 | for c in ('main', 'testing', 'experimental'): 28 | version = re.sub('-{}$'.format(c),'',version) 29 | 30 | g = re.search(r'([0-9a-f]{6})(-.+)?',version) 31 | if g: 32 | d['COMMIT'] = g.group(1) 33 | d['LABEL'] = g.group(2)[1:] 34 | d['DEPTH'] = 20 35 | else: 36 | #we have a tag 37 | d['LABEL'] = version 38 | 39 | buildArg = ' '.join( ['--build-arg {}={}'.format(k,v) for k,v in d.items()] ) 40 | cmd = 'docker build {} -t fg2it/grafana-builder -f ci/Dockerfile ci'.format(buildArg) 41 | print( cmd ) 42 | os.system( cmd ) 43 | -------------------------------------------------------------------------------- /ci/createDescriptionFile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import json 3 | import os 4 | import re 5 | 6 | repo={ 7 | 'armv6' : 'deb-rpi-1b', 8 | 'armv7' : 'deb', 9 | 'arm64' : 'deb-arm64' 10 | } 11 | 12 | darch={ 13 | 'armv6' : 'armhf', 14 | 'armv7' : 'armhf', 15 | 'arm64' : 'arm64' 16 | } 17 | 18 | name = os.getenv("TRAVIS_TAG") 19 | component = "main" 20 | if name : 21 | for c in ('testing','experimental'): 22 | if re.search(r'-{}$'.format(c),name): 23 | component = c 24 | 25 | def descriptor(arch): 26 | _package = { 27 | "name" : "grafana-on-raspberry", 28 | "repo" : repo[arch], 29 | "subject" : "fg2it" 30 | } 31 | 32 | _version = { 33 | "name": name, 34 | "vcs_tag": name 35 | } 36 | 37 | _files = [ 38 | { 39 | "includePattern": "{}/(.*\.deb$)".format(arch), 40 | "uploadPattern": "{}/g/$1".format(component), 41 | "matrixParams": { 42 | "deb_distribution": "wheezy,jessie,stretch", 43 | "deb_component": component, 44 | "deb_architecture": darch[arch] 45 | } 46 | } 47 | ] 48 | 49 | return { 50 | "package" : _package, 51 | "version" : _version, 52 | "files" : _files, 53 | "publish" : True 54 | } 55 | 56 | for arch in ('armv6','armv7','arm64'): 57 | print(json.dumps(descriptor(arch)),file=open(arch+'.d','w')) 58 | -------------------------------------------------------------------------------- /old-versions/README.md: -------------------------------------------------------------------------------- 1 | # Notes on building previous version of [Grafana](http://grafana.org) for arm based raspberry pi 2 and pi 3. 2 | 3 | 4 | Grafana doesn't provide packages for arm, so these notes are here to explain how 5 | you can build Grafana. The main focus is to try to use the exact 6 | [source](https://github.com/grafana/grafana) from Grafana. 7 | 8 | Each directory contains a README.md file that discribes how you can build 9 | grafana, depending on the version and your plateform target. 10 | 11 | If you are not interested in building Grafana your self, have a look to the 12 | [release](https://github.com/fg2it/grafana-on-raspberry/releases) section. 13 | See also the wiki for install from a deb repo. 14 | 15 | ## `wheezy/` and `jessie/` 16 | The notes in `wheezy/` and `jessie/` subdirectories should essentially work on 17 | both wheezy and jessie distro, but at least one feature won't : creating png 18 | files from your graph. For this, `grafana` relies on `PhantomJS` and the 19 | binaries I used won't work on both wheezy and jessie. Beside this, it should 20 | work but I didn't test it. 21 | 22 | ## `wheezy-jessie/` 23 | The `wheezy-jessie/` directory contains notes that do not have the aforementioned 24 | problem. They use a different PhantomJS build, which works fine on both distro. 25 | 26 | 27 | Grafana [license](https://github.com/grafana/grafana/blob/master/LICENSE.md). 28 | -------------------------------------------------------------------------------- /docker/v3.x/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | : "${GF_PATHS_DATA:=/var/lib/grafana}" 4 | : "${GF_PATHS_LOGS:=/var/log/grafana}" 5 | : "${GF_PATHS_PLUGINS:=/var/lib/grafana/plugins}" 6 | 7 | chown -R grafana:grafana "$GF_PATHS_DATA" "$GF_PATHS_LOGS" 8 | chown -R grafana:grafana /etc/grafana 9 | 10 | if [ ! -z ${GF_AWS_PROFILES+x} ]; then 11 | mkdir -p ~grafana/.aws/ 12 | touch ~grafana/.aws/credentials 13 | 14 | for profile in ${GF_AWS_PROFILES}; do 15 | access_key_varname="GF_AWS_${profile}_ACCESS_KEY_ID" 16 | secret_key_varname="GF_AWS_${profile}_SECRET_ACCESS_KEY" 17 | region_varname="GF_AWS_${profile}_REGION" 18 | 19 | if [ ! -z "${!access_key_varname}" -a ! -z "${!secret_key_varname}" ]; then 20 | echo "[${profile}]" >> ~grafana/.aws/credentials 21 | echo "aws_access_key_id = ${!access_key_varname}" >> ~grafana/.aws/credentials 22 | echo "aws_secret_access_key = ${!secret_key_varname}" >> ~grafana/.aws/credentials 23 | if [ ! -z "${!region_varname}" ]; then 24 | echo "region = ${!region_varname}" >> ~grafana/.aws/credentials 25 | fi 26 | fi 27 | done 28 | 29 | chown grafana:grafana -R ~grafana/.aws 30 | chmod 600 ~grafana/.aws/credentials 31 | fi 32 | 33 | if [ ! -z ${GF_INSTALL_PLUGINS} ]; then 34 | OLDIFS=$IFS 35 | IFS=',' 36 | for plugin in ${GF_INSTALL_PLUGINS}; do 37 | grafana-cli plugins install ${plugin} 38 | done 39 | IFS=$OLDIFS 40 | fi 41 | 42 | exec gosu grafana /usr/sbin/grafana-server \ 43 | --homepath=/usr/share/grafana \ 44 | --config=/etc/grafana/grafana.ini \ 45 | cfg:default.paths.data="$GF_PATHS_DATA" \ 46 | cfg:default.paths.logs="$GF_PATHS_LOGS" \ 47 | cfg:default.paths.plugins="$GF_PATHS_PLUGINS" 48 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | # grafana-on-raspberry through docker 2 | [![](https://images.microbadger.com/badges/version/fg2it/grafana-armhf.svg)](https://microbadger.com/images/fg2it/grafana-armhf) [![](https://images.microbadger.com/badges/image/fg2it/grafana-armhf.svg)](https://microbadger.com/images/fg2it/grafana-armhf) [![Docker Pulls](https://img.shields.io/docker/pulls/fg2it/grafana-armhf.svg?style=flat-square)](https://hub.docker.com/r/fg2it/grafana-armhf/) 3 | 4 | --- 5 | 6 | ## **Warning Notice: End of Life** 7 | 8 | Starting from [v5.2.0-beta1](https://github.com/grafana/grafana/releases/tag/v5.2.0-beta1) Grafana introduced [official support](https://grafana.com/grafana/download/5.2.0-beta1?platform=arm) for armv7 and arm64 linux platforms. Many thanks to them for that. 9 | 10 | As a consequence, this repo is no more needed and stops support starting from v5.2.0-beta1. 11 | 12 | If you are using unofficial builds from this repo, you are invited to upgrade to official builds. 13 | 14 | > Should you need armv6 build, you are invited to ask official support. 15 | 16 | --- 17 | 18 | [Grafana](http://grafana.org) *unofficial* docker image for armhf. 19 | 20 | The build process closely follows the [official 21 | one](https://github.com/grafana/grafana-docker). You can get the image from 22 | [dockerhub](https://hub.docker.com/r/fg2it/grafana-armhf/). 23 | 24 | Obviously, you will need docker to run a container. The easiest way might be to 25 | use [hypriot deb package](http://blog.hypriot.com/downloads/). 26 | 27 | See [dockerhub](https://hub.docker.com/r/fg2it/grafana-armhf/tags) for available 28 | version. Alternately, you can use the registry api : 29 | ```bash 30 | curl -s -S https://registry.hub.docker.com/v2/repositories/fg2it/grafana-armhf/tags/ | python -m json.tool | grep name 31 | ``` 32 | 33 | Grafana [license](https://github.com/grafana/grafana/blob/master/LICENSE.md). 34 | -------------------------------------------------------------------------------- /docker/v4.x/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG RELEASE=stretch 2 | FROM arm32v7/debian:${RELEASE}-slim 3 | 4 | ARG GF_UID="472" 5 | ARG GF_GID="472" 6 | 7 | ARG REPO_TAG 8 | ARG PKG_NAME 9 | ARG BUILD_DATE 10 | ARG VCS_REF 11 | 12 | LABEL org.label-schema.schema-version="1.0" 13 | LABEL org.label-schema.build-date=$BUILD_DATE 14 | LABEL org.label-schema.vcs-url="https://github.com/fg2it/grafana-on-raspberry" 15 | LABEL org.label-schema.vcs-ref=$VCS_REF 16 | 17 | ENV GRAFANA_URL="https://github.com/fg2it/grafana-on-raspberry/releases/download/${REPO_TAG}/grafana-${PKG_NAME}.linux-armhf.tar.gz" \ 18 | PATH=/usr/share/grafana/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ 19 | GF_PATHS_CONFIG="/etc/grafana/grafana.ini" \ 20 | GF_PATHS_DATA="/var/lib/grafana" \ 21 | GF_PATHS_HOME="/usr/share/grafana" \ 22 | GF_PATHS_LOGS="/var/log/grafana" \ 23 | GF_PATHS_PLUGINS="/var/lib/grafana/plugins" \ 24 | GF_PATHS_PROVISIONING="/etc/grafana/provisioning" 25 | 26 | RUN apt-get update && apt-get install -qq -y tar libfontconfig curl ca-certificates && \ 27 | mkdir -p "$GF_PATHS_HOME/.aws" && \ 28 | curl -L "$GRAFANA_URL" | tar xfz - --strip-components=1 -C "$GF_PATHS_HOME" && \ 29 | apt-get autoremove -y && \ 30 | rm -rf /var/lib/apt/lists/* && \ 31 | groupadd -r -g $GF_GID grafana && \ 32 | useradd -r -u $GF_UID -g grafana grafana && \ 33 | mkdir -p "$GF_PATHS_PROVISIONING/datasources" \ 34 | "$GF_PATHS_PROVISIONING/dashboards" \ 35 | "$GF_PATHS_LOGS" \ 36 | "$GF_PATHS_PLUGINS" \ 37 | "$GF_PATHS_DATA" && \ 38 | cp "$GF_PATHS_HOME/conf/sample.ini" "$GF_PATHS_CONFIG" && \ 39 | cp "$GF_PATHS_HOME/conf/ldap.toml" /etc/grafana/ldap.toml && \ 40 | chown -R grafana:grafana "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" && \ 41 | chmod 777 "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" 42 | 43 | EXPOSE 3000 44 | 45 | COPY ./run.sh /run.sh 46 | 47 | USER grafana 48 | WORKDIR / 49 | ENTRYPOINT [ "/run.sh" ] 50 | -------------------------------------------------------------------------------- /ci/Dockerfile: -------------------------------------------------------------------------------- 1 | #Cross build Grafana master for armv6-v7 wheezy/jessie/stretch 2 | FROM debian:stretch 3 | 4 | ARG LABEL=master 5 | ARG DEPTH=1 6 | ARG COMMIT 7 | 8 | ENV LABEL=${LABEL} \ 9 | DEPTH=${DEPTH} \ 10 | PATH=/usr/local/go/bin:$PATH \ 11 | GOPATH=/tmp/graf-build \ 12 | NODEVERSION=6.14.1 13 | 14 | COPY ./build.sh / 15 | 16 | RUN chmod 700 /build.sh && \ 17 | apt-get update && \ 18 | apt-get install -y \ 19 | apt-transport-https \ 20 | binutils \ 21 | bzip2 \ 22 | ca-certificates \ 23 | curl \ 24 | dh-autoreconf \ 25 | g++ \ 26 | gcc \ 27 | git \ 28 | libc-dev \ 29 | libfontconfig1 \ 30 | make \ 31 | python \ 32 | ruby \ 33 | ruby-dev \ 34 | xz-utils && \ 35 | gem install --no-ri --no-rdoc fpm && \ 36 | curl -sSL https://nodejs.org/dist/v${NODEVERSION}/node-v${NODEVERSION}-linux-x64.tar.xz \ 37 | | tar -xJ --strip-components=1 -C /usr/local && \ 38 | curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ 39 | echo "deb [arch=amd64] https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ 40 | apt-get update && apt-get install --no-install-recommends yarn && \ 41 | mkdir -p $GOPATH/src/github.com/grafana && \ 42 | cd $GOPATH/src/github.com/grafana && \ 43 | git clone -b ${LABEL} --depth ${DEPTH} --single-branch https://github.com/grafana/grafana.git && \ 44 | cd $GOPATH/src/github.com/grafana/grafana && \ 45 | git checkout ${COMMIT} && \ 46 | yarn install --pure-lockfile && \ 47 | GOVERSION=$(grep 'ENV GOLANG' scripts/build/Dockerfile | cut -d' ' -f3) && \ 48 | curl -sSL https://storage.googleapis.com/golang/go${GOVERSION}.linux-amd64.tar.gz \ 49 | | tar -xz -C /usr/local && \ 50 | go run build.go setup 51 | 52 | 53 | CMD ["/bin/bash"] 54 | -------------------------------------------------------------------------------- /old-versions/wheezy/v2.6.0/README.md: -------------------------------------------------------------------------------- 1 | # Grafana v2.6.0 release for raspberry pi 2 and 3/wheezy 2 | Build from tag [v2.6.0](https://github.com/grafana/grafana/tree/v2.6.0) with with 3 | [this](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/wheezy/2.0.1-development) 4 | `phantomjs` binary working on raspberry pi 2 running raspbian/wheezy. 5 | 6 | `go` version was 1.5.2, `nodejs` was 4.4.1, `npm` was 2.14.20 and `phantomjs` was 7 | 2.0.1-dev. 8 | 9 | The packages here can be expected to work on raspbian/jessie too, except for 10 | features relying on `PhantomJS`. (see [here](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/jessie/v2.6.0) for jessie) 11 | 12 | 13 | ## Do it your self 14 | 15 | Packages were built following the same [instructions](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/jessie/v2.6.0) 16 | than for jessie with minimal changes. 17 | 18 | ### Dependencies 19 | Due to a different `phantomjs` binary, you should have instead of the last `apt-get`: 20 | ```bash 21 | sudo apt-get install libfontconfig1 libicu48 libjpeg8 libpng12-0 22 | ``` 23 | (to be specific, these are the dependencies for my binary). 24 | To install `phantomjs`, can you use my binary : 25 | ```bash 26 | curl -L https://github.com/fg2it/phantomjs-on-raspberry/raw/fe240a6831b943be813e01eef897045963cb54bc/wheezy/2.0.1-development/phantomjs_2.0.1-development_armhf.deb -o /tmp/phantomjs_2.0.1-development_armhf.deb 27 | sudo dpkg -i phantomjs_2.0.1-development_armhf.deb 28 | ``` 29 | 30 | The remaining (other dependencies, patch of phantomjs and grafana build) is unchanged. 31 | 32 | ## See: 33 | - [fpm](https://github.com/jordansissel/fpm) 34 | - [go](http://blog.hypriot.com/post/how-to-compile-go-on-arm/) by hypriot 35 | - [grafana](https://github.com/grafana/grafana/blob/v2.6.0/docs/sources/project/building_from_source.md) 36 | - [gvm](https://github.com/moovweb/gvm) 37 | - [nodejs](https://nodejs.org/dist/v4.4.1/node-v4.4.1-linux-armv7l.tar.xz) official binaries 38 | - [phantomjs](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/wheezy/2.0.1-development) for pi2 (and pi3)/wheezy 39 | -------------------------------------------------------------------------------- /ci/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | 5 | usage() { 6 | base="$(basename "$0")" 7 | cat < 9 | Install specific packages to build grafana for either armv6, armv7 or arm64 10 | Use -r for release package 11 | Available arch: 12 | $base armv6 13 | $base armv7 14 | $base arm64 15 | EOUSAGE 16 | } 17 | 18 | install_phjs() { 19 | PHJSURL="https://github.com/fg2it/phantomjs-on-raspberry/releases/download/${PHJSV}" 20 | PHJS=/tmp/${ARM}/phantomjs 21 | mkdir -p /tmp/${ARM} 22 | curl -sSL ${PHJSURL}/phantomjs -o ${PHJS} 23 | chmod a+x ${PHJS} 24 | } 25 | 26 | armv6_install_cross(){ 27 | cd /tmp 28 | git clone https://github.com/fg2it/cross-rpi1b.git 29 | CROSSPATH="/tmp/cross-rpi1b/arm-rpi-4.9.3-linux-gnueabihf/bin/" 30 | CC=${CROSSPATH}/arm-linux-gnueabihf-gcc 31 | } 32 | 33 | armv7_install_cross() { 34 | apt-get install -y gcc-arm-linux-gnueabihf 35 | CC=arm-linux-gnueabihf-gcc 36 | } 37 | 38 | arm64_install_cross() { 39 | apt-get install -y gcc-aarch64-linux-gnu 40 | CC=aarch64-linux-gnu-gcc 41 | } 42 | 43 | build() { 44 | cd $GOPATH/src/github.com/grafana/grafana 45 | go run build.go \ 46 | -pkg-arch=${ARCH} \ 47 | -goarch=${ARM} \ 48 | -cgo-enabled=1 \ 49 | -cc=$CC \ 50 | -phjs=${PHJS} \ 51 | -includeBuildNumber=${includeBuildNumber} \ 52 | build \ 53 | pkg-deb 54 | } 55 | 56 | 57 | includeBuildNumber="true" 58 | if [ "$1" == "-r" ]; then 59 | echo "Package for release" 60 | includeBuildNumber="false" 61 | shift 62 | fi 63 | 64 | if (( $# != 1 )); then 65 | usage >&2 66 | exit 1 67 | fi 68 | 69 | ARM="$1" 70 | 71 | case "$ARM" in 72 | armv6) 73 | PHJSV="v2.1.1-wheezy-jessie-armv6" 74 | armv6_install_cross 75 | ARCH="armhf" 76 | ;; 77 | armv7) 78 | PHJSV="v2.1.1-wheezy-jessie" 79 | armv7_install_cross 80 | ARCH="armhf" 81 | ;; 82 | arm64) 83 | PHJSV="v2.1.1-jessie-stretch-arm64" 84 | arm64_install_cross 85 | ARCH="arm64" 86 | ;; 87 | *) 88 | echo >&2 'error: unknown arch:' "$ARM" 89 | usage >&2 90 | exit 1 91 | ;; 92 | esac 93 | 94 | install_phjs 95 | build 96 | -------------------------------------------------------------------------------- /trigger-ci-test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import argparse 3 | import json 4 | import pprint 5 | import requests 6 | import yaml 7 | 8 | def trigger(branch,cfg,token,message='',verbose=False): 9 | headers = { 10 | 'Content-Type': 'application/json', 11 | 'Accept': 'application/json', 12 | 'Travis-API-Version': '3', 13 | 'Authorization': 'token {}'.format(token), 14 | } 15 | if message != '': 16 | message = '({})'.format(message) 17 | 18 | data = { 19 | "request" : { 20 | "message": "custom build {}".format(message), 21 | "branch" : branch, 22 | "config" : cfg 23 | } 24 | } 25 | serialized = json.dumps(data,indent=2) 26 | if verbose: 27 | print(serialized) 28 | response = requests.post('https://api.travis-ci.org/repo/fg2it%2Fgrafana-on-raspberry/requests', 29 | headers=headers, data=serialized) 30 | print(response.status_code) 31 | if verbose: 32 | try: 33 | pprint.PrettyPrinter(indent=2).pprint(response.json()) 34 | except ValueError: 35 | print(response.text) 36 | 37 | if __name__ == "__main__" : 38 | parser = argparse.ArgumentParser(description="Trigger travis ci from yml") 39 | parser.add_argument("-b", 40 | help="branch of git repo", 41 | default="master" 42 | ) 43 | parser.add_argument("-c", 44 | help="yml configuration file", 45 | default=".travis.yml" 46 | ) 47 | parser.add_argument("-m", 48 | help="travis message", 49 | default="") 50 | parser.add_argument("-t", 51 | help="travis token" 52 | ) 53 | parser.add_argument("-v", 54 | help="verbose", 55 | action='store_true' 56 | ) 57 | args = parser.parse_args() 58 | if args.v: 59 | print("Requesting build:\n" 60 | " on {}\n" 61 | " using {}\n" 62 | " (message) {}\n" 63 | " (token) {}".format(args.m,args.c,args.m,args.t)) 64 | cfg = yaml.load( open(args.c) ) 65 | trigger(args.b, cfg, args.t, message=args.m, verbose=args.v) 66 | -------------------------------------------------------------------------------- /docker/v4.x/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | PERMISSIONS_OK=0 4 | 5 | if [ ! -r "$GF_PATHS_CONFIG" ]; then 6 | echo "GF_PATHS_CONFIG='$GF_PATHS_CONFIG' is not readable." 7 | PERMISSIONS_OK=1 8 | fi 9 | 10 | if [ ! -w "$GF_PATHS_DATA" ]; then 11 | echo "GF_PATHS_DATA='$GF_PATHS_DATA' is not writable." 12 | PERMISSIONS_OK=1 13 | fi 14 | 15 | if [ ! -r "$GF_PATHS_HOME" ]; then 16 | echo "GF_PATHS_HOME='$GF_PATHS_HOME' is not readable." 17 | PERMISSIONS_OK=1 18 | fi 19 | 20 | if [ $PERMISSIONS_OK -eq 1 ]; then 21 | echo "You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migration-from-a-previous-version-of-the-docker-container-to-5-1-or-later" 22 | fi 23 | 24 | if [ ! -d "$GF_PATHS_PLUGINS" ]; then 25 | mkdir "$GF_PATHS_PLUGINS" 26 | fi 27 | 28 | 29 | if [ ! -z ${GF_AWS_PROFILES+x} ]; then 30 | > "$GF_PATHS_HOME/.aws/credentials" 31 | 32 | for profile in ${GF_AWS_PROFILES}; do 33 | access_key_varname="GF_AWS_${profile}_ACCESS_KEY_ID" 34 | secret_key_varname="GF_AWS_${profile}_SECRET_ACCESS_KEY" 35 | region_varname="GF_AWS_${profile}_REGION" 36 | 37 | if [ ! -z "${!access_key_varname}" -a ! -z "${!secret_key_varname}" ]; then 38 | echo "[${profile}]" >> "$GF_PATHS_HOME/.aws/credentials" 39 | echo "aws_access_key_id = ${!access_key_varname}" >> "$GF_PATHS_HOME/.aws/credentials" 40 | echo "aws_secret_access_key = ${!secret_key_varname}" >> "$GF_PATHS_HOME/.aws/credentials" 41 | if [ ! -z "${!region_varname}" ]; then 42 | echo "region = ${!region_varname}" >> "$GF_PATHS_HOME/.aws/credentials" 43 | fi 44 | fi 45 | done 46 | 47 | chmod 600 "$GF_PATHS_HOME/.aws/credentials" 48 | fi 49 | 50 | if [ ! -z "${GF_INSTALL_PLUGINS}" ]; then 51 | OLDIFS=$IFS 52 | IFS=',' 53 | for plugin in ${GF_INSTALL_PLUGINS}; do 54 | IFS=$OLDIFS 55 | grafana-cli --pluginsDir "${GF_PATHS_PLUGINS}" plugins install ${plugin} 56 | done 57 | fi 58 | 59 | exec grafana-server \ 60 | --homepath="$GF_PATHS_HOME" \ 61 | --config="$GF_PATHS_CONFIG" \ 62 | "$@" \ 63 | cfg:default.log.mode="console" \ 64 | cfg:default.paths.data="$GF_PATHS_DATA" \ 65 | cfg:default.paths.logs="$GF_PATHS_LOGS" \ 66 | cfg:default.paths.plugins="$GF_PATHS_PLUGINS" \ 67 | cfg:default.paths.provisioning="$GF_PATHS_PROVISIONING" -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | 5 | CFGFILE='grafana.yaml' 6 | 7 | usage() { 8 | base="$(basename "$0")" 9 | cat < 11 | Setup and release new grafana version on grafana-on-raspberry github repo 12 | -1 do only step 1: create trigger commit 13 | -2 do only step 2: create tag to trigger deployment 14 | -3 do only step 3: wait for travis 15 | -4 do only step 4: create docker image, test and push 16 | -5 do only step 5: commit docker update 17 | -h this help 18 | EOUSAGE 19 | } 20 | 21 | trigger_commit() { 22 | echo "dummy commit to trigger ${VERSION} build on ci" > .dummy 23 | git add .dummy 24 | git commit -m "trigger ${VERSION}" 25 | git push 26 | } 27 | 28 | deploy_commit() { 29 | DIGEST=$(git log -n1 --pretty=oneline | cut -f1 -d' ') 30 | git tag -a ${VERSION} -m ${VERSION} ${DIGEST} 31 | git push origin ${VERSION} 32 | } 33 | 34 | wait_travis() { 35 | sleep 30 36 | STATE=$(travis history -b ${VERSION} --no-interactive | head -n1 | cut -f2 -d' ') 37 | echo ${STATE} 38 | sleep 600 39 | for i in `seq 1 20`; do 40 | STATE=$(travis history -b ${VERSION} --no-interactive | head -n1 | cut -f2 -d' ') 41 | echo ${STATE} 42 | case ${STATE} in 43 | passed:) 44 | break 45 | ;; 46 | failed:) 47 | echo "** Err: Travis build failed" 48 | echo "** Docker image NOT build" 49 | echo "** Fail **" 50 | exit 1 51 | ;; 52 | esac 53 | sleep 90 54 | done 55 | if [[ ${STATE} != *passed:* ]]; then 56 | echo "** Err: Travis build timeout (current state: ${STATE})" 57 | echo "** Docker image NOT build" 58 | exit 1 59 | fi 60 | } 61 | 62 | docker_image() { 63 | cd docker/v4.x/ 64 | sed -i "1s/^/- ${VERSION}\n/" ${CFGFILE} 65 | ./build.py 66 | ./build.py -t 67 | ./build.py -p 68 | cd - 69 | } 70 | 71 | docker_commit() { 72 | git rm .dummy 73 | git commit -a -m "docker: ${VERSION}" 74 | git push 75 | } 76 | 77 | 78 | if [[ `git config user.name` != "fg2it" ]]; then 79 | echo "Error: Wrong git user" 80 | exit 1 81 | fi 82 | 83 | VERSION=$1 84 | if (( $# != 1 )); then 85 | VERSION=$2 86 | fi 87 | 88 | case $1 in 89 | -1) 90 | shift 91 | trigger_commit 92 | exit 0 93 | ;; 94 | -2) 95 | shift 96 | deploy_commit 97 | exit 0 98 | ;; 99 | -3) 100 | shift 101 | wait_travis 102 | exit 0 103 | ;; 104 | -4) 105 | shift 106 | docker_image 107 | exit 0 108 | ;; 109 | -5) 110 | shift 111 | docker_commit 112 | exit 0 113 | ;; 114 | -*) 115 | usage 116 | exit 0 117 | ;; 118 | esac 119 | 120 | echo >&2 "1/5 creating trigger commit" 121 | trigger_commit 122 | echo >&2 "2/5 creating tag/trigger deployment" 123 | deploy_commit 124 | echo >&2 "3/5 waiting travis" 125 | wait_travis 126 | echo >&2 "4/5 docker" 127 | docker_image 128 | echo >&2 "5/5 commit docker update" 129 | docker_commit 130 | echo >&2 "Success" 131 | -------------------------------------------------------------------------------- /ci/README.md: -------------------------------------------------------------------------------- 1 | # Grafana Crossbuild 2 | 3 | --- 4 | 5 | ## **Warning Notice: End of Life** 6 | 7 | Starting from [v5.2.0-beta1](https://github.com/grafana/grafana/releases/tag/v5.2.0-beta1) Grafana introduced [official support](https://grafana.com/grafana/download/5.2.0-beta1?platform=arm) for armv7 and arm64 linux platforms. Many thanks to them for that. 8 | 9 | As a consequence, this repo is no more needed and stops support starting from v5.2.0-beta1. 10 | 11 | If you are using unofficial builds from this repo, you are invited to upgrade to official builds. 12 | 13 | > Should you need armv6 build, you are invited to ask official support. 14 | 15 | --- 16 | 17 | This directory contains `Dockerfile` and helper script to crossbuild Grafana for 18 | armv6 (raspberry pi 1) and armv7 (raspberry pi 2 and pi 3) from an x64 host 19 | inside a (debian stretch) docker container. 20 | 21 | > For arm64, this build grafana with an arm64 phantomjs binary. 22 | 23 | ## Usage 24 | Build the docker image 25 | 26 | ```bash 27 | docker build [--build-arg LABEL=] [--build-arg DEPTH=] [--build-arg COMMIT=] -t grafana-builder . 28 | ``` 29 | 30 | >- LABEL is a branch or a tag of grafana github repo, default is master 31 | >- DEPTH is the number of commit to be checkout, default is 1 32 | >- COMMIT is a specific commit to checkout, default is head 33 | > 34 | > As a consequence: 35 | >- without option, it prepares build of current commit on master 36 | >- if you intend to build a specific commit, COMMIT should be reachable within the DEPTH commits from current head of the branch LABEL 37 | 38 | Build Grafana depending on your target, 39 | 40 | ```bash 41 | docker run --name build-armv6 grafana-builder ./build.sh armv6 42 | ``` 43 | 44 | or 45 | 46 | ```bash 47 | docker run --name build-armv7 grafana-builder ./build.sh armv7 48 | ``` 49 | 50 | or 51 | 52 | ```bash 53 | docker run --name build-arm64 grafana-builder ./build.sh arm64 54 | ``` 55 | 56 | Then you can extract .deb and tarball from the container: 57 | 58 | ```bash 59 | docker cp build-armv6:/tmp/graf-build/src/github.com/grafana/grafana/dist/ armv6 60 | ``` 61 | 62 | or 63 | 64 | ```bash 65 | docker cp build-armv7:/tmp/graf-build/src/github.com/grafana/grafana/dist/ armv7 66 | ``` 67 | 68 | or 69 | 70 | ```bash 71 | docker cp build-arm64:/tmp/graf-build/src/github.com/grafana/grafana/dist/ arm64 72 | ``` 73 | 74 | ## How it works 75 | It uses the crossbuild feature of go exposed via command line options of the 76 | `build.go` tool from Grafana which was introduced after v3.1.1. 77 | Due to some `C` bindings in some go modules used in Grafana, a `c/c++` toolchain is needed. 78 | > For armv6, the toolchain comes from 79 | [raspberrypi/tools](https://github.com/raspberrypi/tools), see 80 | [here](https://github.com/fg2it/cross-rpi1b). 81 | > 82 | > For armv7 and arm64, the toolchains come from `crossbuild-essential-armhf` `crossbuild-essential-arm64` packages (stretch). 83 | 84 | For all three targets, it uses a v2.1.1 PhantomJS binary from my 85 | [phantomjs-on-raspberry](https://github.com/fg2it/phantomjs-on-raspberry) repo. 86 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # grafana-on-raspberry (and arm64) [![Release][release-svg]][release_url] [![Build Status][ci-svg]][ci-url] 2 | 3 | --- 4 | 5 | ## **Warning Notice: End of Life** 6 | 7 | Starting from [v5.2.0-beta1](https://github.com/grafana/grafana/releases/tag/v5.2.0-beta1) Grafana introduced [official support](https://grafana.com/grafana/download/5.2.0-beta1?platform=arm) for armv7 and arm64 linux platforms. Many thanks to them for that. 8 | 9 | As a consequence, this repo is no more needed and stops support starting from v5.2.0-beta1. 10 | 11 | If you are using unofficial builds from this repo, you are invited to upgrade to official builds. 12 | 13 | > Should you need armv6 build, you are invited to ask official support. 14 | 15 | --- 16 | 17 | [release-svg]: https://img.shields.io/github/release/fg2it/grafana-on-raspberry.svg 18 | [release_url]: https://github.com/fg2it/grafana-on-raspberry/releases/latest 19 | [ci-svg]: https://travis-ci.org/fg2it/grafana-on-raspberry.svg?branch=master 20 | [ci-url]: https://travis-ci.org/fg2it/grafana-on-raspberry 21 | 22 | > | raspberry pi 1 (armv6) | raspberry pi 2 and 3 (armv7) | arm64 | 23 | > | :---: | :---: | :---: | 24 | > | [ ![Download][pi1-svg] ][pi1-url] | [ ![Download][pi2-svg] ][pi2-url] | [ ![Download][arm64-svg] ][arm64-url] 25 | 26 | [pi1-svg]: https://api.bintray.com/packages/fg2it/deb-rpi-1b/grafana-on-raspberry/images/download.svg 27 | [pi1-url]: https://bintray.com/fg2it/deb-rpi-1b/grafana-on-raspberry/_latestVersion 28 | [pi2-svg]: https://api.bintray.com/packages/fg2it/deb/grafana-on-raspberry/images/download.svg 29 | [pi2-url]: https://bintray.com/fg2it/deb/grafana-on-raspberry/_latestVersion 30 | [arm64-svg]: https://api.bintray.com/packages/fg2it/deb-arm64/grafana-on-raspberry/images/download.svg 31 | [arm64-url]: https://bintray.com/fg2it/deb-arm64/grafana-on-raspberry/_latestVersion 32 | 33 | [Grafana](http://grafana.org) *unofficial* packages for arm based raspberry pi (1, 2 and 3) and arm64/aarch64. 34 | 35 | Grafana doesn't provide packages for arm, so the purpose of this repo is to provide notes 36 | on how you can build Grafana yourself and packages I build according to these notes. 37 | 38 | Deb packages and tarballs are available from the github [release][release] section 39 | (only pi 2 and pi 3) and most recent ones are also available from a deb repo on 40 | [bintray][bintray-pi2/3] (including for [pi 1][bintray-pi1] and [arm64/aarch64][bintray-arm64]). See the 41 | [wiki](../../wiki) for details. 42 | 43 | [release]: https://github.com/fg2it/grafana-on-raspberry/releases 44 | [bintray-pi2/3]: https://bintray.com/fg2it/deb/grafana-on-raspberry "bintray repo for pi 2/3" 45 | [bintray-pi1]: https://bintray.com/fg2it/deb-rpi-1b/grafana-on-raspberry "bintray repo for pi 1b" 46 | [bintray-arm64]: https://bintray.com/fg2it/deb-arm64/grafana-on-raspberry "bintray repo for arm64/aarch64" 47 | 48 | ## `ci/` 49 | 50 | Notes and tools to crossbuild Grafana. Used to build on [travis](https://travis-ci.org/). 51 | 52 | ## `docker/` 53 | 54 | The `docker/` folder contains `Dockerfile` and related files to build images 55 | running grafana for armhf. Corresponding images are on [dockerhub](https://hub.docker.com/r/fg2it/grafana-armhf/). 56 | 57 | ## `old-versions/` 58 | 59 | This directory contains notes for versions from 2.1.2 up to 3.1.1 for wheezy and jessie distro. 60 | 61 | ## Other boards 62 | 63 | These packages have been reported to work on some other armv6/armv7 boards running 64 | debian-like os like odroid or orange pi. See the [FAQ](../../wiki/FAQ) for details. 65 | 66 | --- 67 | 68 | ## License 69 | 70 | Grafana [license](https://github.com/grafana/grafana/blob/master/LICENSE.md). 71 | -------------------------------------------------------------------------------- /old-versions/wheezy/v2.1.2/README.md: -------------------------------------------------------------------------------- 1 | # Grafana v2.1.2 release for raspberry pi 2 and 3/wheezy 2 | Build from tag [v2.1.2](https://github.com/grafana/grafana/tree/v2.1.2) with 3 | [this](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/wheezy/2.0.1-development_as_1.9.8) 4 | `phantomjs` binary working on raspberry pi 2 running raspbian/wheezy. 5 | 6 | `go` version was 1.5, `nodejs` was 0.12.7, `npm` was 2.11.3 and `phantomjs` was 7 | 2.0.1-dev dressed like 1.9.8. 8 | 9 | The packages here can be expected to work on raspbian/jessie too, except for 10 | features relying on `PhantomJS`. 11 | 12 | Should you follow the instructions below with the right binary for PhantomJS, 13 | you would end up with a fully functional build. 14 | 15 | ## Main problems to overcome 16 | - you need a recent version of `nodejs` (>=0.12.0 should be fine; 0.12.7 is). 17 | - you may want to have `phantomjs`. See 18 | [#2683](https://github.com/grafana/grafana/issues/2683) for this issue. Having 19 | the right version of `phantomjs` binary allows a cleaner build and the feature 20 | creating png files from your graph. 21 | - per se, source won't build because of a time out. 22 | You need to modify `requirejs.js`. (The time out was disabled a few commit later). 23 | 24 | 25 | ## Instructions 26 | The good news is you mainly have to follow the official 27 | [instructions](https://github.com/grafana/grafana/blob/v2.1.2/docs/sources/project/building_from_source.md) 28 | with just a few modifications. 29 | 30 | ```bash 31 | cd 32 | #install gvm 33 | sudo apt-get install bison 34 | bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) 35 | source ~/.gvm/scripts/gvm 36 | gvm install go1.4.2 37 | gvm use go1.4.2 38 | #for go1.5 39 | GOROOT_BOOTSTRAP=~/.gvm/gos/go1.4.2 gvm install go1.5 40 | gvm use go1.5 41 | #install fpm which is used in build.go to create deb and rpm packages 42 | sudo apt-get install ruby-dev 43 | sudo gem install fpm 44 | #install rpm (for rpmbuild) since grafana build.go 45 | #build .deb and .rpm 46 | sudo apt-get install rpm 47 | ``` 48 | 49 | Then you need to install `nodejs` and `phantomjs` (1.9.8). See my other repo for that. 50 | Be careful to install your `phantomjs` binary before the `npm install` step: 51 | npm will try to install `phantomjs` if it doesn't find `phantomjs` version 1.9.8 52 | in your path; unfortunately, because of this [issue](https://github.com/Medium/phantomjs/issues/376), 53 | it will fail to install the right binary. 54 | 55 | Now, follow offical instructions up to the `grunt-cli` install: 56 | ```bash 57 | gvm use go1.5 58 | mkdir graf-build 59 | cd graf-build/ 60 | export GOPATH=$HOME/graf-build 61 | go get github.com/grafana/grafana # run for 8m30 62 | cd $GOPATH/src/github.com/grafana/grafana 63 | git checkout v2.1.2 64 | go run build.go setup # run for 35s 65 | $GOPATH/bin/godep restore # run for 70s 66 | npm install # run for 6m 67 | sudo npm install -g grunt-cli # <15s 68 | ``` 69 | 70 | Before building the packages: 71 | ```bash 72 | #disable time out for requirejs task 73 | sed -i 's/baseUrl: '\''.\/app'\'',/baseUrl: '\''.\/app'\'',waitSeconds: 0,/' tasks/options/requirejs.js 74 | #overwrite default phantomjs binary 75 | cp `which phantomjs` vendor/phantomjs/phantomjs 76 | #ensure it is stripped 77 | strip vendor/phantomjs/phantomjs 78 | ``` 79 | 80 | Finally: 81 | ```bash 82 | go run build.go build package # 21m 83 | ``` 84 | 85 | Packages are in `$GOPATH/src/github.com/grafana/grafana/dist`. 86 | 87 | ## Update 88 | Nodejs resumes its [official binaries](https://nodejs.org/dist/) for arm since 89 | v4.0.0. You should probably give it a try. 90 | 91 | ## See: 92 | - [fpm](https://github.com/jordansissel/fpm) 93 | - [grafana](https://github.com/grafana/grafana/blob/v2.1.2/docs/sources/project/building_from_source.md) 94 | - [gvm](https://github.com/moovweb/gvm) 95 | - nodejs [v0.12.7](https://github.com/fg2it/nodejs-on-raspberry/tree/master/0.12.7) for pi2 and [official binaries](https://nodejs.org/dist/) 96 | - [phantomjs](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/wheezy/2.0.1-development_as_1.9.8) pseudo v1.9.8 for pi2 (and pi3)/wheezy 97 | -------------------------------------------------------------------------------- /docker/v3.x/README.md: -------------------------------------------------------------------------------- 1 | # Unofficial Grafana Docker image for armhf 2 | 3 | > here v3.x stands for any of v3.0.[2-4], v3.1.0-beta1 or v3.1.[0-1] 4 | 5 | This project builds a Docker image with an unofficial grafana 6 | build for armhf available [here](https://github.com/fg2it/grafana-on-raspberry/releases/) and 7 | closely follow the [official docker 8 | image](https://github.com/grafana/grafana-docker). The base docker image is 9 | [resin/armv7hf-debian:jessie](https://hub.docker.com/r/resin/armv7hf-debian/) 10 | 11 | The container are available on [dockerhub](https://hub.docker.com/r/fg2it/grafana-armhf/). 12 | See [dockerhub](https://hub.docker.com/r/fg2it/grafana-armhf/tags) for available 13 | version. Alternately, you can just have a look at the `GRAFANA_META` file or use the registry api : 14 | ```bash 15 | curl -s -S https://registry.hub.docker.com/v2/repositories/fg2it/grafana-armhf/tags/ | python -m json.tool | grep name 16 | ``` 17 | 18 | For example, 19 | ```bash 20 | % curl -s -S https://registry.hub.docker.com/v2/repositories/fg2it/grafana-armhf/tags/ | python -m json.tool | grep name 21 | "name": "v3.1.1", 22 | "name": "v3.1.0", 23 | "name": "v3.0.4", 24 | "name": "v3.0.3", 25 | "name": "v3.0.2", 26 | % docker pull fg2it/grafana-armhf:v3.1.1 27 | ``` 28 | 29 | The following documentation is a mere adaptation of the [official 30 | one](https://github.com/grafana/grafana-docker/tree/aff14bd707682870b9d5f2f2b62d2eb09f734923). 31 | 32 | ## Caution 33 | It was tested on raspberry pi 2 and pi 3, and won't work on pi 1. 34 | 35 | ## Running your Grafana container 36 | 37 | Start your container binding the external port `3000`. 38 | 39 | ``` 40 | docker run -d --name=grafana -p 3000:3000 fg2it/grafana-armhf: 41 | ``` 42 | 43 | Try it out, default admin user is admin/admin. 44 | 45 | ## Configuring your Grafana container 46 | 47 | All options defined in conf/grafana.ini can be overridden using environment 48 | variables, for example: 49 | 50 | ``` 51 | docker run \ 52 | -d \ 53 | -p 3000:3000 \ 54 | --name=grafana \ 55 | -e "GF_SERVER_ROOT_URL=http://grafana.server.name" \ 56 | -e "GF_SECURITY_ADMIN_PASSWORD=secret" \ 57 | fg2it/grafana-armhf: 58 | ``` 59 | 60 | ## Grafana container with persistent storage (recommended) 61 | 62 | ``` 63 | # create /var/lib/grafana as persistent volume storage 64 | docker run -d -v /var/lib/grafana --name grafana-storage hypriot/armhf-busybox 65 | 66 | # start grafana 67 | docker run \ 68 | -d \ 69 | -p 3000:3000 \ 70 | --name=grafana \ 71 | --volumes-from grafana-storage \ 72 | fg2it/grafana-armhf: 73 | ``` 74 | 75 | ## Installing plugins for Grafana 3 76 | 77 | Pass the plugins you want installed to docker with the `GF_INSTALL_PLUGINS` environment variable as a comma seperated list. This will pass each plugin name to `grafana-cli plugins install ${plugin}`. 78 | 79 | ``` 80 | docker run \ 81 | -d \ 82 | -p 3000:3000 \ 83 | --name=grafana \ 84 | -e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource" \ 85 | fg2it/grafana-armhf: 86 | ``` 87 | 88 | ## Running specific version of Grafana 89 | 90 | ``` 91 | # specify right tag, e.g. v2.6.0 - see Docker Hub for available tags 92 | docker run \ 93 | -d \ 94 | -p 3000:3000 \ 95 | --name grafana \ 96 | fg2it/grafana-armhf:v2.6.0 97 | ``` 98 | 99 | ## Configuring AWS credentials for CloudWatch support 100 | 101 | ``` 102 | docker run \ 103 | -d \ 104 | -p 3000:3000 \ 105 | --name=grafana \ 106 | -e "GF_AWS_PROFILES=default" \ 107 | -e "GF_AWS_default_ACCESS_KEY_ID=YOUR_ACCESS_KEY" \ 108 | -e "GF_AWS_default_SECRET_ACCESS_KEY=YOUR_SECRET_KEY" \ 109 | -e "GF_AWS_default_REGION=us-east-1" \ 110 | fg2it/grafana-armhf: 111 | ``` 112 | 113 | You may also specify multiple profiles to `GF_AWS_PROFILES` (e.g. 114 | `GF_AWS_PROFILES=default another`). 115 | 116 | Supported variables: 117 | 118 | - `GF_AWS_${profile}_ACCESS_KEY_ID`: AWS access key ID (required). 119 | - `GF_AWS_${profile}_SECRET_ACCESS_KEY`: AWS secret access key (required). 120 | - `GF_AWS_${profile}_REGION`: AWS region (optional). 121 | 122 | 123 | ## See: 124 | - [Grafana 3.0 Stable Released](http://grafana.org/blog/2016/05/11/grafana-3-0-stable-released.html) on the official blog 125 | - [Unofficial Grafana deb](https://github.com/fg2it/grafana-on-raspberry/releases) 126 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.4" 4 | sudo: required 5 | services: 6 | - docker 7 | install: true 8 | 9 | before_script: 10 | - docker pull debian:stretch 11 | - ci/createImage.py 12 | 13 | script: 14 | - docker run --name build-armv6 fg2it/grafana-builder ./build.sh ${TRAVIS_TAG:+-r} armv6 15 | - docker run --name build-armv7 fg2it/grafana-builder ./build.sh ${TRAVIS_TAG:+-r} armv7 16 | - docker run --name build-arm64 fg2it/grafana-builder ./build.sh ${TRAVIS_TAG:+-r} arm64 17 | 18 | after_success: 19 | - docker cp build-armv6:/tmp/graf-build/src/github.com/grafana/grafana/dist/ armv6 20 | - export DEB6=`ls armv6/grafana*.deb` 21 | - export TARBALL6=`ls armv6/grafana*.tar.gz` 22 | - echo $DEB6 $TARBALL6 23 | - docker cp build-armv7:/tmp/graf-build/src/github.com/grafana/grafana/dist/ armv7 24 | - export DEB7=`ls armv7/grafana*.deb` 25 | - export TARBALL7=`ls armv7/grafana*.tar.gz` 26 | - echo $DEB7 $TARBALL7 27 | - docker cp build-arm64:/tmp/graf-build/src/github.com/grafana/grafana/dist/ arm64 28 | - export DEB64=`ls arm64/grafana*.deb` 29 | - export TARBALL64=`ls arm64/grafana*.tar.gz` 30 | - echo $DEB64 $TARBALL64 31 | - ./ci/createDescriptionFile.py 32 | - cat armv6.d 33 | - cat armv7.d 34 | - cat arm64.d 35 | 36 | deploy: 37 | - provider: releases 38 | api_key: 39 | secure: LjYT1dj3oDB7jy66jW+sbo7TIN6z7dlJPlDydH0lT3r+3ihoEXzbE1t14MtiIf4oBtiHhFFJwFP/B6SyhCz8eFZh+8ozIUI+5BI5tz0dQD/q7LVTncP/UFR+z718Ggt34J4/K2clYnoRf1xAIz/whriZSimg58yn+nCM8soRo1iFaZ4IMnVNbDV8oV2k4ePOSymn63orAqY441P6XzmguIgISYoxgr22nLfws1YSUmB9xAhgMXmrOUofDVVLZnXHDPyxzL6trTGL1n4FHTFqGjK932DUOV3g6BjA7twB7ewIG035zL7/VqEvTkC4TQv5ZC7q5L0y4ifUEcqq1cpgBbfuJvsklYtgnubKaoVqiO4BRXSW9gM1frGv6MVegQBwM2/QR9BKxxxT9w6XIyfnNWim28mfGr0wvblSL7tIx3v4bboIL/8R9OkDpqp9LL+WxtgHnWmd3FRonhMJtm4F88775QsrwOZZecJmk6xQIpMjv3NKeHJFJvCgNcDtVfcR8eNqAYkGgjLD5iOiy7MQpc75fq5usR6p9rEBI4+UAhrVv3aLgK7lA8RHLyCkOzkyBoBeevRGdPN5exyqTMk1KxtFZu+3BDdYFC1JAFyHccfXfJyflOglabMdL51uvkBcs6gXx0G6sTxAjE9H+hFu6JMzSMgROwLyznoi5Ycvu9s= 40 | file: 41 | - $DEB7 42 | - $TARBALL7 43 | - $DEB64 44 | - $TARBALL64 45 | skip_cleanup: true 46 | on: 47 | tags: true 48 | repo: fg2it/grafana-on-raspberry 49 | - provider: bintray 50 | file: armv6.d 51 | user: fg2it 52 | key: 53 | secure: "FteIGr9J9B93Etvy5PmuAx5cZpB5sCt1Bn7FXf75zcAtWUMQEUHwqc995XrAjPrnFZ9yWMF1kInmRIg8ejbLx0PuBWBhJU60FPwRPm+2M2WM8Shc98DXPIm6A+xKC06yt8rU6/nyYyKrJBEf0kPiOHjnXE4rgqZaLVA+UbfSEuCVclmylxecZYNDvjIVJpDQghp6fCUhMqUjwO9UICZfl9ZhRXBeeZloUhR0qwF9orEtjW8usE6PDWl136tqAqBMQOe06Qz+n9JKPqAKIzdLOrviDKr8uDxA/ZPucuAHYCScq3IuRNwgdzgOKOvlVVDW5+uObEWahKEQHs8e7zC4fKdscq5CsZhuY0rVV8G6UNW3Hj69OL7gefiQ5Bd88QoF0X2/CFPe+5GngehpbMnIAg8iH55pEC5v516w4zaij4lyUlcY/o9foSre8YJaD5UlkfsGCj5HJiOnPLCK6l1rtxVTbol4GYq8+w5kWQhfHzfTp4GzUZuQS12K32kynDt3EV0To3VPpbTxK4+Bdw5BnEo+gYaV9/ynM6BiCqlnNUWi42JzUwpC1MFiesVuEaZ/IgtXeZM9/vnp1WgKZDwqDNfvvv7l+DaLI4h+kx7cgSi6EQraxOLBMu/i76CAh6SXunHIKyIhIo1FbQJ8n2HohTZ6bD3jIbnJz/KEqNkeCyA=" 54 | skip_cleanup: true 55 | on: 56 | tags: true 57 | - provider: bintray 58 | file: armv7.d 59 | user: fg2it 60 | key: 61 | secure: "FteIGr9J9B93Etvy5PmuAx5cZpB5sCt1Bn7FXf75zcAtWUMQEUHwqc995XrAjPrnFZ9yWMF1kInmRIg8ejbLx0PuBWBhJU60FPwRPm+2M2WM8Shc98DXPIm6A+xKC06yt8rU6/nyYyKrJBEf0kPiOHjnXE4rgqZaLVA+UbfSEuCVclmylxecZYNDvjIVJpDQghp6fCUhMqUjwO9UICZfl9ZhRXBeeZloUhR0qwF9orEtjW8usE6PDWl136tqAqBMQOe06Qz+n9JKPqAKIzdLOrviDKr8uDxA/ZPucuAHYCScq3IuRNwgdzgOKOvlVVDW5+uObEWahKEQHs8e7zC4fKdscq5CsZhuY0rVV8G6UNW3Hj69OL7gefiQ5Bd88QoF0X2/CFPe+5GngehpbMnIAg8iH55pEC5v516w4zaij4lyUlcY/o9foSre8YJaD5UlkfsGCj5HJiOnPLCK6l1rtxVTbol4GYq8+w5kWQhfHzfTp4GzUZuQS12K32kynDt3EV0To3VPpbTxK4+Bdw5BnEo+gYaV9/ynM6BiCqlnNUWi42JzUwpC1MFiesVuEaZ/IgtXeZM9/vnp1WgKZDwqDNfvvv7l+DaLI4h+kx7cgSi6EQraxOLBMu/i76CAh6SXunHIKyIhIo1FbQJ8n2HohTZ6bD3jIbnJz/KEqNkeCyA=" 62 | skip_cleanup: true 63 | on: 64 | tags: true 65 | - provider: bintray 66 | file: arm64.d 67 | user: fg2it 68 | key: 69 | secure: "FteIGr9J9B93Etvy5PmuAx5cZpB5sCt1Bn7FXf75zcAtWUMQEUHwqc995XrAjPrnFZ9yWMF1kInmRIg8ejbLx0PuBWBhJU60FPwRPm+2M2WM8Shc98DXPIm6A+xKC06yt8rU6/nyYyKrJBEf0kPiOHjnXE4rgqZaLVA+UbfSEuCVclmylxecZYNDvjIVJpDQghp6fCUhMqUjwO9UICZfl9ZhRXBeeZloUhR0qwF9orEtjW8usE6PDWl136tqAqBMQOe06Qz+n9JKPqAKIzdLOrviDKr8uDxA/ZPucuAHYCScq3IuRNwgdzgOKOvlVVDW5+uObEWahKEQHs8e7zC4fKdscq5CsZhuY0rVV8G6UNW3Hj69OL7gefiQ5Bd88QoF0X2/CFPe+5GngehpbMnIAg8iH55pEC5v516w4zaij4lyUlcY/o9foSre8YJaD5UlkfsGCj5HJiOnPLCK6l1rtxVTbol4GYq8+w5kWQhfHzfTp4GzUZuQS12K32kynDt3EV0To3VPpbTxK4+Bdw5BnEo+gYaV9/ynM6BiCqlnNUWi42JzUwpC1MFiesVuEaZ/IgtXeZM9/vnp1WgKZDwqDNfvvv7l+DaLI4h+kx7cgSi6EQraxOLBMu/i76CAh6SXunHIKyIhIo1FbQJ8n2HohTZ6bD3jIbnJz/KEqNkeCyA=" 70 | skip_cleanup: true 71 | on: 72 | tags: true 73 | -------------------------------------------------------------------------------- /old-versions/wheezy-jessie/README.md: -------------------------------------------------------------------------------- 1 | # Grafana v3.1.1 release for raspberry pi 2 and 3/*wheezy and jessie* 2 | Build from tag [v3.1.1](https://github.com/grafana/grafana/tree/v3.1.1) with 3 | [this](https://github.com/fg2it/phantomjs-on-raspberry/releases/tag/v2.1.1-wheezy-jessie) 4 | `phantomjs` binary working on raspberry pi 2 (and 3) running raspbian/wheezy or jessie. 5 | 6 | `go` version was 1.5.2, `nodejs` was 5.10.1, `npm` was 3.8.3 and `phantomjs` 7 | was [2.1.1](https://github.com/ariya/phantomjs/tree/2.1.1). The build was done 8 | on a jessie based arm docker container, specifically 9 | [resin/armv7hf-debian:jessie](https://hub.docker.com/r/resin/armv7hf-debian/). 10 | 11 | ## Some Remarks 12 | - Have a look on what I wrote on [`go` and `nodejs`](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/jessie/v2.6.0#go) for building v2.6.0. This still holds. 13 | - Have a look on what I wrote on [`node-sass`](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/jessie/v3.x#node-sass) for buiding v3 beta. This is the reason for the choice of a jessie based distro in this build. Alternately, I could probably have follow what I did to build [grafana v3.1.1 on wheezy](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/wheezy/v3.1.1#workaround-for-a-c11-compliant-g) to get the needed c++11 compliant g++. 14 | - Since the PhantomJS binary used is now a proper v2.1.1, previous [trick](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/jessie/v2.6.0#patch-phantomjs) to patch the binary has no [reason](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/jessie/v2.6.0#phantomjsphantomjs-prebuild-npm-module) to be anymore. 15 | - Finally, you can read the [reason](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/jessie/v2.6.0#phantomjsphantomjs-prebuild-npm-module) for the manual install of PhantomJS. 16 | 17 | 18 | ## Instructions 19 | ### Install Dependencies 20 | ```bash 21 | sudo apt-get update 22 | sudo apt-get install curl git ca-certificates 23 | sudo apt-get install binutils gcc make libc-dev 24 | sudo apt-get install ruby ruby-dev # for fpm 25 | sudo apt-get install rpm # for rpmbuild, used indirectly by grafana (call to fpm) 26 | sudo apt-get install libfontconfig1 # for phantomjs v2.1.1 27 | sudo apt-get install python g++ # for node-sass 28 | ``` 29 | Install go 1.5.2 from hypriot : 30 | ```bash 31 | curl -L https://github.com/hypriot/golang-armbuilds/releases/download/v1.5.2/go1.5.2.linux-armv7.tar.gz | sudo tar -xz -C /usr/local 32 | export PATH=/usr/local/go/bin:$PATH 33 | ``` 34 | Install nodejs : 35 | ```bash 36 | curl -L https://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-armv7l.tar.xz | sudo tar -xJ --strip-components=1 -C /usr/local 37 | ``` 38 | Install fpm : 39 | ```bash 40 | gem install fpm 41 | ``` 42 | Finally, install your `phantomjs` binary. For example : 43 | ```bash 44 | curl -L https://github.com/fg2it/phantomjs-on-raspberry/releases/download/v2.1.1-wheezy-jessie/phantomjs_2.1.1_armhf.deb -o /tmp/phantomjs_2.1.1_armhf.deb 45 | sudo dpkg -i /tmp/phantomjs_2.1.1_armhf.deb 46 | ``` 47 | 48 | ### Build Grafana 49 | The good news is that now you just have to follow the official 50 | [instructions](https://github.com/grafana/grafana/blob/v3.0-beta5/docs/sources/project/building_from_source.md) 51 | with just a few modifications. 52 | ```bash 53 | export GOPATH=/tmp/graf-build 54 | mkdir -p $GOPATH 55 | cd $GOPATH 56 | go get github.com/grafana/grafana 57 | cd $GOPATH/src/github.com/grafana/grafana 58 | git checkout v3.1.1 59 | go run build.go setup 60 | $GOPATH/bin/godep restore 61 | npm install 62 | ``` 63 | 64 | Finally, 65 | ```bash 66 | go run build.go build package 67 | ``` 68 | The packages are in `./dist` 69 | 70 | ## Install 71 | You simply have to install the dependencies, download the .deb package and install it. 72 | ```bash 73 | sudo apt-get install adduser libfontconfig 74 | curl -L https://github.com/fg2it/grafana-on-raspberry/releases/download/v3.1.1-wheezy-jessie/grafana_3.1.1-1472506485_armhf.deb -o /tmp/grafana_3.1.1-1472506485_armhf.deb 75 | sudo dpkg -i /tmp/grafana_3.1.1-1472506485_armhf.deb 76 | ``` 77 | For additional help, see the [v3.1 official documentation](http://docs.grafana.org/v3.1/). 78 | 79 | ## See: 80 | - [fpm](https://github.com/jordansissel/fpm) 81 | - [go](http://blog.hypriot.com/post/how-to-compile-go-on-arm/) by hypriot 82 | - [grafana](https://github.com/grafana/grafana/blob/v3.1.1/docs/sources/project/building_from_source.md) 83 | - [nodejs](https://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-armv7l.tar.xz) official binaries 84 | - [phantomjs](https://github.com/fg2it/phantomjs-on-raspberry/releases/tag/v2.1.1-wheezy-jessie) for pi2 and pi3/wheezy and jessie 85 | -------------------------------------------------------------------------------- /docker/v4.x/build.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import argparse 3 | import collections 4 | import datetime 5 | import subprocess 6 | import sys 7 | import yaml 8 | 9 | release_def = 'stretch' 10 | deb_releases = ["jessie","stretch"] 11 | cfg_file = 'grafana.yaml' 12 | cfg = yaml.load( open(cfg_file ) ) 13 | 14 | 15 | def extract_def(h): 16 | if type(h) is list : 17 | tag_def = h[0] 18 | stamp_def = h[1] 19 | else: 20 | tag_def = h 21 | stamp_def = '' 22 | return tag_def, stamp_def 23 | 24 | def setup(git_tag,stamp,release, c_dict): 25 | if git_tag in c_dict and not stamp: 26 | stamp=c_dict[git_tag] 27 | 28 | docker_tag=git_tag.replace('-testing','') 29 | 30 | pkg_name=docker_tag[1:] 31 | if stamp and 'beta' in pkg_name: 32 | pkg_name=pkg_name.replace('beta',str(stamp)+'beta') 33 | elif stamp: 34 | pkg_name="{}-{}".format(pkg_name,stamp) 35 | 36 | if release != release_def : 37 | docker_tag="{}-{}".format(docker_tag,release) 38 | 39 | return docker_tag, pkg_name 40 | 41 | def build(git_tag,docker_tag,pkg_name,release): 42 | build_date = datetime.datetime.utcnow().isoformat('T')+'Z' 43 | vcs_ref = subprocess.getoutput('git rev-parse --short HEAD') 44 | subprocess.call( 45 | ["docker", "build", 46 | "--pull", 47 | "--build-arg", "RELEASE={}".format(release), 48 | "--build-arg", "REPO_TAG={}".format(git_tag), 49 | "--build-arg", "PKG_NAME={}".format(pkg_name), 50 | "--build-arg", "BUILD_DATE={}".format(build_date), 51 | "--build-arg", "VCS_REF={}".format(vcs_ref), 52 | "--tag", "fg2it/grafana-armhf:{}".format(docker_tag), 53 | "." 54 | ], 55 | stderr=subprocess.STDOUT, 56 | universal_newlines=True, 57 | bufsize=0 58 | ) 59 | 60 | def test(docker_tag): 61 | subprocess.call( 62 | ["docker", "run", "-ti", "--rm", 63 | "--name=testgrafana{}".format(docker_tag), 64 | "-p", "9999:3000", 65 | "fg2it/grafana-armhf:{}".format(docker_tag) 66 | ], 67 | stderr=subprocess.STDOUT, 68 | universal_newlines=True, 69 | bufsize=0, 70 | ) 71 | 72 | def push(docker_tag): 73 | subprocess.call(["docker", "login"], 74 | stderr=subprocess.STDOUT, 75 | universal_newlines=True, 76 | bufsize=0 77 | ) 78 | 79 | subprocess.call(["docker", "push", 80 | "fg2it/grafana-armhf:{}".format(docker_tag) 81 | ], 82 | stderr=subprocess.STDOUT, 83 | universal_newlines=True, 84 | bufsize=0 85 | ) 86 | 87 | 88 | if __name__ == "__main__" : 89 | cfg_dict = collections.OrderedDict( 90 | map(extract_def, cfg) 91 | ) 92 | tag_def, stamp_def = next(iter( cfg_dict.items() )) #extract_def(cfg[0]) 93 | 94 | parser = argparse.ArgumentParser(description="Build grafana docker images for armhf") 95 | parser.add_argument("-d", 96 | help="show default", 97 | action='store_true' 98 | ) 99 | parser.add_argument("-t", 100 | help="create & run docker container", 101 | action='store_true' 102 | ) 103 | parser.add_argument("-p", 104 | help="push images to dockerhub", 105 | action='store_true' 106 | ) 107 | parser.add_argument("-r", "--release", 108 | help="debian release to use for base image", 109 | default=release_def, 110 | choices=deb_releases 111 | ) 112 | parser.add_argument('git_tag', nargs='?', default=tag_def) 113 | parser.add_argument('timestamp', nargs='?', default=stamp_def) 114 | args = parser.parse_args() 115 | # print(args) 116 | # print(list(cfg_dict.keys())) 117 | if args.git_tag not in cfg_dict: 118 | print("\n** Warning: unknown gitub tag ({}) **\n".format(args.git_tag)) 119 | 120 | docker_tag, pkg_name = setup(args.git_tag, args.timestamp, args.release, cfg_dict) 121 | 122 | if args.d: 123 | print("""git tag : {} 124 | grafana : {} 125 | docker tag: {} 126 | dist : {}""".format(args.git_tag, 127 | pkg_name, 128 | docker_tag, 129 | args.release) 130 | ) 131 | sys.exit(0) 132 | 133 | if not (args.t or args.p or args.d): 134 | build(args.git_tag,docker_tag, pkg_name, args.release) 135 | if args.t: 136 | test(docker_tag) 137 | if args.p: 138 | push(docker_tag) 139 | -------------------------------------------------------------------------------- /old-versions/wheezy/v3.1.1/README.md: -------------------------------------------------------------------------------- 1 | # Grafana v3.1.1 release for raspberry pi 2 and 3/wheezy 2 | Build from tag [v3.1.1](https://github.com/grafana/grafana/tree/v3.1.1) with with 3 | [this](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/wheezy/2.0.1-development) 4 | `phantomjs` binary working on raspberry pi 2 running raspbian/wheezy. 5 | 6 | `go` version was 1.5.2, `nodejs` was 5.10.1, `npm` was 3.8.3 and `phantomjs` was 7 | 2.0.1-dev. 8 | 9 | The packages here can be expected to work on raspbian/jessie too, except for 10 | features relying on `PhantomJS`. (see [here](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/jessie/v3.x) for jessie) 11 | 12 | 13 | ## Do it yourself 14 | 15 | Since my previous build for wheezy, there have been some changes in and around grafana. 16 | These are rather easy to deal with on jessie, but for wheezy this requires a nasty workaround that should certainly be discouraged if you intend to keep your system in good shape. 17 | 18 | ### Phantomjs 19 | The expected version of Phantomjs by the npm module phantomjs-prebuild is now 2.1.1. 20 | Once your phantomjs binary have this version, no other changes are required for this part. 21 | So no additional step to finish the install of the npm module. 22 | 23 | ### node-sass 24 | This is the nasty part on wheezy. 25 | 26 | As stated in [Grafana 3.0 Beta Released blog post](http://grafana.org/blog/2016/03/31/grafana-3-0-beta-released.html) 27 | the UI moved from bootstrap to a custom sets of sass foundation. 28 | 29 | With this change, comes the use of 30 | [node-sass](https://github.com/sass/node-sass) npm module, which is a node 31 | binding to [libsass](https://github.com/sass/libsass). 32 | 33 | Unfortunately for your raspberry pi, no official binaries are available, which 34 | means your pi will have to build it itself. It takes some time but everything 35 | works flawlessly during the `npm install` step, provided you have `python` and 36 | `g++` installed. 37 | 38 | An hidden dependency for this build to succeed, is that your `g++` is c++11 39 | compliant. Not a problem on jessie, but it is on wheezy. So for wheezy, you will 40 | need to import `g++` from jessie. 41 | 42 | ## Instructions 43 | ### Workaround for a c++11 compliant g++ 44 | Once again, I don't advice to do this on a system you want to use. The best way is probably to do it inside a docker container (like I did, by the way). 45 | Add jessie to your sources 46 | ```bash 47 | sudo echo 'deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi' >> /etc/apt/sources.list 48 | ``` 49 | Set how sources should be used 50 | ```bash 51 | sudo cat << PREF > /etc/apt/preferences 52 | Package: * 53 | Pin: release n=wheezy 54 | Pin-Priority: 900 55 | Package: * 56 | Pin: release n=jessie 57 | Pin-Priority: 300 58 | Package: * 59 | Pin: release o=Raspbian 60 | Pin-Priority: -10 61 | PREF 62 | ``` 63 | 64 | ### Install dependencies from wheezy 65 | ```bash 66 | sudo apt-get update 67 | sudo apt-get install -t wheezy curl git ca-certificates 68 | sudo apt-get install -t wheezy rpm # for rpmbuild, used indirectly by grafana (call to fpm) 69 | sudo apt-get install -t wheezy libfontconfig1 libicu48 libjpeg8 libpng12-0 # for my phantomjs binary 70 | ``` 71 | 72 | ### Install dependencies from jessie 73 | ```bash 74 | sudo apt-get install -y -t jessie binutils gcc make libc-dev python g++ # for node-sass 75 | sudo apt-get install -y -t jessie ruby ruby-dev # for fpm 76 | ``` 77 | 78 | ### Install go 1.5.2 from hypriot 79 | ```bash 80 | curl -L https://github.com/hypriot/golang-armbuilds/releases/download/v1.5.2/go1.5.2.linux-armv7.tar.gz | sudo tar -xz -C /usr/local 81 | export PATH=/usr/local/go/bin:$PATH 82 | ``` 83 | 84 | ### Install nodejs 85 | ```bash 86 | curl -L https://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-armv7l.tar.xz | sudo tar -xJ --strip-components=1 -C /usr/local 87 | ``` 88 | 89 | ### Install fpm 90 | ```bash 91 | gem install fpm 92 | ``` 93 | 94 | ### Install Phantomjs 95 | ```bash 96 | curl -L https://github.com/fg2it/phantomjs-on-raspberry/raw/fe240a6831b943be813e01eef897045963cb54bc/wheezy/2.0.1-development/phantomjs_2.0.1-development_armhf.deb -o /tmp/phantomjs_2.0.1-development_armhf.deb 97 | sudo dpkg -i phantomjs_2.0.1-development_armhf.deb 98 | ``` 99 | Patch the binary to have pretend it is version 2.1.1 100 | ```bash 101 | export PHJSOFFSET=$(grep -aboF `phantomjs -v` `which phantomjs`|cut -d':' -f1) 102 | printf "2.1.1\00" | sudo dd of=`which phantomjs` obs=1 seek=${PHJSOFFSET} conv=notrunc 103 | ``` 104 | 105 | ### Build Grafana 106 | ```bash 107 | export GOPATH=/tmp/graf-build 108 | mkdir -p $GOPATH 109 | cd $GOPATH 110 | go get github.com/grafana/grafana 111 | cd $GOPATH/src/github.com/grafana/grafana 112 | git checkout v3.1.1 113 | go run build.go setup 114 | $GOPATH/bin/godep restore 115 | npm install 116 | go run build.go build package 117 | ``` 118 | The packages are in `./dist` 119 | 120 | 121 | ## Installing the package 122 | ```bash 123 | sudo apt-get install libfontconfig libicu48 libjpeg8 libpng12-0 124 | curl -o /tmp/grafana.deb -L https://github.com/fg2it/grafana-on-raspberry/releases/download/v3.1.1-wheezy/grafana_3.1.1-1472241752_armhf.deb 125 | sudo dpkg -i /tmp/grafana.deb 126 | ``` 127 | 128 | ## See: 129 | - [fpm](https://github.com/jordansissel/fpm) 130 | - [go](http://blog.hypriot.com/post/how-to-compile-go-on-arm/) by hypriot 131 | - [grafana](https://github.com/grafana/grafana/blob/v3.1.1/docs/sources/project/building_from_source.md) 132 | - [nodejs](https://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-armv7l.tar.xz) official binaries 133 | - [phantomjs](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/wheezy/2.0.1-development) for pi2 (and pi3)/wheezy 134 | -------------------------------------------------------------------------------- /old-versions/jessie/v3.x/README.md: -------------------------------------------------------------------------------- 1 | # Grafana v3.x release for raspberry pi 2 and 3/jessie 2 | > Here v3.x stands for any of [v3.0-beta5](https://github.com/grafana/grafana/tree/v3.0-beta5), 3 | [v3.0.2](https://github.com/grafana/grafana/tree/v3.0.2), 4 | [v3.0.3](https://github.com/grafana/grafana/tree/v3.0.3), 5 | [v3.0.4](https://github.com/grafana/grafana/tree/v3.0.4), 6 | [v3.1.0-beta1](https://github.com/grafana/grafana/tree/v3.1.0-beta1), 7 | [v3.1.0](https://github.com/grafana/grafana/tree/v3.1.0), 8 | [v3.1.1](https://github.com/grafana/grafana/tree/v3.1.1) 9 | 10 | > This note presents how I build v3.x. For download, see the 11 | >[release](https://github.com/fg2it/grafana-on-raspberry/releases) section. For install, see the [wiki](https://github.com/fg2it/grafana-on-raspberry/wiki). 12 | 13 | 14 | Build from the corresponding tag of [grafana](https://github.com/grafana/grafana) github repo with 15 | [this](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/jessie/b483dd673a1ca589ff10c5f73dfea1e43bfa3225) 16 | `phantomjs` binary working on raspberry pi 2 running raspbian/jessie. 17 | 18 | `go` version was 1.5.2, `nodejs` was 5.10.1, `npm` was 3.8.3 and `phantomjs` was 19 | some version between 2.0.0 and 2.1.0 release 20 | ([b483dd6](https://github.com/ariya/phantomjs/tree/b483dd673a1ca589ff10c5f73dfea1e43bfa3225)). 21 | 22 | ## Main problems to overcome 23 | Most of what I said for [v2.6.0](https://github.com/fg2it/grafana-on-raspberry/tree/master/old-versions/jessie/v2.6.0/README.md) 24 | still hold. But there are a few new things. 25 | 26 | ### Phantomjs 27 | The expected version of Phantomjs by the npm module phantomjs-prebuild is now 2.1.1. 28 | Once your phantomjs binary have this version, no other changes are required for this part. 29 | So no additional step to finish the install of the npm module. 30 | 31 | ### node-sass 32 | As stated in [Grafana 3.0 Beta Released blog post](http://grafana.org/blog/2016/03/31/grafana-3-0-beta-released.html) 33 | the UI moved from bootstrap to a custom sets of sass foundation. 34 | 35 | With this change, comes the use of 36 | [node-sass](https://github.com/sass/node-sass) npm module, which is a node 37 | binding to [libsass](https://github.com/sass/libsass). 38 | 39 | Unfortunately for your raspberry pi, no official binaries are available, which 40 | means your pi will have to build it itself. It takes some time but everything 41 | works flawlessly during the `npm install` step, provided you have `python` and 42 | `g++` installed. 43 | 44 | An hidden dependency for this build to succeed, is that your `g++` is c++11 45 | compliant. Not a problem on jessie, but it is on wheezy. So for wheezy, you will 46 | need to import `g++` from jessie. 47 | 48 | ## Instructions 49 | ### Install Dependencies 50 | ```bash 51 | sudo apt-get update 52 | sudo apt-get install curl git ca-certificates 53 | sudo apt-get install binutils gcc make libc-dev 54 | sudo apt-get install ruby ruby-dev # for fpm 55 | sudo apt-get install rpm # for rpmbuild, used indirectly by grafana (call to fpm) 56 | sudo apt-get install libfontconfig1 libicu52 libjpeg62-turbo libpng12-0 # for my phantomjs binary ! 57 | sudo apt-get install python g++ # for node-sass 58 | ``` 59 | Install go 1.5.2 from hypriot : 60 | ```bash 61 | curl -L https://github.com/hypriot/golang-armbuilds/releases/download/v1.5.2/go1.5.2.linux-armv7.tar.gz | sudo tar -xz -C /usr/local 62 | export PATH=/usr/local/go/bin:$PATH 63 | ``` 64 | Install nodejs : 65 | ```bash 66 | curl -L https://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-armv7l.tar.xz | sudo tar -xJ --strip-components=1 -C /usr/local 67 | ``` 68 | Install fpm : 69 | ```bash 70 | gem install fpm 71 | ``` 72 | Finally, install your `phantomjs` binary. For example : 73 | ```bash 74 | curl -L https://github.com/fg2it/phantomjs-on-raspberry/raw/fe240a6831b943be813e01eef897045963cb54bc/jessie/b483dd673a1ca589ff10c5f73dfea1e43bfa3225/phantomjs_2.0.0_armhf.deb -o /tmp/phantomjs_2.0.0_armhf.deb 75 | sudo dpkg -i /tmp/phantomjs_2.0.0_armhf.deb 76 | ``` 77 | 78 | ### Patch PhantomJS 79 | Here is a way to patch your PhantomJS binary: 80 | ```bash 81 | export PHJSOFFSET=$(grep -aboF `phantomjs -v` `which phantomjs`|cut -d':' -f1) 82 | printf "2.1.1\00" | sudo dd of=`which phantomjs` obs=1 seek=${PHJSOFFSET} conv=notrunc 83 | ``` 84 | Be aware, this is not a specially robust way for at least 2 reasons : 85 | - we expect to find only one match of the version string, and accordingly we use the offset of the first match. 86 | - we expect the original string to be at least as long as the new one. 87 | 88 | ### Build Grafana 89 | The good news is that now you just have to follow the official 90 | [instructions](https://github.com/grafana/grafana/blob/v3.0-beta5/docs/sources/project/building_from_source.md) 91 | with just a few modifications. 92 | ```bash 93 | export GOPATH=/tmp/graf-build 94 | mkdir -p $GOPATH 95 | cd $GOPATH 96 | go get github.com/grafana/grafana 97 | cd $GOPATH/src/github.com/grafana/grafana 98 | git checkout v3.0-beta5 #change v3.0-beta5 with the wanted v3.x tag 99 | go run build.go setup 100 | $GOPATH/bin/godep restore 101 | npm install 102 | ``` 103 | 104 | Finally, 105 | ```bash 106 | go run build.go build package 107 | ``` 108 | The packages are in `./dist` 109 | 110 | 111 | ## See: 112 | - [fpm](https://github.com/jordansissel/fpm) 113 | - [go](http://blog.hypriot.com/post/how-to-compile-go-on-arm/) by hypriot 114 | - grafana [v3.0-beta5](https://github.com/grafana/grafana/blob/v3.0-beta5/docs/sources/project/building_from_source.md) offical build instructions (they are the same for all v3.x tags) 115 | - [nodejs](https://nodejs.org/dist/v5.10.1/node-v5.10.1-linux-armv7l.tar.xz) official binaries 116 | - [phantomjs](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/jessie/b483dd673a1ca589ff10c5f73dfea1e43bfa3225) for pi2 (and pi3)/jessie 117 | -------------------------------------------------------------------------------- /docker/v4.x/README.md: -------------------------------------------------------------------------------- 1 | # Unofficial Grafana Docker image for armhf 2 | 3 | --- 4 | 5 | ## **Warning Notice: End of Life** 6 | 7 | Starting from [v5.2.0-beta1](https://github.com/grafana/grafana/releases/tag/v5.2.0-beta1) Grafana introduced [official support](https://grafana.com/grafana/download/5.2.0-beta1?platform=arm) for armv7 and arm64 linux platforms. Many thanks to them for that. 8 | 9 | As a consequence, this repo is no more needed and stops support starting from v5.2.0-beta1. 10 | 11 | If you are using unofficial builds from this repo, you are invited to upgrade to official builds. 12 | 13 | > Should you need armv6 build, you are invited to ask official support. 14 | 15 | --- 16 | 17 | > here v4.x stands for any of v4.0.0-beta[1-2], v4.0.[1-2], v4.1.0-beta1, v4.1.[0-2], v4.2.0-beta1, v4.2.0, v4.3.0-beta1, v4.3.[0-2], v4.4.[0-3], v4.5.0-beta1, v4.5.[0-2], v4.6.0-beta[1-3], v4.6.[0-3] 18 | > 19 | > ... and also v5.0.0-beta[1-5], v5.0.[0-4] and v5.1.xx 20 | 21 | This project builds a Docker image with an unofficial grafana 22 | build for armhf available [here](https://github.com/fg2it/grafana-on-raspberry/releases/) and 23 | closely follow the [official docker 24 | image](https://github.com/grafana/grafana-docker). The base docker image is 25 | [arm32v7/debian:stretch-slim](https://hub.docker.com/r/arm32v7/debian/) (was [resin/armv7hf-debian:jessie](https://hub.docker.com/r/resin/armv7hf-debian/) up to and including v5.0.3). 26 | 27 | The container are available on [dockerhub](https://hub.docker.com/r/fg2it/grafana-armhf/). 28 | See [dockerhub](https://hub.docker.com/r/fg2it/grafana-armhf/tags) for available 29 | version. Alternately, you can just have a look at the `grafana.yaml` file or use the registry api : 30 | 31 | ```bash 32 | curl -s -S https://registry.hub.docker.com/v2/repositories/fg2it/grafana-armhf/tags/ | python -m json.tool | grep 'name.*v5' 33 | ``` 34 | 35 | For example, 36 | 37 | ```bash 38 | % curl -s -S https://registry.hub.docker.com/v2/repositories/fg2it/grafana-armhf/tags/ | python -m json.tool | grep 'name.*v5' 39 | "name": "v5.0.3", 40 | "name": "v5.0.2", 41 | "name": "v5.0.1", 42 | "name": "v5.0.0", 43 | "name": "v5.0.0-beta5", 44 | "name": "v5.0.0-beta4", 45 | "name": "v5.0.0-beta3", 46 | "name": "v5.0.0-beta2", 47 | "name": "v5.0.0-beta1", 48 | % docker pull fg2it/grafana-armhf:v5.0.2 49 | ``` 50 | 51 | The following documentation is a mere adaptation of the [official 52 | one](https://github.com/grafana/grafana-docker/blob/61f378236434fca515248c4012bb1414cc77386c/README.md). 53 | 54 | ## Caution 55 | 56 | It was tested on raspberry pi 2 and pi 3, and won't work on pi 1. 57 | 58 | ## Running your Grafana container 59 | 60 | Start your container binding the external port `3000`. 61 | 62 | ```bash 63 | docker run -d --name=grafana -p 3000:3000 fg2it/grafana-armhf: 64 | ``` 65 | 66 | Try it out, default admin user is admin/admin. 67 | 68 | In case port 3000 is closed for external clients or there is no access 69 | to the browser - you may test it by issuing: 70 | 71 | ```bash 72 | curl -i localhost:3000/login 73 | ``` 74 | 75 | Make sure that you are getting "...200 OK" in response. 76 | After that continue testing by modifying your client request to grafana. 77 | 78 | ## Configuring your Grafana container 79 | 80 | All options defined in conf/grafana.ini can be overridden using environment 81 | variables by using the syntax `GF__`. For example: 82 | 83 | ```bash 84 | docker run \ 85 | -d \ 86 | -p 3000:3000 \ 87 | --name=grafana \ 88 | -e "GF_SERVER_ROOT_URL=http://grafana.server.name" \ 89 | -e "GF_SECURITY_ADMIN_PASSWORD=secret" \ 90 | fg2it/grafana-armhf: 91 | ``` 92 | 93 | You can use your own grafana.ini file by using environment variable `GF_PATHS_CONFIG`. 94 | 95 | More information in the grafana configuration [documentation](http://docs.grafana.org/installation/configuration/). 96 | 97 | ## Grafana container with persistent storage (recommended) 98 | 99 | ```bash 100 | # create a persistent volume for your data in /var/lib/grafana (database and plugins) 101 | docker volume create --name grafana-storage 102 | 103 | # start grafana 104 | docker run \ 105 | -d \ 106 | -p 3000:3000 \ 107 | --name=grafana \ 108 | -v grafana-storage:/var/lib/grafana \ 109 | fg2it/grafana-armhf: 110 | ``` 111 | Note: An unnamed volume will be created for you when you boot Grafana, 112 | using `docker volume create grafana-storage` just makes it easier to find 113 | by giving it a name. 114 | 115 | You need at least docker v1.9 for this. See the [data volume](https://docs.docker.com/engine/tutorials/dockervolumes/#/data-volumes) 116 | documentation on docker. 117 | 118 | ## Installing plugins for Grafana 119 | 120 | Pass the plugins you want installed to docker with the `GF_INSTALL_PLUGINS` environment variable as a comma separated list. This will pass each plugin name to `grafana-cli plugins install ${plugin}`. 121 | 122 | ```bash 123 | docker run \ 124 | -d \ 125 | -p 3000:3000 \ 126 | --name=grafana \ 127 | -e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource" \ 128 | fg2it/grafana-armhf: 129 | ``` 130 | 131 | ## Building a custom Grafana image with pre-installed plugins 132 | 133 | The `custom/` folder includes a `Dockerfile` that can be used to build a custom Grafana image. It accepts `GRAFANA_VERSION` and `GF_INSTALL_PLUGINS` as build arguments. 134 | 135 | Example of how to build and run: 136 | 137 | ```bash 138 | cd custom 139 | docker build -t grafana:v5.0.4-with-plugins \ 140 | --build-arg "GRAFANA_VERSION=v5.0.4" \ 141 | --build-arg "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource" . 142 | docker run \ 143 | -d \ 144 | -p 3000:3000 \ 145 | --name=grafana \ 146 | grafana:v5.0.4-with-plugins 147 | ``` 148 | 149 | ## Running specific version of Grafana 150 | 151 | ```bash 152 | # specify right tag, e.g. v2.6.0 - see Docker Hub for available tags 153 | docker run \ 154 | -d \ 155 | -p 3000:3000 \ 156 | --name grafana \ 157 | fg2it/grafana-armhf:v2.6.0 158 | ``` 159 | 160 | ## Configuring AWS credentials for CloudWatch support 161 | 162 | ```bash 163 | docker run \ 164 | -d \ 165 | -p 3000:3000 \ 166 | --name=grafana \ 167 | -e "GF_AWS_PROFILES=default" \ 168 | -e "GF_AWS_default_ACCESS_KEY_ID=YOUR_ACCESS_KEY" \ 169 | -e "GF_AWS_default_SECRET_ACCESS_KEY=YOUR_SECRET_KEY" \ 170 | -e "GF_AWS_default_REGION=us-east-1" \ 171 | fg2it/grafana-armhf: 172 | ``` 173 | 174 | You may also specify multiple profiles to `GF_AWS_PROFILES` (e.g. 175 | `GF_AWS_PROFILES=default another`). 176 | 177 | Supported variables: 178 | 179 | - `GF_AWS_${profile}_ACCESS_KEY_ID`: AWS access key ID (required). 180 | - `GF_AWS_${profile}_SECRET_ACCESS_KEY`: AWS secret access key (required). 181 | - `GF_AWS_${profile}_REGION`: AWS region (optional). 182 | 183 | ## See 184 | 185 | - [Unofficial Grafana deb](https://github.com/fg2it/grafana-on-raspberry/releases) 186 | -------------------------------------------------------------------------------- /old-versions/jessie/v2.6.0/README.md: -------------------------------------------------------------------------------- 1 | # Grafana v2.6.0 release for raspberry pi 2 and 3/jessie 2 | Build from tag [v2.6.0](https://github.com/grafana/grafana/tree/v2.6.0) with 3 | [this](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/jessie/b483dd673a1ca589ff10c5f73dfea1e43bfa3225) 4 | `phantomjs` binary working on raspberry pi 2 running raspbian/jessie. 5 | 6 | `go` version was 1.5.2, `nodejs` was 4.4.1, `npm` was 2.14.20 and `phantomjs` was 7 | some version between 2.0.0 and 2.1.0 release 8 | ([b483dd6](https://github.com/ariya/phantomjs/tree/b483dd673a1ca589ff10c5f73dfea1e43bfa3225)). 9 | 10 | The packages here can be expected to work on raspbian/wheezy too, except for 11 | features relying on `PhantomJS`. 12 | 13 | Should you follow the instructions below with the right binary for PhantomJS, 14 | you would end up with a fully functional build. 15 | 16 | 17 | ## Main problems to overcome 18 | ### go 19 | Not really a problem, it is more of a comment. You have two easy ways to get v1.5 : 20 | - First, the easy way with [gvm](https://github.com/moovweb/gvm). 21 | - Second, the very easy way with [hypriot](http://blog.hypriot.com/post/how-to-compile-go-on-arm/) 22 | unofficial tarball, which is what I did here. I am not too much in favor of 23 | unofficial build, but hypriot produces a nice and well establish work on arm, 24 | this is a leap of faith I can take. If you can't, hypriot fully explains how to 25 | produce the package yourself. It is a bit more tedious than the `gvm` way, but once 26 | you have the tarball, it is much more easy and efficient to install it. 27 | 28 | ### nodejs 29 | You need a recent version of `nodejs` (>=0.12.0 should be fine; 0.12.7 is). 30 | 31 | Careful here, `npm` (>=3.0.0) changed its way to layout modules and grafana 32 | build rely on this layout at least to find `phantomjs` binary to be included 33 | in the package (see [here](https://github.com/grafana/grafana/blob/v2.6.0/tasks/options/phantomjs.js) 34 | for gory details). 35 | The following instructions expect the npm v2 layout. You will need to adapt a 36 | few things in the following instructions and probably some grafana source files 37 | (see [here](https://github.com/grafana/grafana/blob/v3.0-beta1/tasks/options/phantomjs.js)). 38 | 39 | ### phantomjs 40 | You may want to have `phantomjs` since `grafana` relies on it for the feature 41 | creating png files from your graph. 42 | 43 | Moreover, having `phantomjs` allows a cleaner build since, otherwise, some tests run at packaging time 44 | will fail. You will have to modify the file `build.go` (look for the arg processing loop in main() and 45 | change `grunt("release")` to `grunt("--force","release")`) to ignore failures. 46 | 47 | Unfortunately, there are no official binary of phantomjs available for arm. 48 | 49 | ### phantomjs/phantomjs-prebuild npm module 50 | The problem for `phantomjs` is that the npm module `phantomjs` (later renamed 51 | `phantomjs-prebuilt`) won't succeed on arm. It tries to install official binaries 52 | which don't exist for arm. If you already have `phantomjs` installed, it checks 53 | its version string against some specific version. 54 | 55 | So, having a having `phantomjs` for your raspberry pi is not enough, it has to 56 | be the right version. Otherwise, the phantomjs npm module will reject it and 57 | fail. 58 | 59 | Depending on the grafana version you are trying to build and the npm version you 60 | are using, these issues take different flavors. The following general 61 | workaround seems to works in all the cases : 62 | - simply patch the `phantomjs` binary so it answers `phantomjs -v` accordingly 63 | to what expect the npm module, so the npm module accepts the binary and 64 | installs itself properly. 65 | - ensure the phantomjs/phantomjs-prebuild npm module install is right by hand. 66 | Previously, I suggested to let the npm module fails and "finalize" the install 67 | of this module by simply creating the missing `location.js` file with the 68 | right content (see previous version of this README file). Here I suggest to 69 | install the module by hand afterward. 70 | 71 | 72 | ## Instructions 73 | ### Install Dependencies 74 | ```bash 75 | sudo apt-get update 76 | sudo apt-get install curl git ca-certificates 77 | sudo apt-get install binutils gcc make libc-dev 78 | sudo apt-get install ruby ruby-dev # for fpm 79 | sudo apt-get install rpm # for rpmbuild, used indirectly by grafana (call to fpm) 80 | sudo apt-get install libfontconfig1 libicu52 libjpeg62-turbo libpng12-0 # for my phantomjs binary ! 81 | ``` 82 | Install go 1.5.2 from hypriot : 83 | ```bash 84 | curl -L https://github.com/hypriot/golang-armbuilds/releases/download/v1.5.2/go1.5.2.linux-armv7.tar.gz | tar -xz -C /usr/local 85 | export PATH=/usr/local/go/bin:$PATH 86 | ``` 87 | Install nodejs : 88 | ```bash 89 | cd /tmp 90 | curl -L https://nodejs.org/dist/v4.4.1/node-v4.4.1-linux-armv7l.tar.xz | tar xfJ - && \ 91 | mv -t /usr/local/bin node-v4.4.1-linux-armv7l/bin/* 92 | mv -t /usr/local/include node-v4.4.1-linux-armv7l/include/* 93 | mv -t /usr/local/lib node-v4.4.1-linux-armv7l/lib/* 94 | mv -t /usr/local/share node-v4.4.1-linux-armv7l/share/* 95 | ``` 96 | Install fpm : 97 | ```bash 98 | gem install fpm 99 | ``` 100 | Finally, install your `phantomjs` binary. For example : 101 | ```bash 102 | curl -L https://github.com/fg2it/phantomjs-on-raspberry/raw/fe240a6831b943be813e01eef897045963cb54bc/jessie/b483dd673a1ca589ff10c5f73dfea1e43bfa3225/phantomjs_2.0.0_armhf.deb -o /tmp/phantomjs_2.0.0_armhf.deb 103 | sudo dpkg -i /tmp/phantomjs_2.0.0_armhf.deb 104 | ``` 105 | 106 | ### Patch PhantomJS 107 | Here is a way to patch your PhantomJS binary: 108 | ```bash 109 | export PHJSOFFSET=$(grep -aboF `phantomjs -v` `which phantomjs`|cut -d':' -f1) 110 | printf "1.9.8\00" | sudo dd of=`which phantomjs` obs=1 seek=${PHJSOFFSET} conv=notrunc 111 | ``` 112 | Be aware, this is not a specially robust way for at least 2 reasons : 113 | - we expect to find only one match of the version string, and accordingly we use the offset of the first match. 114 | - we expect the original string to be at least as long as the new one. 115 | 116 | ### Build Grafana 117 | The good news is you mainly have to follow the official 118 | [instructions](https://github.com/grafana/grafana/blob/v2.6.0/docs/sources/project/building_from_source.md) 119 | with just a few modifications. 120 | ```bash 121 | export GOPATH=/tmp/graf-build 122 | mkdir -p $GOPATH 123 | cd $GOPATH 124 | go get github.com/grafana/grafana 125 | cd $GOPATH/src/github.com/grafana/grafana 126 | git checkout v2.6.0 127 | go run build.go setup 128 | $GOPATH/bin/godep restore 129 | npm install 130 | cd $GOPATH/src/github.com/grafana/grafana 131 | ``` 132 | 133 | Before building and packaging, ensure phantomjs npm module install is right 134 | ```bash 135 | cd `npm ls --parse phantomjs` 136 | node install.js 137 | ``` 138 | 139 | Finally, 140 | ```bash 141 | go run build.go build package 142 | ``` 143 | The packages are in `./dist` 144 | 145 | 146 | ## See: 147 | - [fpm](https://github.com/jordansissel/fpm) 148 | - [go](http://blog.hypriot.com/post/how-to-compile-go-on-arm/) by hypriot 149 | - [grafana](https://github.com/grafana/grafana/blob/v2.6.0/docs/sources/project/building_from_source.md) 150 | - [gvm](https://github.com/moovweb/gvm) 151 | - [nodejs](https://nodejs.org/dist/v4.4.1/node-v4.4.1-linux-armv7l.tar.xz) official binaries 152 | - [phantomjs](https://github.com/fg2it/phantomjs-on-raspberry/tree/fe240a6831b943be813e01eef897045963cb54bc/jessie/b483dd673a1ca589ff10c5f73dfea1e43bfa3225) for pi2 (and pi3)/jessie 153 | --------------------------------------------------------------------------------