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
This commit is contained in:
https://blog.iamtsm.cn
2023-09-09 15:02:18 +08:00
parent a5ae9d98e7
commit 9f5d912110
48 changed files with 700 additions and 56 deletions

View File

@@ -0,0 +1,102 @@
#!/bin/bash
#########################
# 提供一键部署http服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
# Function to install Node.js 16
install_node() {
echo "======>Node.js is not installed. Installing Node.js 16..."
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
sudo yum install -y nodejs
echo "======>Node.js 16 installed"
}
# Function to install pm2 globally
install_pm2() {
echo "======>pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
echo "======>pm2 installed"
}
# Function to install lsof
install_lsof() {
echo "======>lsof is not installed. Installing lsof..."
sudo yum install -y lsof
echo "======>lsof installed"
}
# Wait for a command to become available
wait_for_command() {
command="$1"
while ! command -v $command &> /dev/null; do
sleep 1
done
}
# Step 1: Check if sudo is installed and install if not
if ! command -v sudo &> /dev/null; then
echo "======>sudo is not installed. Installing sudo..."
yum install -y sudo
fi
# Step 2: Check if curl is installed
if ! command -v curl &> /dev/null; then
echo "======>curl is not installed. Installing curl..."
sudo yum install -y curl
fi
# Step 3: Check if Node.js is installed and install Node.js 16 if not
if ! command -v node &> /dev/null; then
install_node
else
echo "======>Node.js is already installed"
fi
# Wait for Node.js to be installed
wait_for_command node
# Step 4: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "======>Node.js version: $node_version"
echo "======>npm version: $npm_version"
# Step 5: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
install_pm2
else
echo "======>pm2 is already installed"
fi
# Wait for pm2 to be installed
wait_for_command pm2
# Step 6: Check if lsof is installed and install if not
if ! command -v lsof &> /dev/null; then
install_lsof
else
echo "======>lsof is already installed"
fi
# Step 7: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "======>Port 9092 or 8444 is already in use."
exit 1
fi
# Step 8: install npm packages
echo "Ready to install npm packages"
cd ../../svr/
rm package-lock.json
npm install --registry=https://registry.npmmirror.com
# Step 9: Run start-http.sh script to start the service
echo "Ready to run auto-start-http.sh"
sleep 1
/bin/bash ./../bin/ubuntu16/auto-start-http.sh

View File

@@ -0,0 +1,102 @@
#!/bin/bash
#########################
# 提供一键部署https服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
# Function to install Node.js 16
install_node() {
echo "======>Node.js is not installed. Installing Node.js 16..."
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
sudo yum install -y nodejs
echo "======>Node.js 16 installed"
}
# Function to install pm2 globally
install_pm2() {
echo "======>pm2 is not installed. Installing pm2 globally..."
sudo npm install -g pm2
echo "======>pm2 installed"
}
# Function to install lsof
install_lsof() {
echo "======>lsof is not installed. Installing lsof..."
sudo yum install -y lsof
echo "======>lsof installed"
}
# Wait for a command to become available
wait_for_command() {
command="$1"
while ! command -v $command &> /dev/null; do
sleep 1
done
}
# Step 1: Check if sudo is installed and install if not
if ! command -v sudo &> /dev/null; then
echo "======>sudo is not installed. Installing sudo..."
yum install -y sudo
fi
# Step 2: Check if curl is installed
if ! command -v curl &> /dev/null; then
echo "======>curl is not installed. Installing curl..."
sudo yum install -y curl
fi
# Step 3: Check if Node.js is installed and install Node.js 16 if not
if ! command -v node &> /dev/null; then
install_node
else
echo "======>Node.js is already installed"
fi
# Wait for Node.js to be installed
wait_for_command node
# Step 4: Output Node.js and npm versions
node_version=$(node -v)
npm_version=$(npm -v)
echo "======>Node.js version: $node_version"
echo "======>npm version: $npm_version"
# Step 5: Check if pm2 is installed and install it globally if not
if ! command -v pm2 &> /dev/null; then
install_pm2
else
echo "======>pm2 is already installed"
fi
# Wait for pm2 to be installed
wait_for_command pm2
# Step 6: Check if lsof is installed and install if not
if ! command -v lsof &> /dev/null; then
install_lsof
else
echo "======>lsof is already installed"
fi
# Step 7: Check if ports 9092 and 8444 are occupied
port_9092_in_use=$(sudo lsof -i :9092 | grep LISTEN | wc -l)
port_8444_in_use=$(sudo lsof -i :8444 | grep LISTEN | wc -l)
if [ "$port_9092_in_use" -gt 0 ] || [ "$port_8444_in_use" -gt 0 ]; then
echo "======>Port 9092 or 8444 is already in use."
exit 1
fi
# Step 8: install npm packages
echo "Ready to install npm packages"
cd ../../svr/
rm package-lock.json
npm install --registry=https://registry.npmmirror.com
# Step 9: Run start-https.sh script to start the service
echo "Ready to run auto-start-https.sh"
sleep 1
/bin/bash ./../bin/ubuntu16/auto-start-https.sh

17
bin/centeros/auto-start-http.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
#########################
# 提供pm2启动管理http服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 start npm --name=tl-rtc-file-api -- run http-api
sleep 1
pm2 start npm --name=tl-rtc-file-socket -- run http-socket
sleep 1
npm run build:pro

View File

@@ -0,0 +1,17 @@
#!/bin/bash
#########################
# 提供pm2启动管理https服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 start npm --name=tl-rtc-file-api -- run https-api
sleep 1
pm2 start npm --name=tl-rtc-file-socket -- run https-socket
sleep 1
npm run build:pro

13
bin/centeros/auto-stop.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
#########################
# 提供pm2删除停止服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 del tl-rtc-file-api
pm2 del tl-rtc-file-socket
echo "stop and [tl-rtc-file-api] / [tl-rtc-file-socket] pm2 processes ok"

View File

@@ -0,0 +1,36 @@
#!/bin/bash
#########################
# 提供一键更新项目代码版本的脚本
# @auther: iamtsm
# @version: v1.0.0
#########################
# Check if the current directory is a Git repository
if [ -d .git ]; then
# The current directory is a Git repository, so we can pull the latest changes
echo "Current directory is a Git repository. Pulling latest changes..."
git pull
else
# The current directory is not a Git repository
echo "Current directory is not a Git repository."
# Check if Git is installed
if ! command -v git &> /dev/null; then
# Git is not installed, so let's try to install it
echo "Git is not installed. Installing Git..."
sudo yum install -y git
fi
# Initialize a new Git repository and set the remote URL
echo "Initializing a new Git repository and setting remote URL..."
git init
git remote add origin https://github.com/tl-open-source/tl-rtc-file.git
# Pull the latest changes from the remote repository (use 'master' branch)
git pull origin master
# Optionally, you can set the default branch to 'master'
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master
fi
echo "Done."

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供一键部署http服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
# Function to install Node.js 16
install_node() {

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供一键部署https服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
# Function to install Node.js 16
install_node() {

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供pm2启动管理http服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 start npm --name=tl-rtc-file-api -- run http-api

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供pm2启动管理https服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 start npm --name=tl-rtc-file-api -- run https-api

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供pm2删除停止服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 del tl-rtc-file-api

View File

@@ -0,0 +1,37 @@
#!/bin/bash
#########################
# 提供一键更新项目代码版本的脚本
# @auther: iamtsm
# @version: v1.0.0
#########################
# Check if the current directory is a Git repository
if [ -d .git ]; then
# The current directory is a Git repository, so we can pull the latest changes
echo "Current directory is a Git repository. Pulling latest changes..."
git pull
else
# The current directory is not a Git repository
echo "Current directory is not a Git repository."
# Check if Git is installed
if ! command -v git &> /dev/null; then
# Git is not installed, so let's try to install it
echo "Git is not installed. Installing Git..."
sudo apt-get update
sudo apt-get install -y git # Adjust this for CentOS or other Linux distributions
fi
# Initialize a new Git repository and set the remote URL
echo "Initializing a new Git repository and setting remote URL..."
git init
git remote add origin https://github.com/tl-open-source/tl-rtc-file.git
# Pull the latest changes from the remote repository (use 'master' branch)
git pull origin master
# Optionally, you can set the default branch to 'master'
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master
fi
echo "Done."

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供一键部署http服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
# Function to install Node.js 16
install_node() {

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供一键部署https服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
# Function to install Node.js 16
install_node() {

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供pm2启动管理http服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 start npm --name=tl-rtc-file-api -- run http-api

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供pm2启动管理https服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 start npm --name=tl-rtc-file-api -- run https-api

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供pm2删除停止服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 del tl-rtc-file-api

View File

@@ -0,0 +1,37 @@
#!/bin/bash
#########################
# 提供一键更新项目代码版本的脚本
# @auther: iamtsm
# @version: v1.0.0
#########################
# Check if the current directory is a Git repository
if [ -d .git ]; then
# The current directory is a Git repository, so we can pull the latest changes
echo "Current directory is a Git repository. Pulling latest changes..."
git pull
else
# The current directory is not a Git repository
echo "Current directory is not a Git repository."
# Check if Git is installed
if ! command -v git &> /dev/null; then
# Git is not installed, so let's try to install it
echo "Git is not installed. Installing Git..."
sudo apt-get update
sudo apt-get install -y git # Adjust this for CentOS or other Linux distributions
fi
# Initialize a new Git repository and set the remote URL
echo "Initializing a new Git repository and setting remote URL..."
git init
git remote add origin https://github.com/tl-open-source/tl-rtc-file.git
# Pull the latest changes from the remote repository (use 'master' branch)
git pull origin master
# Optionally, you can set the default branch to 'master'
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master
fi
echo "Done."

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供一键部署http服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
# Function to install Node.js 16
install_node() {

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供一键部署https服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
# Function to install Node.js 16
install_node() {

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供pm2启动管理http服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 start npm --name=tl-rtc-file-api -- run http-api

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供pm2启动管理https服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 start npm --name=tl-rtc-file-api -- run https-api

View File

@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供pm2删除停止服务的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################
pm2 del tl-rtc-file-api

View File

@@ -0,0 +1,37 @@
#!/bin/bash
#########################
# 提供一键更新项目代码版本的脚本
# @auther: iamtsm
# @version: v1.0.0
#########################
# Check if the current directory is a Git repository
if [ -d .git ]; then
# The current directory is a Git repository, so we can pull the latest changes
echo "Current directory is a Git repository. Pulling latest changes..."
git pull
else
# The current directory is not a Git repository
echo "Current directory is not a Git repository."
# Check if Git is installed
if ! command -v git &> /dev/null; then
# Git is not installed, so let's try to install it
echo "Git is not installed. Installing Git..."
sudo apt-get update
sudo apt-get install -y git # Adjust this for CentOS or other Linux distributions
fi
# Initialize a new Git repository and set the remote URL
echo "Initializing a new Git repository and setting remote URL..."
git init
git remote add origin https://github.com/tl-open-source/tl-rtc-file.git
# Pull the latest changes from the remote repository (use 'master' branch)
git pull origin master
# Optionally, you can set the default branch to 'master'
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master
fi
echo "Done."