Dpl: Feature Request: Run CLI commands for heroku app

Created on 9 Apr 2016  路  7Comments  路  Source: travis-ci/dpl

An option to execute commands like heroku run rake db:migrate etc. would be nice.

Ref: https://devcenter.heroku.com/articles/rake

Most helpful comment

Leaving this here if anyone come googling the same question. To run commands, you would add them like that:

dpl --provider=heroku --app=myapp --run='rake db:migrate' --api-key=$HEROKU_PRODUCTION_API_KEY

You can run multiple commands by repeating the --run flag multiple times

All 7 comments

@BanzaiMan Hi, I use dpl for GitLab CI. So for deployiung my code I use the following command
dpl --provider=heroku --app=samoza --api-key=$HEROKU_PRODUCTION_API_KEY

Is there any way I can use dpl for running rake commands or similar? The link you posted is for Travis-CI

Leaving this here if anyone come googling the same question. To run commands, you would add them like that:

dpl --provider=heroku --app=myapp --run='rake db:migrate' --api-key=$HEROKU_PRODUCTION_API_KEY

You can run multiple commands by repeating the --run flag multiple times

@louim i tried add 3 runs commands (--run='rake db:create' --run='rake db:migrate' --run='rake db:seed') and i got a error:

Running "rake db:create"
Running "rake db:migrate"
No stash found.
API request failed.
Message: Cannot run more than 1 Free size dynos.
Reference: https://devcenter.heroku.com/articles/dyno-size#default-scaling-limits
ERROR: Job failed: exit code 1

But if i run one command at time work's fine.

But anyway thanks a lot.

@crazyhalls Have you tried --run='rake db:create && rake db:migrate && rake db:seed'

@yashmehrotra

Running "rake db:create && rake db:migrate && rake db:seed"
No stash found.
API request failed.
Message: Cannot run one-off process at this time. Please try again later.
Reference:
ERROR: Job failed: exit code 1

didn't work either

- dpl --provider=heroku --app=koober-production --api-key=$HEROKU_PRODUCTION_API_KEY --run='python manage.py migrate && python manage.py create_initial_users'

This is how my script command in .gitlab-ci.yml file.

migrate and create_initial_users command is running fine but there is no output on the terminal.

How can I print the output for the command executed?

also, can I put each --run command in a new line? like in travis

deploy:
  provider: heroku
  api_key: ...
  run:
    - "python manage.py migrate"
    - "python manage.py create_initial_users"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

NeoLegends picture NeoLegends  路  8Comments

Sytten picture Sytten  路  4Comments

cotsog picture cotsog  路  8Comments

ruzicka picture ruzicka  路  4Comments

sandfox picture sandfox  路  8Comments