添加RPM打包方式

This commit is contained in:
heavyrian2012
2022-10-21 16:38:58 +08:00
parent 34bd59f195
commit c0840f3a73
5 changed files with 68 additions and 14 deletions
+2 -3
View File
@@ -91,11 +91,10 @@ PC客户端点[这里](https://github.com/wildfirechat/vue-pc-chat/releases)下
## 编译
在安装JDK1.8以上及maven的前提下,在命令行中执行```mvn clean package```,生成的目标文件在```./distribution/target/distribution-xxxx-bundle-tar.tar.gz```
> 由于使用了一个git的maven插件,如果本地没有git信息就会编译出错,请使用```git clone```的方法下载代码,或者下载压缩包解压后在根目录创建```.git```的空目录。建议用```git clone```的方式下载代码。
> 由于```distribution/pom.xml```中使用了生成RPM包的plugin,所以需要本地安装有rpm。如果不需要RPM包,可以删除掉```distribution/pom.xml```文件中的RPM plugin。
## 配置
解压```distribution-xxxx-bundle-tar.tar.gz```,修改解压出来的```config```目录下的```wildfirechat.conf```。修改如下部分:
1. 修改```server.ip```为您的服务器的公网IP,或者域名。如果用域名需要做好域名解析。
2. 可以阅读配置文件注释和文档,对其它配置项进行调整。
解压```distribution-xxxx-bundle-tar.tar.gz```,修改解压出来的```config```目录下的```wildfirechat.conf```,可以阅读配置文件注释和文档,对其它配置项进行调整。
## 运行
在程序目录运行如下命令:
+60 -8
View File
@@ -20,13 +20,6 @@
<artifactId>moquette-broker</artifactId>
<version>${project.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.vafer/jdeb -->
<dependency>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
<version>1.10</version>
<scope>compile</scope>
</dependency>
</dependencies>
@@ -128,7 +121,66 @@
</execution>
</executions>
</plugin>
<!-- 打包RPM 开始-->
<!-- 打包RPM 包需要本地有rpm命令才可以,linux和mac都可以安装rpm。如果是windows需要cygwin安装rpm才可以,如果不需要rpm包,可以把这个plugin注释掉-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.2.0</version>
<executions>
<execution>
<id>generate-rpm</id>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<group>Applications/Chat</group>
<name>wildfirechat</name>
<packager>Wildfirechat</packager>
<needarch>noarch</needarch>
<targetOS>linux</targetOS>
<prefix>/usr/local/wildfirechat/im</prefix>
<defineStatements>
<defineStatement>_unpackaged_files_terminate_build 0</defineStatement>
</defineStatements>
<copyTo>
target/wildfirechat-${project.version}.rpm
</copyTo>
<autoRequires>no</autoRequires>
<autoProvides>no</autoProvides>
<requires>
<require>java-1.8.0-openjdk-headless</require>
</requires>
<mappings>
<mapping>
<directory>/usr/local/wildfirechat/im</directory>
<filemode>755</filemode>
<sources>
<source>
<location>${project.build.directory}/distribution-${project.version}-bundle-tar.tar.gz</location>
</source>
</sources>
</mapping>
</mappings>
<postinstallScriptlet>
<script>
echo "Unzip packages..." ; cd /usr/local/wildfirechat/im ; tar -xzvf distribution*.tar.gz ; echo "Wildfire im installed in /usr/local/wildfirechat/im"
</script>
</postinstallScriptlet>
<postremoveScriptlet>
<script>
echo "Remove files..." ; cd /usr/local/wildfirechat/im ; rm -rf *
</script>
</postremoveScriptlet>
</configuration>
</plugin>
<!-- 打包RPM 结束-->
</plugins>
</build>
</project>
@@ -6,4 +6,5 @@ Architecture: all
Maintainer: Wildfirechat <[email protected]>
Description: Wildfirechat IM Server
Distribution: development
Depends: openjdk-8-jre-headless
Homepage: https://wildfirechat.cn
+2 -2
View File
@@ -4,10 +4,10 @@
<!--monitorInterval="30" :间隔秒数,自动检测配置文件的变更和重新配置本身-->
<configuration status="WARN" monitorInterval="60">
<Properties>
<!--自定义一些常量,之后使用${变量名}引用-->
<!-- 日志路径-->
<Property name="MSG_LOG_HOME">./logs</Property>
<!-- <Property name="MSG_LOG_HOME">/var/log/wildfirechat/im/logs</Property>-->
<property name="charset">UTF-8</property>
<!--自定义的输出格式-->
<property name="pattern">%d %-5p [%t] %C{2} (%F:%L) - %m%n</property>
</Properties>
<!--appenders:定义输出内容,输出格式,输出方式,日志保存策略等,常用其下三种标签[console,File,RollingFile]-->
+3 -1
View File
@@ -15,10 +15,12 @@
* 启动: ```sudo systemctl start wildfire-im.service```
* 停止: ```sudo systemctl stop wildfire-im.service```
* 重启: ```sudo systemctl restart wildfire-im.service```
* 查看控制台日志: ```journalctl -f -u wildfire-im.service```
* 查看控制台日志: ```sudo journalctl -f -u wildfire-im.service```
## 日志
日志文件在```/usr/local/wildfirechat/im/logs```目录下。如果需要提供日志给野火官方,请把这个目录下的日志和制台日志(```journalctl -f -u wildfire-im.service```)一起发给野火。
也可以把日志放到```/var/log/wildfirechat/im```目录下,可以修改```/usr/local/wildfirechat/im/config/log4j2.xml```修改日志的路径。
## 配置
需要对IM服务配置来达到最好的执行效果,配置文件在````/usr/local/wildfirechat/im/config````目录下。另外还可以设置服务的内存大小,修改```/usr/local/wildfirechat/im/bin/wildfirechat.sh```文件的倒数3、4行。打开Xmx和Xms配置,设置为合适的内存大小。