2

I have a two-part app (a Phoenix API and a React front-end) that I want to deploy to Heroku... the back-end and front-end need to run on separate servers, but the current app structure is like so:

app/
  |
  + Phoenix/
  |
  + React/
  |
  + .git/

So both parts of the app are in the same git repo.

Within app/, I created two different Heroku apps - I'll call them phoenix-heroku-app and react-heroku-app. My plan is to use the git subtree method to push these apps up to Heroku, but I'm not sure how to specify where each should go.

When I run heroku apps, this correctly lists

phoenix-heroku-app
react-heroku-app

So they're both there... but when I use a command like

$ git subtree push --prefix Phoenix heroku master
$ git subtree push --prefix React heroku master

what is the syntax to point each of these pushes toward the correct app?

skwidbreth
  • 7,888
  • 11
  • 58
  • 105
  • 1
    Does http://stackoverflow.com/questions/32815483/heroku-how-do-you-push-to-specific-app-if-you-have-multiple-apps-in-heroku help at all? It looks from that like you could set up two different remotes, so instead of pushing to `heroku` you'd push to one remote for the Phoenix app and another for the React app. – bouteillebleu May 20 '17 at 22:25
  • 1
    @bouteillebleu great, thanks for pointing that out. I was able to use that tip to sort this out, see my answer below. – skwidbreth May 21 '17 at 17:14

1 Answers1

2

Following @bouteillebleu's suggestion, I was able to handle this like so...

First, I needed to add Heroku endpoints for the two apps in the parent directory -

$ git remote add phoenix-heroku-app https://git.heroku.com/phoenix-heroku-app.git
$ git remote add react-heroku-app https://git.heroku.com/react-heroku-app.git

Then I just needed to run

$ git subtree push --prefix Phoenix phoenix-heroku-app master
$ git subtree push --prefix React react-heroku-app master

and it was good to go.

skwidbreth
  • 7,888
  • 11
  • 58
  • 105