How to deploy an rails app on heroku from travis-ci?

后端 未结 4 604
醉梦人生
醉梦人生 2020-12-13 01:22

There is any way to deploy a heroku rails app after a travis-ci success build?

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 01:45

    I had just been thinking of this kind of scenario, though I didn't specifically consider Heroku as the platform of choise. Anyhow, this is what I have come-up with:

    1. Pull requests go to "development" branch
    2. Travis test the pull request for you
    3. If we are about to deploy what's currently in "develop" - humans pull request, review and merge that into "release/candidate" branch
    4. Travis tests again once merged
    5. Once test on that branch passed - get Travis to create a pull request targeting "release/production" (perhaps write a wrapper for GitHub API for creating the actual pull request form Travis).
    6. Depending on whether we actually want to deploy or not quite yet - a human merges (into "release/production") or closes the pull request created from Travis
    7. Have either a deployer host or have each of the app hosts (if you have many and don't want to have an SPF) to track the "release/production" branch.

    I'm sure you could implement a Heroku app that will handle the role of being the deployer host or something even more crazy.

    Also, you may wish to try having Travis to notify you via IRC and have another IRC bot on your client side which will have access to you personal SSH key and make a push to Heroku, you could also implement a confirmation interface there by means of having a private conversation with your own bot or scripted GUI interface with a "Go ahead!" button. If you are not so old-school, you can use Hubot for that purpose.

    By the way, you could also introduce some sort of staging branch or whatever you like in between some of the above steps. You probably should also use tags and the rollback would just pushing a know working tag into "release/production" from where it'll be picked up by your deployer script.

提交回复
热议问题