Running heroku command after deploy fails

heroku
python
circle.yml

#1

I modified my circle.yml in order to run the migrations of my Django project after deploying. However, it seems the heroku toolbelt is not installed in the deployment server. I have already configured my api and ssh keys (like specified by https://circleci.com/docs/continuous-deployment-with-heroku/) but when I try to deploy I get:

 bash: line 1: heroku: command not found

heroku run python app/manage.py migrate --db-dry-run --app app-staging returned exit code 127

#2

Are you using the new Trusty image? Heroku is not installed by default there right now.


#3

I haven’t particularly configured Trusty as a build image. I was trying to see if there was some kind of settings in the Build Settings but all I could find was the new OSX option. Anyways, in order to get this working I tried installing the heroku toolbelt myself, but it’s not using the API as an auth method and keeps asking for credentials. Any tips?

Thanks!


#4

I got around this by switching the build image from Ubuntu 14.04 (Trusty) to 12.04 (Precise) (you can do that in the web UI). The 12.04 image appears to have heroku preinstalled.

It’s not clear if you can get access to an API key to login to heroku via the environment in CircleCI. You do get an ssh key in /home/ubuntu/.ssh/id_heroku.com, but that may not be enough to run heroku commands. It would be helpful to have these things (limitations of 14.04 image, how to get API keys / how to install the heroku toolbelt and login) documented in the CircleCI heroku docs.


#5

As of 12/18/16 the heroku command is now available on the 14.04 image, but it hangs indefinitely waiting for you to enter an email and password. I tested 12.04 and it seems to do the same thing. Is there a way to get this working?


#6