meumobi / AMS.Connect

1 stars 0 forks source link

Heroku: manage INT env #86

Closed vdias38 closed 5 years ago

danconte72 commented 6 years ago

Requirements:

vdias38 commented 6 years ago

Same codebase running as two separate Heroku apps – one staging and one production

Multiple remotes

I add integration remote env w/ $ git remote add staging git@heroku.com:enigmatic-spire-11550.git and rename heroku to production $ git remote rename heroku production

Then I can push to production with $ git push production master command.

Use your git config to specify a default app

By default, the heroku CLI creates projects with a heroku git remote (thus the normal git push heroku master). As we change our remote names we need to use --remote option of heroku CLI to define in which remote we are working. $ heroku config:set GITHUB_USERNAME=joesmith --remote staging To make things easier, you can use your git config (.git/config) to specify a default app. $ git config heroku.remote staging Now all heroku commands will default to the staging app.

Source: Heroku - multiple environments

My .git/config

[remote "production"]
        url = https://git.heroku.com/limitless-sea-32755.git
        fetch = +refs/heads/*:refs/remotes/production/*
[remote "staging"]
        url = https://git.heroku.com/enigmatic-spire-11550.git
        fetch = +refs/heads/*:refs/remotes/staging/*
[heroku]
        remote = staging