The MinnPost Dashboard is an internal tool for tracking and displaying metrics across the organization. It is based on the Dashing platform. The main feature added is the ability to periodically save metrics so that historical records can be kept.
gem install dashing
- Set environment variables (see below)
bundle install && bundle exec rake db:migrate
This project connects to many different services and has a number of configuration settings. These are managed with environment variables.
export DASHING_AUTH_TOKEN=your_token
export DASHING_OAUTH_DOMAIN=minnpost.com
export [email protected]
(See Google API keys above)export DASHING_GAPI_PRIVATE_KEY="<LONG_STRING>"
(See Google API keys above)export MAILCHIMP_API_KEY=your_api_key
To access Google Analytics, we must use the Google API. Some help about keys here.
- Go the Google API Console and create a new project.
- Enable Google Analytics
- Under API Access, click Create an OAuth 2.0 client ID
- Give it a product name
- Choose Service Account
- Download key
- Add the email address for the key to Google Analytics access
- Set environemtn variable for email:
export [email protected]
- Parse out OpenSSL cert using
irb
:Google::APIClient::KeyUtils.load_from_pkcs12('<PATH_TO_KEY>', 'notasecret').inspect
. This will output a multi-line key string. Set it as an environment variable and make sure to use double quotes:export DASHING_GAPI_PRIVATE_KEY="<LONG_KEY>"
dashing start
Deployable on Heroku, see these instructions.
Set configuration. See the settings above, and use the following format to set them on Heroku:
heroku config:set RACK_ENV=production
heroku config:set SETTING=value
heroku addons:add heroku-postgresql
- This does not seem right, but the app requires a
DATABASE_URL
which heroku should make on deploy, but this is not working, so manually do this. See your DB config withheroku config
, then:heroku config:add DATABASE_URL=the_string_from_the_other_config_value
heroku run bundle exec rake db:migrate
In order to keep the Heroku instance running so that the long form scheduled tasks can run, New Relic is used to ping the website often. This is hackish but allows to use Heroku.
heroku addons:add newrelic:standard
heroku config:add NEW_RELIC_APP_NAME=<YOUR_APP_NAME>
- Once data is available in the New Relic dashboard, go to Settings > Availability monitoring and set a ping.
Authentication is setup to use Google OAuth. Set up with these instructions.