Skip to content

Instantly share code, notes, and snippets.

@sidward35
Created November 9, 2020 19:07
Show Gist options
  • Save sidward35/10d285223fe981573d755fe1c1338960 to your computer and use it in GitHub Desktop.
Save sidward35/10d285223fe981573d755fe1c1338960 to your computer and use it in GitHub Desktop.
Deploys a Grafana installation to Heroku (user input required for postgres setup)
#!/bin/bash
sudo apt-get install git postgresql
curl https://cli-assets.heroku.com/install.sh | sh
git clone https://github.com/eliperelman/heroku-grafana.git
cd heroku-grafana
heroku create
heroku buildpacks:add http://github.com/ryandotsmith/null-buildpack.git
heroku addons:create heroku-postgresql:hobby-dev
heroku config:get DATABASE_URL
# postgres://<user>:<password>@<host>/<dbname>
heroku config:set GF_DATABASE_TYPE=postgres
heroku config:set GF_DATABASE_HOST=<host>
heroku config:set GF_DATABASE_NAME=<dbname>
heroku config:set GF_DATABASE_USER=<user>
heroku config:set GF_DATABASE_PASSWORD=<password>
heroku config:set GF_DATABASE_SSL_MODE=require
heroku pg:psql --app <app-name> DATABASE_URL
\connect <dbname>
CREATE TABLE session (key CHAR(16) NOT NULL, data bytea, expiry INT NOT NULL, PRIMARY KEY (key));
\dt
\quit
git push heroku master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment