I am having trouble deploying a Rails4 app to Heroku with CircleCI.
Specifically, I get this in the deployment step.
$ heroku run rake db:migrate --app <APP_NAME>
Enter your Heroku credentials.
Email:
command heroku run rake db:migrate --app <APP_NAME> took more than 400 seconds since last output
I confirmed the project’s Heroku API Key and Current deploy user are correctly set to those of my heroku account.
Also, when I tried Rebuild with SSH, I logged in the CircleCI container and successfully executed heroku run.. itself, although I needed to login.
Any Ideas on what config else to check?
ADDED:
I checked other steps on CircleCI.
Install Heroku API credentials step shows nothing but it is green, so I think it was successful.
$ git push git@heroku.com:.. step shows the result like this, so I think it was also successful.
git push git@heroku.com:<APP_NAME>.git $CIRCLE_SHA1:refs/heads/master
Warning: Permanently added 'heroku.com,50.19.XX.XXX' (RSA) to the list of known hosts.
Everything up-to-date
I think there is a typo in the doc : “password $HEROKU_TOKEN” should be “password $HEROKU_PASSWORD” ?
Maybe you should add this “Add HEROKU_LOGIN and HEROKU_PASSWORD in your project > Build Settings > Environment variables” I did not find it quickly where was those build var
But no, it is not working, it still says “Enter your Heroku credentials.” when there is the step “heroku run rails db:migrate”, although I set HEROKU_EMAIL and HEROKU_PASSWORD build vars
As long as you match the variable names you set in the UI with the variable names in circle.yml, you’re good. Is it possible for you to paste the deployment section of your circle.yml?
heroku run rake db:migrate --app XXXX
! Error reading /home/ubuntu/.netrc
! unexpected EOF
! You may need to delete this file and run `heroku login` to recreate it.
heroku run rake db:migrate --app XXXX returned exit code 1
Action failed: heroku run rake db:migrate --app XXXX
I retried but the result didn’t change.
Here’s all that I did:
set Heroku API key on CircleCI account
set a deploy user on CircleCI project
add a new private key to SSH Permissions on CircleCI project
encrypt secret-env-plain into secret-env-cipher with openssl with the same key
HEROKU_TOKEN=...
HEROKU_EMAIL=...
push secret-env-cipher to the Bitbucket and run the CircleCI build
Do I need to add openssl aes-256-cbc -d -in secret-env-cipher -k $KEY >> ~/.circlerc to circle.yml? How can I define $KEY without including the actual key in the repo?