heroku cheat sheet quick start

#note requires java 8. add the ppa repo for oracle and install this if you dont have it already. check your local with: java -version

#create auth token for subsequent commands
heroku login

#from within a local git cloned app root, to create a new dyno
heroku create

git push heroku master

#check if dyno is running
heroku ps:scale web=1

#shortcut to open the dyno. if you are running these in a remote SSH you will need to X11 forward for this to work
#or simply, just open the address indicated after you push
#this uri is also visible using the logs command below
heroku open

#tail logs for running dyno. refresh the browser while you are viewing the app to verify new log entries added
heroku logs --tail

#procfile declares what command is executed at start of app. this is likely web.
#for windows: this is different. see heroku docs and make Procfile.windows and use heroku -f Procfile.windows

#general note regarding the “free-ness” of heroku on your first app
“By default, your app is deployed on a free dyno. Free dynos will sleep after a half hour of inactivity and they can be active (receiving traffic) for no more than 18 hours a day before going to sleep. If a free dyno is sleeping, and it hasn’t exceeded the 18 hours, any web request will wake it. This causes a delay of a few seconds for the first request upon waking. Subsequent requests will perform normally”

#pom.xml specifies dependencies

#system.properties in the case of java determines version of java to use

#pull in dependencies to target/dependency and store this in pom.xml
mvn clean install

#to start heroku locally
heroku local web

#install add-ons
heroku addons:create papertrail

#list add-ons
heroku addons

#open add-on logs
heroku addons:open papertrail

#test a command on a one-off dyno, e.g. run bash in local dyno
heroku run bash

#set environment variables
heroku config:set ENERGY="20 GeV"

#view environment variables
heroku config

#show database info, e.g. postgres
heroku pg

#run tsql commands
heroku pg:psql



About Ronnie Diaz

Ronnie Diaz is an enterprise software engineer responsible for front-end and back-end development for companies in many industries. Heavily involved in cloud development, online retail, e-commerce and electronic ordering, fulfillment and customer relational systems.

Posted on November 9, 2015, in Programming & Development and tagged , , , , , , , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: