Spring boot jar package deploys linux services

1. Because the project uses Maven, the following items need to be configured in pom.xml. The most important thing is executable, which means that it can be started directly by ./my-application.jar. Normally, if you don’t add this, you need java -jar my -application.jar

This is started, but because we want to make a service, we can't add the java command

 

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <executable>true</executable>
    </configuration>
</plugin>

 

2. Add soft links 

ln -s /var/myapp/app.jar /etc/init.d/app

 

3. Authorization can execute permissions

chmod u+x app.jar or chmod 777 /etc/init.d/app

 

4. If Unable to find Java appears in the startup service, you can create a conf file with the same name as the jar in the jar package directory. For example, the jar package name is app.jar, then the configuration file is app.conf. You can configure JAVA_HOME and other related configurations.

JAVA_HOME=/usr/local/jdk
JAVA_OPTS=-Xmx1024M
LOG_FOLDER=/custom/log

 

5. Security settings can refer to

Installing Spring Boot applications

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326554540&siteId=291194637