feat: 新增打包脚本
打包方式: 1、mvn clean package 2、将编译好的 jar 删除.jar 文件后缀后 和 build 中文件 放到同一目录 3、使用tar 命令打包,tar -zcvf olp_exporter.tar.gz ./* 安装: 1、执行 install.sh ,安装成功后会自动启动运行,并设置开机启动
This commit is contained in:
98
pom.xml
98
pom.xml
@@ -1,33 +1,34 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.3.3.RELEASE</version>
|
<version>2.3.3.RELEASE</version>
|
||||||
<relativePath/>
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.geedge</groupId>
|
<groupId>net.geedge</groupId>
|
||||||
<artifactId>olp_exporter</artifactId>
|
<artifactId>olp_exporter</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>olp_exporter</name>
|
<name>olp_exporter</name>
|
||||||
<description>olp_exporter</description>
|
<description>olp_exporter</description>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<java.version>8</java.version>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<java_source_version>1.8</java_source_version>
|
|
||||||
<java_target_version>1.8</java_target_version>
|
|
||||||
<file_encoding>UTF-8</file_encoding>
|
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<repositories>
|
<properties>
|
||||||
|
<java.version>8</java.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<java_source_version>1.8</java_source_version>
|
||||||
|
<java_target_version>1.8</java_target_version>
|
||||||
|
<file_encoding>UTF-8</file_encoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>aliyun</id>
|
<id>aliyun</id>
|
||||||
<name>Aliyun Central Repository</name>
|
<name>Aliyun Central Repository</name>
|
||||||
@@ -46,40 +47,50 @@
|
|||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!--prometheus依赖-->
|
<!--prometheus依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.micrometer</groupId>
|
<groupId>io.micrometer</groupId>
|
||||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>23.6-jre</version>
|
<version>23.6-jre</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**/application-*</exclude>
|
||||||
|
<exclude>/build/**</exclude>
|
||||||
|
</excludes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<executable>true</executable>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>
|
<exclude>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
@@ -87,8 +98,7 @@
|
|||||||
</exclude>
|
</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
@@ -1,3 +1,28 @@
|
|||||||
|
server:
|
||||||
|
port: 10095
|
||||||
|
servlet:
|
||||||
|
context-path: /
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
application:
|
||||||
active: dev
|
name: olp_exporter
|
||||||
|
|
||||||
|
management:
|
||||||
|
metrics:
|
||||||
|
binders:
|
||||||
|
jvm:
|
||||||
|
enabled: false
|
||||||
|
files:
|
||||||
|
enabled: false
|
||||||
|
integration:
|
||||||
|
enabled: false
|
||||||
|
logback:
|
||||||
|
enabled: false
|
||||||
|
processor:
|
||||||
|
enabled: false
|
||||||
|
uptime:
|
||||||
|
enabled: false
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
base-path: /
|
||||||
|
exposure:
|
||||||
|
include: [info,health,heapdump,threaddump,env,mappings,probePrometheus]
|
||||||
|
|||||||
8
src/main/resources/banner.txt
Normal file
8
src/main/resources/banner.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
_______ _ _______ _______ _______ _______ _______ _________ _______ _______
|
||||||
|
( ___ )( \ ( ____ ) ( ____ \|\ /|( ____ )( ___ )( ____ )\__ __/( ____ \( ____ )
|
||||||
|
| ( ) || ( | ( )| | ( \/( \ / )| ( )|| ( ) || ( )| ) ( | ( \/| ( )|
|
||||||
|
| | | || | | (____)| | (__ \ (_) / | (____)|| | | || (____)| | | | (__ | (____)|
|
||||||
|
| | | || | | _____) | __) ) _ ( | _____)| | | || __) | | | __) | __)
|
||||||
|
| | | || | | ( | ( / ( ) \ | ( | | | || (\ ( | | | ( | (\ (
|
||||||
|
| (___) || (____/\| ) | (____/\( / \ )| ) | (___) || ) \ \__ | | | (____/\| ) \ \__
|
||||||
|
(_______)(_______/|/ (_______/|/ \||/ (_______)|/ \__/ )_( (_______/|/ \__/
|
||||||
10
src/main/resources/build/README
Normal file
10
src/main/resources/build/README
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
################################## 1.INSTALL #######################################
|
||||||
|
#
|
||||||
|
# Execute install.sh script
|
||||||
|
# ./install.sh
|
||||||
|
#
|
||||||
|
################################## 2、CHECK ########################################
|
||||||
|
#
|
||||||
|
# Browser or CURL visit http://[IP]:10095/health ,response {"status":"UP"} is OK
|
||||||
|
#
|
||||||
|
|
||||||
26
src/main/resources/build/install.sh
Normal file
26
src/main/resources/build/install.sh
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
CUR_PATH=`pwd`
|
||||||
|
echo "install path: $CUR_PATH"
|
||||||
|
echo "install olp_exporter as a systemd service"
|
||||||
|
|
||||||
|
chmod +x $CUR_PATH/olp_exporter
|
||||||
|
cat > /etc/systemd/system/olp_exporter.service <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=olp_exporter
|
||||||
|
After=syslog.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=$CUR_PATH/olp_exporter
|
||||||
|
SuccessExitStatus=143
|
||||||
|
RestartSec=10s
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
systemctl daemon-reload
|
||||||
|
echo "systemctl start olp_exporter.service"
|
||||||
|
systemctl start olp_exporter.service
|
||||||
|
echo "Set the power-on start-up"
|
||||||
|
systemctl enable olp_exporter.service
|
||||||
|
echo "install done"
|
||||||
Reference in New Issue
Block a user