-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
heavyrian2012
committed
Oct 22, 2022
1 parent
813de44
commit cf0bf7e
Showing
9 changed files
with
199 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Package: app-server | ||
Version: [[version]] | ||
Section: misc | ||
Priority: optional | ||
Architecture: all | ||
Maintainer: Wildfirechat <[email protected]> | ||
Description: App Server | ||
Distribution: development | ||
Depends: openjdk-8-jre-headless | ||
Homepage: https://wildfirechat.cn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mv -f /usr/local/app-server/app-*.jar /usr/local/app-server/app-server.jar | ||
systemctl daemon-reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rm -rf /usr/local/app-server | ||
rm -rf /usr/lib/systemd/system/app-server.service | ||
systemctl daemon-reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
mvn clean package | ||
``` | ||
|
||
然后编译镜像 | ||
然后进入到docker目录编译镜像 | ||
``` | ||
sudo docker build -t wildfire_app . | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Linux Service 方式运行 | ||
除了命令行方式直接执行APP服务外,还可以以linux systemd service方式来运行,注意以这种方式运行,APP服务的配置还是需要按照常规方法来配置。 | ||
|
||
## 获取软件包 | ||
下载野火release或则会自己源码编译,得到Jar包```app-${version}.jar```。 | ||
|
||
## 部署软件包 | ||
创建```/usr/local/app-server```目录,把Jar包```app-${version}.jar```改名为```app-server.jar```;把config目录也拷贝到```/usr/local/app-server```目录下。 | ||
|
||
## 放置Server File | ||
把```app-server.service```放到```/usr/lib/systemd/system/```目录下。 | ||
|
||
## 管理服务 | ||
* 刷新配置,当安装或者更新后需要执行: ```sudo systemctl daemon-reload``` | ||
* 启动服务: ```sudo systemctl start app-server.service``` | ||
* 停止服务: ```sudo systemctl stop app-server.service``` | ||
* 重启服务: ```sudo systemctl restart app-server.service``` | ||
* 查看服务状态:```sudo systemctl status app-server.service``` | ||
* 设置开机自启动:```sudo systemctl enable app-server.service``` | ||
* 禁止开机自启动:```sudo systemctl disable app-server.service``` | ||
* 查看控制台日志: ```journalctl -f -u app-server.service``` | ||
|
||
## 日志 | ||
日志主要看制台日志。如果需要看日志,请使用命令```journalctl -f -u app-server.service```来查看日志。 | ||
|
||
## 配置 | ||
需要对APP服务配置来达到最好的执行效果,配置文件在````/usr/local/app-server/config````目录下。另外还可以设置服务的内存大小,修改```/usr/lib/systemd/system/app-server.service```文件,在java命令中添加```-Xmx```参数。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[Unit] | ||
Description=WildfirechatAPP | ||
Documentation=https://docs.wildfirechat.cn | ||
Wants=network-online.target | ||
After=network-online.target | ||
|
||
[Service] | ||
WorkingDirectory=/usr/local/app-server | ||
ExecStart=/usr/bin/java -server -jar app-server.jar 2>&1 | ||
|
||
# Let systemd restart this service always | ||
Restart=always | ||
RestartSec=5 | ||
|
||
# Specifies the maximum file descriptor number that can be opened by this process | ||
LimitNOFILE=65536 | ||
|
||
# Specifies the maximum number of threads this process can create | ||
TasksMax=infinity | ||
|
||
# Disable timeout logic and wait until process is stopped | ||
TimeoutStopSec=infinity | ||
SendSIGKILL=no | ||
|
||
[Install] | ||
WantedBy=multi-user.target |