Joe R
Joe R

Reputation: 125

Deploy different apps (not different versions of the same app) to heroku using one github repository

I would like to host multiple apps: a UI app and backend / services app in one github repository and deploy each as a separate app to Heroku. Typically I create one github repo for each app. So in this case I would have a github repo for UI and another github repo for the svcs. Given that I follow the normal github / heroku deploy workflow.

Its certainly easier to create one repo for each deployable web app. But wanted to know if Has anyone done this?

Thanks in advance for any advice

Upvotes: 2

Views: 814

Answers (1)

Todd A. Jacobs
Todd A. Jacobs

Reputation: 84353

TL;DR

Heroku only runs whatever is stored in its master branch, and ignores all others. You'd be better off using separate repositories, or creating a super-project for local use and pushing individual git submodules to each Heroku app separately.

If you decide to ignore best practices...

You could potentially do this by pushing alternate branches to each Heroku app's master branch. For example, you could have a UI app in one branch, and an API app in another branch. Just change to whatever branch you want to push, and then:

heroku git:remote -a appname -r ui
heroku git:remote -a appname -r api

# push the ui branch to the ui remote's master branch
git checkout ui
git push ui ui:master

# push the api branch to the api remote's master branch
git checkout api
git push api api:master

You can find additional details here.

Upvotes: 1

Related Questions