Grafana is an open source, feature rich metrics dashboard and graph editor for Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB.
Dokku is the smallest PaaS implementation you've ever seen - Docker powered mini-Heroku.
- A working Dokku host
- PostgreSQL plugin for Dokku
- Letsencrypt plugin for SSL (optionnal)
Note: We are going to use the domain grafana.example.com
for demonstration purposes. Make sure to
replace it to your domain name.
Log onto your Dokku Host to create the Grafana app:
dokku apps:create grafana
Install, create and link PostgreSQL plugin:
# Install postgres plugin on Dokku
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
# Create running plugin
dokku postgres:create grafana
# Link plugin to the main app
dokku postgres:link grafana grafana
# Show all enironement variables to copy content of DATABASE_URL variable
dokku config grafana
# Set GF_DATABASE_URL
dokku config:set grafana GF_DATABASE_URL='previously_copied_database_url'
# Set port to 5000
dokku config:set grafana GF_SERVER_HTTP_PORT=5000
dokku config:set grafana GF_SECURITY_SECRET_KEY=$(echo `openssl rand -base64 45` | tr -d \=+ | cut -c 1-32)
To get the routing working, we need to apply a few settings. First we set the domain.
dokku domains:set grafana grafana.example.com
First clone this repository onto your machine.
git clone git@github.com:d1ceward/grafana_on_dokku.git
git clone https://github.com/d1ceward/grafana_on_dokku.git
Now you need to set up your Dokku server as a remote.
git remote add dokku dokku@example.com:grafana
Now we can push Grafana to Dokku (before moving on to the next part).
git push dokku master
Last but not least, we can go an grab the SSL certificate from Let's Encrypt.
# Install letsencrypt plugin
dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
# Set certificate contact email
dokku letsencrypt:set grafana email you@example.com
# Generate certificate
dokku letsencrypt:enable grafana
In case of an error Challenge validation has failed
, please check your proxy settings:
dokku proxy:report # you should see http:80:5000
dokku proxy:ports-add grafana http:80:5000 # otherwise, add the proxy to the port
Your Grafana instance should now be available on https://grafana.example.com.
To add Grafana plugins, simply set the environment variable named GF_INSTALL_PLUGINS
:
dokku config:set grafana GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-github-datasource