playframework/play-scala-angular-seed

deploy to heroku and/or create docker image

JiboStore opened this issue · 2 comments

Hi,

Since this application consist of 2 parts [backend/localhost:9000] and [frontend/localhost:4200] any idea how to deploy to heroku?

I tried deploying through git push, it is detected as play scala app, but npm is not recognized
I then try deploying using sbt-heroku plugin, but I get H10 error when I try to hit the app with my browser (HTTP: 503)

I am thinking to dockerize the app and push it through docker, but I am not sure how as there is now 2 endpoint..

Thanks for your input! Anyway, it is a great starting point app! I am new to angular and js here but your sample get me started real fast!

Thanks for the complements! Hope you went through my blog post which explains the whole build process.

To summarize [frontend/localhost:4200] is only used for development purposes to run the application on watch mode with sbt run command. On run mode frontend can access all [backend/localhost:9000] services via a reverse proxy within Angular CLI.

If you run a production build via sbt dist command, you can deploy the application with any port. Treat this as a normal play framework based project deployment, nothing changes in CI/CD integration or dockerizing. Refer play framework deployment guide for more information.

Note: Make sure that your build environment has NodeJs installed.

Good job @yohangz !
For all of you trying to deploy this project to Heroku like @JiboStore you should read this article. In addition to that article tutorial I had to change play framework secret and white-list host in application.conf and everything worked for me!