How to create play heroku procfile?

后端 未结 3 1497
夕颜
夕颜 2020-12-16 16:39

I am following the directions here

http://blog.heroku.com/archives/2011/8/29/play/

but I do play run and then git push heroku master

相关标签:
3条回答
  • 2020-12-16 16:54

    You need to create a file named Procfile in the root of your project and for Play it should contain

    web: play run --http.port=$PORT $PLAY_OPTS
    

    When you then deploy your application the $PORT and $PLAY_OPTS will be set by heroku when the application is started.

    0 讨论(0)
  • 2020-12-16 17:02
    1. Creating a Procfile is as simple as it sounds. Just create a file called Procfile and declare your process types and commands. More information is here: http://devcenter.heroku.com/articles/procfile In this case, you didn't provide a Procfile so Heroku just used the standard Play process. It's best practice to explitly provide a Procfile in case this default changes in the future.

    2. No, you are not reading that wrong. To upload a new version of your app you perform a git push to heroku.

    3. The $PORT variable is set internally by Heroku. No need to set it. The $PLAY_OPTS variable is set in your app space when you first push your Play app to Heroku. You can see it using the heroku command line. More information on that command line is here: http://devcenter.heroku.com/articles/heroku-command

    To view your app configuration:

    $ heroku config
    

    To change $PLAY_OPTS:

    $ heroku config:remove PLAY_OPTS
    $ heroku config:add PLAY_OPTS=...
    

    By default, heroku will run Play apps under the prod framework id. You can change this in your Procfile or in the $PLAY_OPTS variable. The only important thing here is that your app run in PROD mode on heroku (note that mode is different from framework id). Heroku cannot run Play apps in DEV mode.

    0 讨论(0)
  • 2020-12-16 17:16

    It will considerably depend on the play version you're using. I checked the docs and found the following Procfiles for each of the given versions:

    • 1.x

      web: play run --http.port=$PORT $PLAY_OPTS
      
    • 2.0

      web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS}
      
    • 2.2.0

      web: bin/<your-appname> -Dhttp.port=${PORT} ${JAVA_OPTS} -DapplyEvolutions.default=true
      
    • 2.2.1

      web: target/universal/stage/bin/<your-appname> -Dhttp.port=${PORT} -DapplyEvolutions.default=true
      

    For more information for the specific version check this URL:

    http://www.playframework.com/documentation/2.2.1/ProductionHeroku
    

    Make sure you replace 2.2.1 with whatever version you're using.

    0 讨论(0)
提交回复
热议问题