john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

heroku continued custom domain new relic monitor ping keepalive

A Records require an IP Address so Heroku usually must use a CNAME (as an app may change IP addresses)
e.g. www.example.com -> myappname.herokuapp.com.

# this may take a few hours to propogate

heroku domains:add www.example.com

https://devcenter.heroku.com/articles/custom-domains

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NewRelic (monitoring and once an hour ping that keeps the app dyno happy)

(To use any addon you must verify your account https://devcenter.heroku.com/articles/account-verification)
(https://dashboard.heroku.com/account  , add credit card)

heroku addons:add newrelic        #
heroku addons:add newrelic:stark  # choose the free enhanced plan specifically , https://addons.heroku.com/newrelic#stark

heroku addons:open newrelic

THIS should open your web browser to a setup page, optionally just log in to new relic:
Applications -> Language (python) -> reveal your license key

# https://docs.newrelic.com/docs/python/python-agent-and-heroku

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sudo pip install --upgrade pip
sudo pip install --upgrade virtualenv
virtulenv venv
source venv/bin/activate
pip install Flask gunicorn newrelic

newrelic-admin generate-config 22b4fdcc14c128elicensekey newrelic.ini

head -n5 ./newrelic.ini
# This file configures the New Relic Python Agent.  (pure Python)

# Procfile needs to be updated with newrelic, e.g. from something simple like...   web: gunicorn hello:app
web: newrelic-admin run-program gunicorn -b "0.0.0.0:$PORT" -w 3 hello:app

git commit -a -m "add newrelic ini and Procfile"
git push

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
heroku ps
    === web (1X): `newrelic-admin run-program gunicorn -b "0.0.0.0:$PORT" -w 3 hello:app`
    web.1: up 2014/03/10 22:35:57 (~ 0s ago)

heroku run env | grep NEW_RELIC
    NEW_RELIC_LOG=stdout
    NEW_RELIC_LICENSE_KEY=22b4fdcc14c128elicensekey

heroku run newrelic-admin validate-config - stdout
# after running the validate-config test your WebUI to New Relic will allow you to see the dashboard

# heroku cli to override the new relic app name
# heroku config:set NEW_RELIC_APP_NAME='Web Site (Production)'

  • « Symlink symbolic link shortcut hard link
  • File to array line to array get property substring by equals »

Published

Mar 11, 2014

Category

python

~238 words

Tags

  • continued 26
  • custom 14
  • domain 7
  • heroku 4
  • keepalive 1
  • monitor 2
  • new 4
  • ping 3
  • python 180
  • relic 1