Search code examples
javaspring-bootweb-deploymentexecutable-jar

Recommended place/folder to put single jar server app for deployment?


I have a single jar server app (simple web portal) built with Spring Boot. I run it:

java -jar myapp.jar

Locally, the jar file is under my Eclipse project folder. Now it's ready to be deployed on a Linux server as a service. What folder should I create on the server to put the jar file? In that folder (working directory), I will be putting the application.yaml file plus some other config files. The service will run as root.


Solution

  • Create a directory under either /opt or /usr and have your jar run from there.

    If your app creates one log file, configure it for /var/log. If it's going to write a few create a directory /var/log/<your app>.