0

Here is my procfile:

web: cd client && npm start
api: bundle exec rails s -p 3001

The web app works perfectly and runs on port 80 (see here: https://trucktrack-demo.herokuapp.com/) However I cannot seem to find the port that the rails api is running on. Any ideas on how to find this port (it is not 3001)?

Thanks in advance :-)

Menachem Hornbacher
  • 2,080
  • 2
  • 24
  • 36

1 Answers1

1

From the Heroku Procfile docs:

The web process type is special as it’s the only process type that will receive HTTP traffic from Heroku’s routers. Other process types can be named arbitrarily.

If you want to have multiple HTTP applications running, you’re going to have to accomplish that a different way, as you can’t have more than one HTTP process type in an app. One option would be to run a completely separate Heroku app for the other HTTP app.

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
  • Thanks Andrew, any idea how I would do that? – Menachem Hornbacher Oct 09 '17 at 13:56
  • Well you’ll have to make another Heroku app (the same way you created this one) and deploy your API to that separately. The front-end app and the API app, from Heroku’s perspective, will be completely separate. – Andrew Marshall Oct 09 '17 at 13:59
  • Thanks again Andrew, Can I do that even if all the code lives in the same repository (the root of the application is the server and the react app lives under /client)? – Menachem Hornbacher Oct 09 '17 at 14:00
  • It *should* be okay from a repo perspective, but I don’t know what restrictions Heroku may have there. You may have to do some atypical things to get that to work. I don’t think you’ll be able to have both apps under the same domain with Heroku, though. – Andrew Marshall Oct 09 '17 at 14:09
  • Thanks Andrew, Sorry but I am just not 100% clear on what you are proposing. I used herokus connect to github feature to deploy the app. do I have to move the client to manual deployments? – Menachem Hornbacher Oct 09 '17 at 14:10