Skip to content

Commit 9f5d912

Browse files
committed
feat: auto update shell
feat: change client dist dir feat: chat emoji feat: custom websocket host feat: update icon feat: update layui.js fix: socket id equel 0 error
1 parent a5ae9d9 commit 9f5d912

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+700
-56
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/bin/bash
2+
#########################
3+
# 提供一键部署http服务环境的脚本
4+
# 包含api服务,socket服务
5+
# @auther: iamtsm
6+
# @version: v1.0.0
7+
#########################
8+
9+
# Function to install Node.js 16
10+
install_node() {
11+
echo "======>Node.js is not installed. Installing Node.js 16..."
12+
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
13+
sudo yum install -y nodejs
14+
echo "======>Node.js 16 installed"
15+
}
16+
17+
# Function to install pm2 globally
18+
install_pm2() {
19+
echo "======>pm2 is not installed. Installing pm2 globally..."
20+
sudo npm install -g pm2
21+
echo "======>pm2 installed"
22+
}
23+
24+
# Function to install lsof
25+
install_lsof() {
26+
echo "======>lsof is not installed. Installing lsof..."
27+
sudo yum install -y lsof
28+
echo "======>lsof installed"
29+
}
30+
31+
# Wait for a command to become available
32+
wait_for_command() {
33+
command="$1"
34+
while ! command -v $command &> /dev/null; do
35+
sleep 1
36+
done
37+
}
38+
39+
# Step 1: Check if sudo is installed and install if not
40+
if ! command -v sudo &> /dev/null; then
41+
echo "======>sudo is not installed. Installing sudo..."
42+
yum install -y sudo
43+
fi
44+
45+
# Step 2: Check if curl is installed
46+
if ! command -v curl &> /dev/null; then
47+
echo "======>curl is not installed. Installing curl..."
48+
sudo yum install -y curl
49+
fi
50+
51+
# Step 3: Check if Node.js is installed and install Node.js 16 if not
52+
if ! command -v node &> /dev/null; then
53+
install_node
54+
else
55+
echo "======>Node.js is already installed"
56+
fi
57+
58+
# Wait for Node.js to be installed
59+
wait_for_command node
60+
61+
# Step 4: Output Node.js and npm versions
62+
node_version=$(node -v)
63+
npm_version=$(npm -v)
64+
echo "======>Node.js version: $node_version"
65+
echo "======>npm version: $npm_version"
66+
67+
# Step 5: Check if pm2 is installed and install it globally if not
68+
if ! command -v pm2 &> /dev/null; then
69+
install_pm2
70+
else
71+
echo "======>pm2 is already installed"
72+
fi
73+
74+
# Wait for pm2 to be installed
75+
wait_for_command pm2
76+
77+
# Step 6: Check if lsof is installed and install if not
78+
if ! command -v lsof &> /dev/null; then
79+
install_lsof
80+
else
81+
echo "======>lsof is already installed"
82+
fi
83+
84+
# Step 7: Check if ports 9092 and 8444 are occupied
85+
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
86+
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
87+
88+
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
89+
echo "======>Port 9092 or 8444 is already in use."
90+
exit 1
91+
fi
92+
93+
# Step 8: install npm packages
94+
echo "Ready to install npm packages"
95+
cd ../../svr/
96+
rm package-lock.json
97+
npm install --registry=https://registry.npmmirror.com
98+
99+
# Step 9: Run start-http.sh script to start the service
100+
echo "Ready to run auto-start-http.sh"
101+
sleep 1
102+
/bin/bash ./../bin/ubuntu16/auto-start-http.sh
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/bin/bash
2+
#########################
3+
# 提供一键部署https服务环境的脚本
4+
# 包含api服务,socket服务
5+
# @auther: iamtsm
6+
# @version: v1.0.0
7+
#########################
8+
9+
# Function to install Node.js 16
10+
install_node() {
11+
echo "======>Node.js is not installed. Installing Node.js 16..."
12+
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
13+
sudo yum install -y nodejs
14+
echo "======>Node.js 16 installed"
15+
}
16+
17+
# Function to install pm2 globally
18+
install_pm2() {
19+
echo "======>pm2 is not installed. Installing pm2 globally..."
20+
sudo npm install -g pm2
21+
echo "======>pm2 installed"
22+
}
23+
24+
# Function to install lsof
25+
install_lsof() {
26+
echo "======>lsof is not installed. Installing lsof..."
27+
sudo yum install -y lsof
28+
echo "======>lsof installed"
29+
}
30+
31+
# Wait for a command to become available
32+
wait_for_command() {
33+
command="$1"
34+
while ! command -v $command &> /dev/null; do
35+
sleep 1
36+
done
37+
}
38+
39+
# Step 1: Check if sudo is installed and install if not
40+
if ! command -v sudo &> /dev/null; then
41+
echo "======>sudo is not installed. Installing sudo..."
42+
yum install -y sudo
43+
fi
44+
45+
# Step 2: Check if curl is installed
46+
if ! command -v curl &> /dev/null; then
47+
echo "======>curl is not installed. Installing curl..."
48+
sudo yum install -y curl
49+
fi
50+
51+
# Step 3: Check if Node.js is installed and install Node.js 16 if not
52+
if ! command -v node &> /dev/null; then
53+
install_node
54+
else
55+
echo "======>Node.js is already installed"
56+
fi
57+
58+
# Wait for Node.js to be installed
59+
wait_for_command node
60+
61+
# Step 4: Output Node.js and npm versions
62+
node_version=$(node -v)
63+
npm_version=$(npm -v)
64+
echo "======>Node.js version: $node_version"
65+
echo "======>npm version: $npm_version"
66+
67+
# Step 5: Check if pm2 is installed and install it globally if not
68+
if ! command -v pm2 &> /dev/null; then
69+
install_pm2
70+
else
71+
echo "======>pm2 is already installed"
72+
fi
73+
74+
# Wait for pm2 to be installed
75+
wait_for_command pm2
76+
77+
# Step 6: Check if lsof is installed and install if not
78+
if ! command -v lsof &> /dev/null; then
79+
install_lsof
80+
else
81+
echo "======>lsof is already installed"
82+
fi
83+
84+
# Step 7: Check if ports 9092 and 8444 are occupied
85+
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
86+
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
87+
88+
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
89+
echo "======>Port 9092 or 8444 is already in use."
90+
exit 1
91+
fi
92+
93+
# Step 8: install npm packages
94+
echo "Ready to install npm packages"
95+
cd ../../svr/
96+
rm package-lock.json
97+
npm install --registry=https://registry.npmmirror.com
98+
99+
# Step 9: Run start-https.sh script to start the service
100+
echo "Ready to run auto-start-https.sh"
101+
sleep 1
102+
/bin/bash ./../bin/ubuntu16/auto-start-https.sh

