Wednesday, 5 December 2012

Notes on using Heroku

These are a few common things I find myself looking up when working with Heroku - I update this post if I find myself repeated searching for how to do the same tasks.

Running commands from a folder not linked to Heroku

Simply append --app APP_NAME to any relevant Heroku command:
HEROKU_COMMAND --app APP_NAME  

Deployment

If trying to push to Heroku:
 git push heroku master  
but get a publickey error:
 Permission denied (publickey).  
 fatal: The remote end hung up unexpectedly  
You need to add your public key to Heroku.
 heroku keys:add path_to_publickey  
If you don't have a public key, Heroku can prompt and generate one for you - simply use the command:
 heroku keys:add  

Resetting the application database

 heroku pg:reset DATABASE_URL  
To reset the database without a validation prompt, use:
 heroku pg:reset DATABASE_URL --confirm APP_NAME  

Rake

To run a rake task on Heroku, create the task in app/lib/tasks (Rails), test locally then deploy. To run, use:
 heroku run rake TASK_NAME


If you have any useful commands you regularly use while working with Heroku, let me know in the comments below!

No comments:

Post a Comment

Please leave a comment if you find this blog helpful or interesting! I'd love to hear from you!