This commit is contained in:
https://blog.iamtsm.cn
2023-08-13 15:41:17 +08:00
parent 16aa1f0148
commit 8e21085a23
2 changed files with 180 additions and 175 deletions

View File

@@ -8,7 +8,7 @@
<p align="center">
<a href="https://im.iamtsm.cn/file" target="_blank">体验地址</a>
<a href="https://hub.docker.com/repositories/iamtsm" target="_blank">DockerHub</a>
<a href="https://hub.docker.com/u/iamtsm" target="_blank">DockerHub</a>
<a href="https://github.com/tl-open-source/tl-rtc-file/blob/master/doc/README_EN.md" target="_blank">EN-DOC</a>
</p>

View File

@@ -1,4 +1,4 @@
# tl-rtc-file-tool【From File Transfer, Beyond File Transfer
# tl-rtc-file-tool【Beyond File Transfer, Beyond Imagination
[![](https://img.shields.io/badge/webrtc-p2p-blue)](https://webrtc.org.cn/)
[![](https://img.shields.io/badge/code-simple-green)](https://github.com/iamtsm/tl-rtc-file/)
@@ -7,8 +7,8 @@
[![](https://img.shields.io/badge/platform-unlimited-coral)](https://github.com/iamtsm/tl-rtc-file/)
<p align="center">
<a href="https://im.iamtsm.cn/file" target="_blank">Demo</a>
<a href="https://hub.docker.com/repositories/iamtsm" target="_blank">DockerHub</a>
<a href="https://im.iamtsm.cn/file" target="_blank">Experience</a>
<a href="https://hub.docker.com/u/iamtsm" target="_blank">DockerHub</a>
<a href="https://github.com/tl-open-source/tl-rtc-file/blob/master/doc/README_EN.md" target="_blank">EN-DOC</a>
</p>
@@ -20,262 +20,267 @@
- [Introduction](#introduction)
- [Advantages](#advantages)
- [Extensions](#extensions)
- [Preparation (Mandatory Steps)](#preparation-mandatory-steps)
- [Configure Websocket (Mandatory Steps)](#configure-websocket-mandatory-steps)
- [Startup (Mandatory Steps)](#startup-mandatory-steps)
- [Configure Database (Optional)](#configure-database-optional)
- [Admin Panel (Optional)](#admin-panel-optional)
- [Enterprise WeChat Notifications (Optional)](#enterprise-wechat-notifications-optional)
- [OSS Cloud Storage (Optional)](#oss-cloud-storage-optional)
- [Chat-GPT Integration (Optional)](#chat-gpt-integration-optional)
- [Configure TURN Server (LAN-Optional, WAN-Mandatory)](#configure-turn-server-lan-optional-wan-mandatory)
- [Preparation (Essential Steps)](#preparation-essential-steps)
- [Configure Websocket (Essential Steps)](#configure-websocket-essential-steps)
- [Startup (Essential Steps)](#startup-essential-steps)
- [Configure Database (Non-Essential Steps)](#configure-database-non-essential-steps)
- [Admin Panel (Non-Essential Steps)](#admin-panel-non-essential-steps)
- [WeChat Work Notification (Non-Essential Steps)](#wechat-work-notification-non-essential-steps)
- [OSS Cloud Storage (Non-Essential Steps)](#oss-cloud-storage-non-essential-steps)
- [Chat-GPT (Non-Essential Steps)](#chat-gpt-non-essential-steps)
- [Configure Turn Server (LAN Non-Essential Steps, Internet Essential Steps)](#configure-turn-server-lan-non-essential-steps-internet-essential-steps)
- [Docker](#docker)
- [Other Deployment Methods](#other-deployment-methods)
- [Overview Diagram](#overview-diagram)
- [License](#license)
- [Disclaimer](#disclaimer)
#### Background: Developed from the topic of 2020 graduation project
#### Background: Consolidated from the topic of the 20th-year graduation project
#### Introduction: (tl webrtc datachannel filetools) Transferring files through WebRTC on the web, supporting transfer of large files.
#### Introduction: (tl webrtc datachannel filetools) Transferring files on the web using WebRTC, supporting the transfer of very large files.
#### Advantages: Fragmented transfer, cross-platform, platform-independent, easy to use, no internal network speed limit (up to 70+ MB/s in LAN), supports private deployment, supports multi-file drag-and-drop sending, web file preview.
#### Advantages: Fragmented transmission, cross-device, cross-platform, easy to use, unlimited speed within the intranet (up to over 70MB/s in the LAN), supports private deployment, supports multi-file drag-and-drop sending, web file preview.
#### Extensions: Extended with many rich features, such as local screen recording, remote screen sharing (zero-latency), remote audio-video calling (zero-latency), live streaming (zero-latency), password-protected rooms, OSS cloud storage, relay service settings, WebRTC testing, WebRTC statistics, text messaging (group, private), public chat, remote whiteboard, AI chatbot, comprehensive admin dashboard, real-time execution log display, robot alert notifications, etc.
#### Extensions: Extends many rich features, such as local screen recording, remote screen sharing (no delay), remote audio and video calls (no delay), live streaming (no delay), password-protected rooms, OSS cloud storage, relay service settings, WebRTC detection, WebRTC statistics, text transmission (group chat, private chat), public chat, remote whiteboard, AI chatbox, rich backend management, real-time execution log display, robot alert notifications, and more...
## Preparation (Mandatory Steps)
## Preparation (Essential Steps)
1. Install Node.js 14.21.x or above and npm. Then navigate to the project directory and run the following command:
1. Install node-14.21.x or higher and npm, then run the following command in the project directory:
```
cd svr/
npm install
```
2. For the first run or self-development of the page, use either of the following commands:
```bash
cd svr/
npm install
```
2. For the first run or self-developed pages, you can use one of the following commands:
```bash
npm run build:dev # If you need to develop or modify frontend pages
npm run build:pro # If you don't need to develop or modify frontend pages
```
`npm run build:dev` (Use this command if you need to develop/modifty the frontend page)
`npm run build:pro` (Use this command if you don't need to develop/modifty the frontend page)
3. Modify the `tlrtcfile.env` configuration file.
## Configure Websocket (Mandatory Steps)
## Configure Websocket (Essential Steps)
Modify the corresponding websocket configuration in `tlrtcfile.env`:
Modify the corresponding websocket configurations in `tlrtcfile.env`:
```ini
## Websocket server port
tl_rtc_file_ws_port=8444
## Websocket server port
tl_rtc_file_ws_port=8444
## Websocket server address
## "ws://domain or ip:port or domain:port"
## For socket ip, use LAN IP for LAN access and public IP for public access
tl_rtc_file_socket_host=ws://127.0.0.1:8444
```
## Websocket server address
## "ws://domain or ws://ip:port or ws://domain:port"
tl_rtc_file_socket_host=ws://127.0.0.1:8444
## Startup (Mandatory Steps)
## Startup (Essential Steps)
Start the following two services, choose either mode, the difference between them is that the HTTPS environment is required for audio-video functions, live streaming, and screen sharing, but it won't affect other functionalities.
Start the following two services. Choose one mode to start, and the difference between them is that the HTTPS environment is required for audio, video, live streaming, and screen sharing features. Other features are not affected.
After starting in HTTP mode, access http://your_machine_ip:9092.
API service: `npm run http-api`
Socket service: `npm run http-socket`
- API service: `npm run http-api`
- Socket service: `npm run http-socket`
After starting in HTTPS mode, access https://your_machine_ip:9092.
API service: `npm run https-api`
- API service: `npm run https-api`
- Socket service: `npm run https-socket`
Socket service: `npm run https-socket`
## Configure Database (Non-Essential Steps)
## Configure Database (Optional)
Modify the database-related configurations in `tlrtcfile.env`:
Modify the database-related configuration in `tlrtcfile.env`:
## Enable database
tl_rtc_file_db_open=false
## Database address
tl_rtc_file_db_mysql_host=mysql
## Database port
tl_rtc_file_db_mysql_port=3306
## Database name
tl_rtc_file_db_mysql_dbName=webchat
## Database username
tl_rtc_file_db_mysql_user=tlrtcfile
## Database password
tl_rtc_file_db_mysql_password=tlrtcfile
```ini
## Enable database
tl_rtc_file_db_open=false
## Database address
tl_rtc_file_db_mysql_host=mysql
## Database port
tl_rtc_file_db_mysql_port=3306
## Database name
tl_rtc_file_db_mysql_dbName=webchat
## Database username
tl_rtc_file_db_mysql_user=tlrtcfile
## Database password
tl_rtc_file_db_mysql_password=tlrtcfile
```
## Admin Panel (Non-Essential Steps)
## Admin Panel (Optional)
Prerequisite: Database configuration must be enabled.
Prerequisite: Database configuration needs to be enabled.
Modify the admin panel-related configurations in `tlrtcfile.env`. After starting, enter the configured room number and password to access the admin panel:
Modify the admin panel-related configuration in `tlrtcfile.env`. After starting, enter the configured room number and password to access the admin panel:
## Admin panel room number
tl_rtc_file_manage_room=tlrtcfile
## Admin panel password
tl_rtc_file_manage_password=tlrtcfile
```ini
## Admin panel room number
tl_rtc_file_manage_room=tlrtcfile
## Admin panel password
tl_rtc_file_manage_password=tlrtcfile
```
## WeChat Work Notification (Non-Essential Steps)
## Enterprise WeChat Notifications (Optional)
Modify the WeChat Work notification-related configurations in `tlrtcfile.env`:
Modify the Enterprise WeChat notification-related configuration in `tlrtcfile.env`:
## WeChat Work notification switch
tl_rtc_file_notify_open=false
## WeChat Work notification robot KEY, normal notifications, comma-separated if multiple keys
tl_rtc_file_notify_qiwei_normal=
## WeChat Work notification robot KEY, error notifications, comma-separated if multiple keys
tl_rtc_file_notify_qiwei_error=
```ini
## Enterprise WeChat notification switch
tl_rtc_file_notify_open=false
## Enterprise WeChat notification robot key for normal notifications (comma-separated if multiple keys)
tl_rtc_file_notify_qiwei_normal=
## Enterprise WeChat notification robot key for error notifications (comma-separated if multiple keys)
tl_rtc_file_notify_qiwei_error=
```
## OSS Cloud Storage (Non-Essential Steps)
## OSS Cloud Storage (Optional)
Modify the OSS storage-related configurations in `tlrtcfile.env`:
Modify the OSS storage-related configuration in `tlrtcfile.env`:
## oss-seafile storage repository ID
tl_rtc_file_oss_seafile_repoid=
## oss-seafile address
tl_rtc_file_oss_seafile_host=
## oss-seafile username
tl_rtc_file_oss_seafile_username=
## oss-seafile password
tl_rtc_file_oss_seafile_password=
```ini
## oss-seafile storage repository ID
tl_rtc_file_oss_seafile_repoid=
## oss-seafile address
tl
##
_rtc_file_oss_seafile_host=
## oss-seafile username
tl_rtc_file_oss_seafile_username=
## oss-seafile password
tl_rtc_file_oss_seafile_password=
oss-alyun storage accessKey
tl_rtc_file_oss_alyun_AccessKey=
## oss-aly storage SecretKey
tl_rtc_file_oss_alyun_Secretkey=
## oss-aly storage bucket
tl_rtc_file_oss_alyun_bucket=
## oss-alyun storage accessKey
tl_rtc_file_oss_alyun_AccessKey=
## oss-alyun storage SecretKey
tl_rtc_file_oss_alyun_Secretkey=
## oss-alyun storage bucket
tl_rtc_file_oss_alyun_bucket=
## oss-txyun storage accessKey
tl_rtc_file_oss_txyun_AccessKey=
## oss-txyun storage SecretKey
tl_rtc_file_oss_txyun_Secretkey=
## oss-txyun storage bucket
tl_rtc_file_oss_txyun_bucket=
## oss-txyun storage accessKey
tl_rtc_file_oss_txyun_AccessKey=
## oss-txyun storage SecretKey
tl_rtc_file_oss_txyun_Secretkey=
## oss-txyun storage bucket
tl_rtc_file_oss_txyun_bucket=
## oss-qiniuyun storage accessKey
tl_rtc_file_oss_qiniuyun_AccessKey=
## oss-qiniuyun storage SecretKey
tl_rtc_file_oss_qiniuyun_Secretkey==
## oss-qiniuyun storage bucket
tl_rtc_file_oss_qiniuyun_bucket=
## oss-qiniuyun storage accessKey
tl_rtc_file_oss_qiniuyun_AccessKey=
## oss-qiniuyun storage SecretKey
tl_rtc_file_oss_qiniuyun_Secretkey==
## oss-qiniuyun storage bucket
tl_rtc_file_oss_qiniuyun_bucket=
```
## Chat-GPT (Non-Essential Steps)
## Chat-GPT Integration (Optional)
Modify the OpenAI-related configurations in `tlrtcfile.env`:
Modify the OpenAI-related configuration in `tlrtcfile.env`:
## openai-key, comma-separated if multiple keys
tl_rtc_file_openai_keys=
```ini
## OpenAI keys (comma-separated if multiple keys)
tl_rtc_file_openai_keys=
```
## Configure Turn Server (LAN Non-Essential Steps, Internet Essential Steps)
## Configure TURN Server (LAN-Optional, WAN-Mandatory)
Currently, two ways are available to generate and use TURN service credentials: fixed credentials (recommended) and temporary credentials with expiration. **Choose one method**.
Currently, there are two ways to generate and use Turn server accounts and passwords: fixed accounts and passwords (recommended), and time-limited accounts and passwords. **Choose one method**:
Example for Ubuntu:
Install coturn: `sudo apt-get install coturn`
- Install coturn: `sudo apt-get install coturn`
Fixed credentials: `docker/coturn/turnserver-with-secret-user.conf`
Valid accounts and passwords: `docker/coturn/turnserver-with-secret-user.conf`
1. Modify fields like `listening-device`, `listening-ip`, `external-ip`, `static-auth-secret`, `realm`.
1. Modify the fields `listening-device`, `listening-ip`, `external-ip`, `static-auth-secret`, and `realm`.
2. Start turnserver:
`turnserver -c /path/to/complete/conf/turn/turnserver-with-secret-user.conf`
2. Start TURN server:
`turnserver -c /full/path/to/conf/turn/turnserver-with-secret-user.conf`
Fixed accounts and passwords: `docker/coturn/turnserver-with-fixed-user.conf`
Temporary credentials: `docker/coturn/turnserver-with-fixed-user.conf`
1. Modify the fields `listening-device`, `listening-ip`, `external-ip`, `user`, and `realm`.
2. Generate users:
`turnadmin -a -u username -p password -r realm_from_config_file`
3. Start turnserver:
`turnserver -c /path/to/complete/docker/coturn/turnserver-with-secret-user.conf`
1. Modify fields like `listening-device`, `listening-ip`, `external-ip`, `user`, `realm`.
After deploying coturn, set up WebRTC-related information in the corresponding `tlrtcfile.env` configuration:
2. Generate user credentials:
`turnadmin -a -u username -p password -r realm`
3. Start TURN server:
`turnserver -c /full/path/to/docker/coturn/turnserver-with-secret-user.conf`
After setting up coturn, configure WebRTC related information in `tlrtcfile.env`:
```ini
## webrtc-stun server address
tl_rtc_file_webrtc_stun_host=
## webrtc-turn server address
tl_rtc_file_webrtc_turn_host=
## webrtc-turn server username
tl_rtc_file_webrtc_turn_username=tlrtcfile
## webrtc-turn server password
tl_rtc_file_webrtc_turn_credential=tlrtcfile
## webrtc-turn server secret
tl_rtc_file_webrtc_turn_secret=tlrtcfile
## webrtc-turn server account expiration time (milliseconds)
tl_rtc_file_webrtc_turn_expire=86400000
```
## webrtc-stun relay service address
tl_rtc_file_webrtc_stun_host=
## webrtc-turn relay service address
tl_rtc_file_webrtc_turn_host=
## webrtc relay service username
tl_rtc_file_webrtc_turn_username=tlrtcfile
## webrtc relay service password
tl_rtc_file_webrtc_turn_credential=tlrtcfile
## webrtc relay service secret
tl_rtc_file_webrtc_turn_secret=tlrtcfile
## webrtc relay service account expiration time (milliseconds)
tl_rtc_file_webrtc_turn_expire=86400000
## Docker
Both `official images` and `self-packaged images` are supported. Using official images allows for two modes of operation: `Docker script startup` and `Docker Compose startup`.
Currently, support is provided for `official images` and `self-packaged images`. Using official images supports two methods: `docker script startup` and `docker-compose startup`.
Different from deploying on a server/computer, the Docker environment by default starts the database and coturn service. No additional actions are needed, simply start it.
Unlike self-deployment on a server/computer, the Docker environment by default starts the database and coturn services, requiring minimal additional steps for setup.
### Using Official Images (Docker Script Startup):
After modifying the `tlrtcfile.env` configuration (or using the default configuration), navigate to the `bin/` directory and run the script `auto-pull-and-start-docker.sh`:
After modifying the `tlrtcfile.env` configuration as needed (or using the default configuration), navigate to the `bin/` directory and execute the `auto-pull-and-start-docker.sh` script:
1. `chmod +x ./auto-pull-and-start-docker.sh`
2. `./auto-pull-and-start-docker.sh`
```
chmod +x ./auto-pull-and-start-docker.sh
./auto-pull-and-start-docker.sh
```
### Using Official Images (Docker Compose Startup):
### Using Official Images (Docker-Compose Startup):
After modifying the `tlrtcfile.env` configuration (or using the default configuration), execute the following command in the main directory:
After modifying the `tlrtcfile.env` configuration as needed (or using the default configuration), execute the following command based on your `Docker Compose` version in the main directory:
```bash
- For `Docker Compose V1`:
```
docker-compose --profile=http up -d
```
### Self-Packaged Image (Docker Compose Packaged Startup):
- For `Docker Compose V2`:
```
docker compose --profile=http up -d
```
After modifying the `tlrtcfile.env` configuration (or using the default configuration), navigate to the `docker/` directory and execute:
### Self-Packaged Image (Docker-Compose Self-Packaged Startup):
```bash
After confirming the modification of the `tlrtcfile.env` configuration file (or using the default configuration), navigate to the `docker/` directory and execute the following command based on your `Docker Compose` version in the main directory:
- For `Docker Compose V1`:
```
docker-compose -f docker-compose-build-code.yml up -d
```
- For `Docker Compose V2`:
```
docker compose -f docker-compose-build-code.yml up -d
```
## Other Deployment Methods
Apart from the manual installation, Docker official images, and self-packaged images, there are also options for automatic scripts and one-click deployment on hosting platforms.
In addition to the above manual installation, Docker official images, and self-packaged images, there are also options for automatic scripts and one-click deployment on hosting platforms.
After downloading the project, navigate to the `bin/` directory and execute the corresponding system script:
After downloading the project, navigate to the `bin/` directory and select the appropriate system script to execute. The script will automatically detect the installation environment, install dependencies, and start the services automatically.
### ubuntu Auto Script
**Note: Before executing the script, you can modify the configuration first. If you're using the default configuration, you'll need to restart both services for the changes to take effect. To do this, execute the `Stop Services` script and then run the `Automatic Script` again.**
```bash
chmod +x ./ubuntu/*.sh
cd ubuntu/
./auto-check-install-http.sh # or ./auto-check-install-https.sh
### Ubuntu Automatic Script (e.g., ubuntu16):
```
chmod +x ./ubuntu16/*.sh
cd ubuntu16/
./auto-check-install-http.sh
```
For HTTPS, use this script:
```
./auto-check-install-https.sh
```
Stop Services Script:
```
./auto-stop.sh
```
### Windows Auto Script
### Windows Automatic Script:
Run `windows/auto-check-install-http.bat` or `windows/auto-check-install-https.bat`.
```
windows/auto-check-install-http.bat
```
For HTTPS, use this script:
```
windows/auto-check-install-https.bat
```
### Zeabur Platform One-Click Deployment
### Zeabur One-Click Deployment Platform
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/898TLE?referralCode=iamtsm)