bin/centeros/auto-start-http.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
#########################
3+
# 提供pm2启动管理http服务的脚本
4+
# 包含api服务,socket服务
5+
# @auther: iamtsm
6+
# @version: v1.0.0
7+
#########################
8+
9+
pm2 start npm --name=tl-rtc-file-api -- run http-api
10+
11+
sleep 1
12+
13+
pm2 start npm --name=tl-rtc-file-socket -- run http-socket
14+
15+
sleep 1
16+
17+
npm run build:pro

bin/centeros/auto-start-https.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
#########################
3+
# 提供pm2启动管理https服务的脚本
4+
# 包含api服务,socket服务
5+
# @auther: iamtsm
6+
# @version: v1.0.0
7+
#########################
8+
9+
pm2 start npm --name=tl-rtc-file-api -- run https-api
10+
11+
sleep 1
12+
13+
pm2 start npm --name=tl-rtc-file-socket -- run https-socket
14+
15+
sleep 1
16+
17+
npm run build:pro

bin/centeros/auto-stop.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
#########################
3+
# 提供pm2删除停止服务的脚本
4+
# 包含api服务,socket服务
5+
# @auther: iamtsm
6+
# @version: v1.0.0
7+
#########################
8+
9+
pm2 del tl-rtc-file-api
10+
11+
pm2 del tl-rtc-file-socket
12+
13+
echo "stop and [tl-rtc-file-api] / [tl-rtc-file-socket] pm2 processes ok"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
#########################
3+
# 提供一键更新项目代码版本的脚本
4+
# @auther: iamtsm
5+
# @version: v1.0.0
6+
#########################
7+
8+
# Check if the current directory is a Git repository
9+
if [ -d .git ]; then
10+
# The current directory is a Git repository, so we can pull the latest changes
11+
echo "Current directory is a Git repository. Pulling latest changes..."
12+
git pull
13+
else
14+
# The current directory is not a Git repository
15+
echo "Current directory is not a Git repository."
16+
17+
# Check if Git is installed
18+
if ! command -v git &> /dev/null; then
19+
# Git is not installed, so let's try to install it
20+
echo "Git is not installed. Installing Git..."
21+
sudo yum install -y git
22+
fi
23+
24+
# Initialize a new Git repository and set the remote URL
25+
echo "Initializing a new Git repository and setting remote URL..."
26+
git init
27+
git remote add origin https://github.com/tl-open-source/tl-rtc-file.git
28+
29+
# Pull the latest changes from the remote repository (use 'master' branch)
30+
git pull origin master
31+
32+
# Optionally, you can set the default branch to 'master'
33+
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master
34+
fi
35+
36+
echo "Done."

bin/ubuntu16/auto-check-install-http.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#!/bin/bash
2+
#########################
3+
# 提供一键部署http服务环境的脚本
4+
# 包含api服务,socket服务
5+
# @auther: iamtsm
6+
# @version: v1.0.0
7+
#########################
28

39
# Function to install Node.js 16
410
install_node() {

bin/ubuntu16/auto-check-install-https.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#!/bin/bash
2+
#########################
3+
# 提供一键部署https服务环境的脚本
4+
# 包含api服务,socket服务
5+
# @auther: iamtsm
6+
# @version: v1.0.0
7+
#########################
28

39
# Function to install Node.js 16
410
install_node() {

bin/ubuntu16/auto-start-http.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#!/bin/bash
2+
#########################
3+
# 提供pm2启动管理http服务的脚本
4+
# 包含api服务,socket服务
5+
# @auther: iamtsm
6+
# @version: v1.0.0
7+
#########################
28

39
pm2 start npm --name=tl-rtc-file-api -- run http-api
410

bin/ubuntu16/auto-start-https.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
#!/bin/bash
2+
#########################
3+
# 提供pm2启动管理https服务的脚本
4+
# 包含api服务,socket服务
5+
# @auther: iamtsm
6+
# @version: v1.0.0
7+
#########################
28

39
pm2 start npm --name=tl-rtc-file-api -- run https-api
410

0 commit comments

Comments
 (0)