Heroku - push subtrees to different apps

偶尔善良 提交于 2021-02-07 09:29:29

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/44087837/heroku-push-subtrees-to-different-apps

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!