Skip to content

Instantly share code, notes, and snippets.

@4knahs
Last active November 13, 2018 18:03
Show Gist options
  • Save 4knahs/921d5425116950461f66341cb8618374 to your computer and use it in GitHub Desktop.
Save 4knahs/921d5425116950461f66341cb8618374 to your computer and use it in GitHub Desktop.
Building grafana
# Install Go
sudo apt-get update
sudo apt-get install git golang-go
# Install nodejs & yarn
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install -y gcc g++ make nodejs
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
# Install npm dependencies
sudo npm install -g node-gyp
sudo npm install -g yarn
# Required for building the docker
sudo apt-get install rpm
# Install ruby (required for building docker)
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable
source /home/ubuntu/.rvm/scripts/rvm
rvm install 2.5
rvm use 2.5
# Install ruby dependencies
gem install fpm
# Fetch Grafana source (note breaks when using a fork cause of path grafana/grafana -> mosaicio/grafana, needs sed)
export GOPATH=`pwd`
go get github.com/grafana/grafana
cd $GOPATH/src/github.com/grafana/grafana
go run build.go setup
go run build.go build
# Build frontend assets
yarn install --pure-lockfile
# Build the frontend
go run build.go build-frontend
# Following assume ubuntu 18.04. Installs docker
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt-get update
sudo apt-cache policy docker-ce
sudo apt install docker-ce
sudo groupadd docker
sudo usermod -aG docker ubuntu # Requires logout for the docker permissions to work
# Finally build the docker
make build-docker-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment