Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix systemd example configuration #42795

Closed
plnordquist opened this issue Oct 18, 2024 · 0 comments
Closed

Fix systemd example configuration #42795

plnordquist opened this issue Oct 18, 2024 · 0 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@plnordquist
Copy link

The sample systemd configuration in https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/deployment/installing.adoc does not work due to Systemd requirements on ExecStart. With the current sample, Systemd reports Neither a valid executable name nor an absolute path: ${JAVA_HOME}/bin/java. Systemd requires the first argument to be an absolute path to an executable or simple file name that will be resolved using a systemd compiled search path. I guess in newer versions of Systemd 250+ you can use ExecSearchPath to alter this path as well.

In my use case, I was replacing the old init.d launch script inserted at the start of the jar so I ended up with two changes to the documentation sample. First I ended up changing ExecStart to ExecStart=/path/to/java/home/bin/java -jar /var/myapp/myapp.jar. Second I had to add the working directory to the service section with WorkingDirectory=/var/myapp since the init.d script sets the working directory. The working directory is important if you are loading configuration from disk using yaml or properties files in a config directory under the app directory.

I'll also say that the ExecStop=/bin/kill -15 $MAINPID option duplicates functionality of Systemd since it sends the TERM signal to all processes in the cgroup and in fact it will receive two TERM signals since ExecStop is executed and then the KillMode and KillSignal settings default to sending TERM anyways.

Spring Boot Version:

3.2.10

Systemd Version (RHEL 8):

systemd 239 (239-82.el8_10.1)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 18, 2024
@mhalbritter mhalbritter self-assigned this Oct 21, 2024
@mhalbritter mhalbritter added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 21, 2024
@mhalbritter mhalbritter added this to the 3.2.x milestone Oct 21, 2024
@mhalbritter mhalbritter changed the title Systemd sample configuration is not valid Fix Systemd example configuration Oct 21, 2024
@mhalbritter mhalbritter changed the title Fix Systemd example configuration Fix systemd example configuration Oct 21, 2024
@mhalbritter mhalbritter modified the milestones: 3.2.x, 3.2.11 Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

3 participants