简体   繁体   中英

base grails 3.3.8 app demolishes heroku memory limit

I am trying to write a simple grails 3.3.8 app that I would like to deploy to heroku.

I started with a simple grails app:

$ grails create-app example

I then added a Procfile:

web: ./gradlew bootRun -Dgrails.server.port=$PORT

And a stage task to build.gradle :

task stage(dependsOn: assemble)

I figure that this app does nothing, and therefore should not stress a 512M heroku dyno, however:

2018-11-05T02:43:28.390592+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2018-11-05T02:43:32.587318+00:00 heroku[web.1]: Process running mem=729M(142.5%)
2018-11-05T02:43:32.587564+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2018-11-05T02:43:36.536505+00:00 app[web.1]: :buildProperties
2018-11-05T02:43:37.378484+00:00 app[web.1]: :processResources
2018-11-05T02:43:37.381277+00:00 app[web.1]: :classes
2018-11-05T02:43:37.403505+00:00 app[web.1]: :findMainClass
2018-11-05T02:43:37.519404+00:00 app[web.1]: :bootRunPicked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2018-11-05T02:43:54.618402+00:00 heroku[web.1]: Process running mem=1164M(227.5%)
2018-11-05T02:43:54.618533+00:00 heroku[web.1]: Error R15 (Memory quota vastly exceeded)
2018-11-05T02:43:54.618676+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-11-05T02:43:54.788397+00:00 heroku[web.1]: Process exited with status 137
2018-11-05T02:43:54.804734+00:00 heroku[web.1]: State changed from starting to crashed

bootRun is for running and developing locally. Its optimized for quick development, not for running in production.

To run in production you would normally run

./gradlew assemble
# Deploy build/libs/app.jar(or war) to your server
java -jar app.jar 

There are many more ways to run a spring-boot/grails apps, for example deploying to tomcat or other servlet containers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM