Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master #31

Open
wants to merge 10 commits into
base: feature/connect-end
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This is a basic workflow that is manually triggered

name: Manual workflow

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
name:
# Friendly description to be shown in the UI instead of 'name'
description: 'Person to greet'
# Default value if no value is explicitly provided
default: 'World'
# Input has to be provided for the workflow to run
required: true
# The data type of the input
type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
greet:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Send greeting
run: echo "Hello ${{ inputs.name }}"
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ node_modules
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

svr/res/js/*.min.*
svr/res/css/*.min.*
svr/web-res/js/*.min.*
svr/web-res/css/*.min.*

dist/

Expand All @@ -53,3 +53,5 @@ package-lock.json


docker/mysql/data/*

client_dist
102 changes: 102 additions & 0 deletions bin/centeros/auto-check-install-http.sh
Original file line number Diff line number Diff line change
@@ -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
102 changes: 102 additions & 0 deletions bin/centeros/auto-check-install-https.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions bin/centeros/auto-start-http.sh
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions bin/centeros/auto-start-https.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions bin/centeros/auto-stop.sh
Original file line number Diff line number Diff line change
@@ -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"
36 changes: 36 additions & 0 deletions bin/centeros/auto-update-project.sh
Original file line number Diff line number Diff line change
@@ -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."
6 changes: 6 additions & 0 deletions bin/ubuntu16/auto-check-install-http.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供一键部署http服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################

# Function to install Node.js 16
install_node() {
Expand Down
6 changes: 6 additions & 0 deletions bin/ubuntu16/auto-check-install-https.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash
#########################
# 提供一键部署https服务环境的脚本
# 包含api服务,socket服务
# @auther: iamtsm
# @version: v1.0.0
#########################

# Function to install Node.js 16
install_node() {
Expand Down
6 changes: 6 additions & 0 deletions bin/ubuntu16/auto-start-http.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 6 additions & 0 deletions bin/ubuntu16/auto-start-https.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Loading