Procfile best practices for Spring Boot application?

0

We are switching from Tomcat to Spring boot based deployment. So far everything seems to be working perfectly - with one minor issue: if we tell EBS to restart an Application Server it does restart the Process, but it does come back as if it has failed.

We are reading some env variables to properly configure the startup. That is why we have a script starting the application:

Procfile

web: chmod +x lem-webapp.sh; ./startup-webapp.sh

startup-webapp.sh

#!/bin/sh
exec /etc/alternatives/jre/bin/java $JAVA_OPTS -cp 'lib/*' --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED our.nice.Application
질문됨 2년 전1069회 조회
1개 답변
0

Hello there,

Here are some good practices for defining a Procfile for your application:

  • Put it in the root directory of your application source.

  • Use a Procfile for long-running application processes that shouldn't exit. Elastic Beanstalk monitors these processes and restarts any process that terminates.

  • All paths in the Procfile are relative to the root of the source bundle.

Example Procfile:

web: java -jar server.jar -Xms256m
cache: java -jar mycache.jar
web_foo: java -jar other.jar

In your case, you mention but it does come back as if it has failed, to better understand the issue, I would recommend you to check the logs on the instances. Elastic Beanstalk names the log files after the process and stores them in /var/log. For example, the web process in the preceding example generates logs named web-1.log and web-1.error.log for stdout and stderr, respectively.

Feel free to open a support case to AWS Premium Support if you want us to take a closer look into your logs file.

지원 엔지니어
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