Spring Boot Application built with gradle doesn't complete starting

I’m trying to get a Spring Boot Application with Gradle running on koyeb.

I want to deploy this GitHub repo: GitHub - tschuehly/fullstack-with-spring: Demo repository for my talks focusing on server-side-rendering with Spring ViewComponent and HTMX

I’ve set the buildpack run command to ./gradlew bootRun and it tries to start but it doesn’t complete starting.

Here’s the log:

Instance allocated in nomad
Service mesh is propagated
Instance is starting
Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF-8
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :checkKotlinGradlePluginConfigurationErrors
> Task :compileKotlin UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :resolveMainClassName UP-TO-DATE
Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF-8

> Task :bootRun

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.2)

2024-03-02T18:01:58.180Z  INFO 94 --- [  restartedMain] d.t.f.SpringFullstackDemoApplicationKt   : Starting SpringFullstackDemoApplicationKt using Java 17.0.9 with PID 94 (/workspace/build/classes/kotlin/main started by koyeb in /workspace)
2024-03-02T18:01:58.196Z  INFO 94 --- [  restartedMain] d.t.f.SpringFullstackDemoApplicationKt   : No active profile set, falling back to 1 default profile: "default"
2024-03-02T18:01:58.456Z  INFO 94 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2024-03-02T18:01:58.460Z  INFO 94 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
Instance is stopping
The message received from the daemon indicates that the daemon has disappeared.
Build request sent: Build{id=d29216f4-1441-495e-88a0-5197e1a2ce7f, currentDir=/workspace}
Attempting to read last messages from the daemon log...
Daemon pid: 37
  log file: /layers/heroku_gradle/home/daemon/8.5/daemon-37.out.log
----- Last  20 lines from daemon log file - daemon-37.out.log -----
2024-03-02T18:01:32.354+0000 [INFO] [org.gradle.launcher.daemon.server.exec.LogToClient] The client will now receive all logging from the daemon (pid: 37). The daemon log file: /layers/heroku_gradle/home/daemon/8.5/daemon-37.out.log
2024-03-02T18:01:32.357+0000 [INFO] [org.gradle.launcher.daemon.server.exec.LogAndCheckHealth] Starting build in new daemon [memory: 494.9 MiB]
2024-03-02T18:01:32.367+0000 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has started executing the build.
2024-03-02T18:01:32.367+0000 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] Executing build with daemon context: DefaultDaemonContext[uid=c7fcfeae-063e-46a2-83c2-503d63990005,javaHome=/layers/heroku_jvm/openjdk,daemonRegistryDir=/layers/heroku_gradle/home/daemon,pid=37,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=384m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
2024-03-02T18:01:32.369+0000 [INFO] [org.gradle.launcher.daemon.server.exec.ForwardClientInput] Closing daemon's stdin at end of input.
2024-03-02T18:01:32.372+0000 [INFO] [org.gradle.launcher.daemon.server.exec.ForwardClientInput] The daemon will no longer process any standard input.
Picked up JAVA_TOOL_OPTIONS:  -Dfile.encoding=UTF-8

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.2)

2024-03-02T18:01:58.180Z  INFO 94 --- [  restartedMain] d.t.f.SpringFullstackDemoApplicationKt   : Starting SpringFullstackDemoApplicationKt using Java 17.0.9 with PID 94 (/workspace/build/classes/kotlin/main started by koyeb in /workspace)
2024-03-02T18:01:58.196Z  INFO 94 --- [  restartedMain] d.t.f.SpringFullstackDemoApplicationKt   : No active profile set, falling back to 1 default profile: "default"
2024-03-02T18:01:58.456Z  INFO 94 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2024-03-02T18:01:58.460Z  INFO 94 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
Instance terminated in nomad

It seems you need more memory or limit the JVM memory.

Your app is also listening on 8080 and not using the PORT environment variable so you’ll need to setup the traffic to be routed to 8080.

I managed to deploy your app by selecting a small instance and configuring the port to 8080: https://hurt-crystie-yann.koyeb.app/