✨ 客户端脚本支持自定义端口
This commit is contained in:
parent
c61585fd4d
commit
3e8a9ac74a
@ -59,14 +59,18 @@ pm2 start index.js --name easynode-server
|
|||||||
|
|
||||||
## 监控服务安装
|
## 监控服务安装
|
||||||
|
|
||||||
- 监控服务用于实时向服务端推送**系统、公网IP、CPU、内存、硬盘、网卡**等基础信息,不安装不影响使用面板,但是无法实时同步cpu占用、实时网速、硬盘容量等有用信息。
|
- 监控服务用于实时向服务端推送**系统、公网IP、CPU、内存、硬盘、网卡**等基础信息,不安装不影响使用面板,但是无法实时同步cpu占用、实时网速、硬盘容量等实用信息。
|
||||||
|
|
||||||
- 占用端口:**22022**
|
- 默认端口:**22022**
|
||||||
|
|
||||||
> 安装
|
> 安装
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
# 使用默认端口22022安装
|
||||||
curl -o- https://ghp.ci/https://raw.githubusercontent.com/chaos-zhu/easynode/main/client/easynode-client-install.sh | bash
|
curl -o- https://ghp.ci/https://raw.githubusercontent.com/chaos-zhu/easynode/main/client/easynode-client-install.sh | bash
|
||||||
|
|
||||||
|
# 使用自定义端口安装, 例如54321
|
||||||
|
curl -o- https://ghp.ci/https://raw.githubusercontent.com/chaos-zhu/easynode/main/client/easynode-client-install.sh | bash -s -- 54321
|
||||||
```
|
```
|
||||||
|
|
||||||
> 卸载
|
> 卸载
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
httpPort: 22022
|
defaultPort: 22022
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
const http = require('http')
|
const http = require('http')
|
||||||
const Koa = require('koa')
|
const Koa = require('koa')
|
||||||
const { httpPort } = require('./config')
|
const { defaultPort } = require('./config')
|
||||||
const wsOsInfo = require('./socket/monitor')
|
const wsOsInfo = require('./socket/monitor')
|
||||||
|
|
||||||
const httpServer = () => {
|
const httpServer = () => {
|
||||||
const app = new Koa()
|
const app = new Koa()
|
||||||
const server = http.createServer(app.callback())
|
const server = http.createServer(app.callback())
|
||||||
serverHandler(app, server)
|
serverHandler(app, server)
|
||||||
server.listen(httpPort, () => {
|
const port = process.env.CLIENT_PORT || defaultPort
|
||||||
console.log(`Server(http) is running on port:${ httpPort }`)
|
server.listen(port, () => {
|
||||||
|
console.log(`Server(http) is running on port:${ port }`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,13 +5,18 @@ if [ "$(id -u)" != "0" ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
clientPort=${clientPort:-22022}
|
||||||
SERVER_NAME=easynode-client
|
SERVER_NAME=easynode-client
|
||||||
FILE_PATH=/root/local/easynode-client
|
FILE_PATH=/root/local/easynode-client
|
||||||
SERVICE_PATH=/etc/systemd/system
|
SERVICE_PATH=/etc/systemd/system
|
||||||
CLIENT_VERSION=client-2024-08-17 # 目前监控客户端版本发布需手动更改为最新版本号
|
CLIENT_VERSION=client-2024-10-13 # 目前监控客户端版本发布需手动更改为最新版本号
|
||||||
SERVER_PROXY="https://ghp.ci/"
|
SERVER_PROXY="https://ghp.ci/"
|
||||||
|
|
||||||
echo "***********************开始安装EasyNode监控客户端端,当前版本号: ${CLIENT_VERSION}***********************"
|
if [ ! -z "$1" ]; then
|
||||||
|
clientPort=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "***********************开始安装EasyNode监控客户端端,当前版本号: ${CLIENT_VERSION}, 端口: ${clientPort}***********************"
|
||||||
|
|
||||||
systemctl status ${SERVER_NAME} > /dev/null 2>&1
|
systemctl status ${SERVER_NAME} > /dev/null 2>&1
|
||||||
if [ $? != 4 ]
|
if [ $? != 4 ]
|
||||||
@ -80,6 +85,8 @@ echo "***********************下载成功***********************"
|
|||||||
chmod +x ${FILE_PATH}/${SERVER_NAME}
|
chmod +x ${FILE_PATH}/${SERVER_NAME}
|
||||||
chmod 777 ${FILE_PATH}/${SERVER_NAME}.service
|
chmod 777 ${FILE_PATH}/${SERVER_NAME}.service
|
||||||
|
|
||||||
|
sed -i "s/clientPort=22022/clientPort=${clientPort}/g" ${FILE_PATH}/${SERVER_NAME}.service
|
||||||
|
|
||||||
# echo "***********************移动service&reload***********************"
|
# echo "***********************移动service&reload***********************"
|
||||||
mv ${FILE_PATH}/${SERVER_NAME}.service ${SERVICE_PATH}
|
mv ${FILE_PATH}/${SERVER_NAME}.service ${SERVICE_PATH}
|
||||||
|
|
||||||
@ -89,7 +96,6 @@ systemctl daemon-reload
|
|||||||
echo "***********************启动服务***********************"
|
echo "***********************启动服务***********************"
|
||||||
systemctl start ${SERVER_NAME}
|
systemctl start ${SERVER_NAME}
|
||||||
|
|
||||||
|
|
||||||
# echo "***********************设置开机启动***********************"
|
# echo "***********************设置开机启动***********************"
|
||||||
systemctl enable ${SERVER_NAME}
|
systemctl enable ${SERVER_NAME}
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=easynode client server port_22022
|
Description=easynode client server port_${clientPort}
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/root/local/easynode-client/easynode-client
|
ExecStart=/root/local/easynode-client/easynode-client
|
||||||
WorkingDirectory=/root/local/easynode-client
|
WorkingDirectory=/root/local/easynode-client
|
||||||
|
Environment="clientPort=${clientPort}"
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
<p>更新日志:<a class="link" href="https://github.com/chaos-zhu/easynode/blob/main/CHANGELOG.md" target="_blank">https://github.com/chaos-zhu/easynode/blob/main/CHANGELOG.md</a></p>
|
<p>更新日志:<a class="link" href="https://github.com/chaos-zhu/easynode/blob/main/CHANGELOG.md" target="_blank">https://github.com/chaos-zhu/easynode/blob/main/CHANGELOG.md</a></p>
|
||||||
<p>开源仓库: <a class="link" href="https://github.com/chaos-zhu/easynode" target="_blank">https://github.com/chaos-zhu/easynode</a></p>
|
<p>开源仓库: <a class="link" href="https://github.com/chaos-zhu/easynode" target="_blank">https://github.com/chaos-zhu/easynode</a></p>
|
||||||
<p>作者: <a class="link" href="https://github.com/chaos-zhu" target="_blank">chaoszhu</a></p>
|
<p>作者: <a class="link" href="https://github.com/chaos-zhu" target="_blank">chaoszhu</a></p>
|
||||||
<!-- <p>tg更新通知:<a class="link" href="https://t.me/easynode_notify" target="_blank">https://t.me/easynode_notify</a></p> -->
|
<p>tg更新通知:<a class="link" href="https://t.me/easynode_notify" target="_blank">https://t.me/easynode_notify</a></p>
|
||||||
<p>
|
<p>
|
||||||
打赏: EasyNode开源且无任何收费,如果您认为此项目帮到了您, 您可以请我喝杯阔乐(记得留个备注)~
|
打赏: EasyNode开源且无任何收费,如果您认为此项目帮到了您, 您可以请我喝杯阔乐(记得留个备注)~
|
||||||
</p>
|
</p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user