Monday, June 24, 2013

Heroku notes

Last week I found out about Heroku and from all I've read it looks awesome so I decided to upload and run an app on their cloud. After writing a quick app and testing it locally using foreman (Heroku toolbelt is great!), I tried to push it to Heroku but got stuck with something like Heroku error: "Permission denied (public key)". After digging on the web for a while I pieced some information together, most helpful was Giordano Scalzo's post here. In a nutshell the steps are:
  1. Create a new key just for Heroku:

    ssh-keygen -t rsa -C "email_address" -f ~/.ssh/id_rsa_heroku

  2. Add the new key to Heroku:

    heroku keys:add ~/.ssh/id_rsa_heroku.pub

  3. Set the HOME variable to the /user_home folder (I kept getting errors without doing this, I guess git was getting confused as to where the key was saved).

  4. Create a config file that indicates which key should be used, this worked for me:

    HostName heroku.com
    IdentityFile "%HOME%/.ssh/id_rsa_heroku"

The nice thing is that now I can switch the machine used for development and just follow steps 3 and 4 above for everything to work without issues. Using more than one machine with more than one Heroku account needs a little bit more work but since I am not doing this, I won't go into details.

My app doesn't respond to any http requests - more details about it later for now let's just say that it runs as a process that posts my Google Latitude location to ThingSpeak and to my Arduino (using Teleduino) - so there is no point in posting the app URL here but in any case, now that I was able to deploy and run my app, I can say that Heroku is indeed awesome!

No comments: