I have a bunch of Integrationtests on Travis, that I need to run after my Ruby on Rails app has been deployed to Heroku. How can I do that?
I tried to use the HTTP-POST-Method but Travis required custom headers and JSON body and Heroku does not support both. Is there another way?
Deploying App to Heroku It is important to note that the frontend and backend portions of our app will be deployed to Heroku as separate apps. Using my recently deployed project as an example, I will be referring to chatster-app-api , my Rails backend git repo, and chatster-app-frontend , my React frontend git repo.
To monitor your Release Phase processes as they execute, you can use the CLI command heroku ps -a YOUR_APP_NAME . as these are normal processes, you can use the ps:kill and ps:scale commands to stop the Release Phase from completing, which in turn, will prevent the latest release from completing.
To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.
I can think of couple of solutions, but none is perfect.
One: You can create simple app that will translate normal Heroku deploy hook into format acceptable by Travis. Of course you need to host it somewhere, but it is a great use case for Amazon Lambda or similar solution. If you ever wanted to try doing serverless I think you have a perfect case. And the cost of hosting will be almost nothing.
Two: You can use release phase on Heroku. Create a script bin/notify-travis
and this to your Procfile release: bin/notify-travis
. The problem is how to get all the information about deployed code like commit sha. For that you can enable lab feature called dyno-metadata
. It will inject additional config variables, one is HEROKU_SLUG_COMMIT
which contains commit sha. If more data are required, then this solution may not work. Make sure that bin/notify-travis
returns 0. It will run just before deployment. And if fails, your code won't be deployed.
Three: You can find or write custom buildpack that will send webhook to Travis. The problem is that it will run during build phase. In case of errors your code may not be deployed, but you will send a webhook. And also it can be problematic to get all required information about the build as in solution two.
So you have some options. I guess the first one is the best, but it may not fit your other requirements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With