Skip to content

Commit 814f4db

Browse files
xiaorongnieipcjsTranscodeGroupDeveloper
authored
feat(增加一键部署): 增加一键部署脚本 (#50)
* docs: translate documentation and config files to English (#44) * docs: add english documentation Author: antigravity, jss-tg * wip: sync to en.env --------- Co-authored-by: ipcjs.mac4 <gipcjs@gmail.com> * feat(部署脚本): 部署脚本 * feat(备份): 备份ssl替换提醒 * feat(mysql备份): 增加依赖 * 增加注释 * 增加一键部署脚本 * 增加一键部署注释 * feat(配置): 还原配置 * fix(track-http): 修复网关http-url错误 (#49) * feat(demo): 优化demo * 增加http脚本 * feat(jtt808): 修复808网关的http的URL错误 * feat(网关http): 直接使用nginx代理的端口 * perf(还原): 还原设置 * feat(注释): 增加注释 --------- Co-authored-by: TranscodeGroupDeveloper <transcodegroupdeveloper@gmail.com> * 使用当前分支执行bash download-and-install.sh * 增加回车提醒 * 不知道什么变化 * 增加目录切换, 可以不在、home/docker下面执行 * SSL_CERTIFICATE内置,避免http复写歧义 * 移除http下面的默认值 * wip: xxx * feat(jtt808): 删除复写数据 * fix(修复文档错误) --------- Co-authored-by: ipcjs.mac4 <gipcjs@gmail.com> Co-authored-by: TranscodeGroupDeveloper <transcodegroupdeveloper@gmail.com>
1 parent 8360286 commit 814f4db

File tree

11 files changed

+432
-18
lines changed

11 files changed

+432
-18
lines changed

README.en.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
docker configuration repository
66

7+
## One-click deployment (beta)
8+
9+
```sh
10+
curl -fsSL https://raw.githubusercontent.com/TranscodeGroup/docker/master/download-and-install.sh | sudo bash
11+
```
12+
713
## Deployment
814

915
### 1. Initialization

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
docker配置文件仓库
66

7+
## 一键部署(实验性功能)
8+
9+
```sh
10+
curl -fsSL https://raw.githubusercontent.com/TranscodeGroup/docker/master/download-and-install.sh | sudo bash
11+
```
12+
713
## 部署
814

915
### 1. 初始化

default.en.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SERVER_HOSTNAME='' # livedvr.tripsdd.com
4141
# Required, absolute path of the certificate file, excluding .crt/.key suffix. nginx actually reads the two files ${SSL_CERTIFICATE}.crt and ${SSL_CERTIFICATE}.key
4242
# If using http, or using https but no certificate has been applied for temporarily, it can be set to the built-in fake certificate: /home/docker/nginx/ssl/placeholder
4343
# If using crotbot to automatically apply for a certificate, you need to start it separately first (docker compose up crotbot). The applied certificate path will be printed in the log, and then add it to the variable, generally: /data/certbot/live/${SERVER_HOSTNAME}/certificate,
44-
SSL_CERTIFICATE='' # /home/docker/nginx/ssl/placeholder
44+
SSL_CERTIFICATE='/home/docker/nginx/ssl/placeholder'
4545

4646
# When bus and track are deployed on the same server, they need to be distinguished by domain name
4747
BUS_HOSTNAME=${SERVER_HOSTNAME}

default.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ SERVER_HOSTNAME='' # livedvr.tripsdd.com
4141
# 必填, 证书文件的绝对路径, 排除.crt/.key后缀, nginx实际读取的是 ${SSL_CERTIFICATE}.crt 和 ${SSL_CERTIFICATE}.key 两个文件
4242
# 如果使用http, 或者使用https但暂时没有申请到证书, 可以设置成内置的假证书: /home/docker/nginx/ssl/placeholder
4343
# 若使用crotbot自动申请证书, 需要先单独启动一次(docker compose up crotbot), 申请到的证书路径会在日志中打印, 然后将它添加到变量中, 一般为: /data/certbot/live/${SERVER_HOSTNAME}/certificate,
44-
SSL_CERTIFICATE='' # /home/docker/nginx/ssl/placeholder
44+
SSL_CERTIFICATE='/home/docker/nginx/ssl/placeholder'
4545

4646
# bus和track部署在同一台服务器上时, 需要通过域名区分两者
4747
BUS_HOSTNAME=${SERVER_HOSTNAME}

download-and-install.sh

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
#!/bin/bash
2+
3+
# ==========================================
4+
# TranscodeGroup One-Click Installer
5+
# Downloads repo, installs deps, runs setup
6+
# Usage:
7+
# curl -fsSL https://raw.githubusercontent.com/.../download-and-install.sh | bash
8+
# curl -fsSL https://raw.githubusercontent.com/TranscodeGroup/docker/perf/deploy/nxr/download-and-install.sh | sudo BRANCH=perf/deploy/nxr bash
9+
# ==========================================
10+
11+
set -e
12+
13+
# Colors
14+
GREEN='\033[0;32m'
15+
BLUE='\033[0;34m'
16+
RED='\033[0;31m'
17+
NC='\033[0m'
18+
19+
REPO_URL="https://github.com/TranscodeGroup/docker.git"
20+
INSTALL_DIR="/home/docker"
21+
# Allow overriding branch via env var, default to 'master'
22+
BRANCH=${BRANCH:-"master"}
23+
24+
echo -e "${BLUE}>>> Starting TranscodeGroup Installer...${NC}"
25+
26+
# 1. Root Check
27+
if [ "$EUID" -ne 0 ]; then
28+
echo -e "${RED}Please run as root (sudo su).${NC}"
29+
exit 1
30+
fi
31+
32+
# 2. System Dependencies (Git)
33+
if ! command -v git &> /dev/null; then
34+
echo -e "${BLUE}Installing Git...${NC}"
35+
if [ -f /etc/redhat-release ]; then
36+
yum install -y git
37+
elif [ -f /etc/lsb-release ] || [ -f /etc/debian_version ]; then
38+
apt-get update && apt-get install -y git
39+
else
40+
echo -e "${RED}Unsupported OS for auto-install. Please install git manually.${NC}"
41+
exit 1
42+
fi
43+
else
44+
echo -e "${GREEN}Git detected.${NC}"
45+
fi
46+
47+
# 3. Clone Repository or Update
48+
if [ -d "$INSTALL_DIR" ]; then
49+
if [ -d "$INSTALL_DIR/.git" ]; then
50+
echo -e "${BLUE}Updating existing repository at $INSTALL_DIR...${NC}"
51+
cd "$INSTALL_DIR"
52+
53+
# Auto-detect branch if user didn't specify one
54+
if [ "$BRANCH" == "master" ]; then
55+
DETECTED_LOCAL_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "master")
56+
if [ "$DETECTED_LOCAL_BRANCH" != "HEAD" ]; then
57+
BRANCH=$DETECTED_LOCAL_BRANCH
58+
echo -e "${BLUE}Auto-detected current branch: $BRANCH${NC}"
59+
fi
60+
fi
61+
62+
git fetch origin
63+
git reset --hard "origin/$BRANCH"
64+
git clean -fd
65+
echo -e "${GREEN}Successfully reset to origin/$BRANCH and cleaned worktree.${NC}"
66+
else
67+
# Directory exists but is NOT a git repo (e.g. manual mkdir or unzip)
68+
if [ "$(ls -A $INSTALL_DIR)" ]; then
69+
BACKUP_DIR="${INSTALL_DIR}_backup_$(date +%s)"
70+
echo -e "${YELLOW}Directory $INSTALL_DIR exists but is not a git repo.${NC}"
71+
echo -e "${YELLOW}Renaming to $BACKUP_DIR to allow fresh install...${NC}"
72+
mv "$INSTALL_DIR" "$BACKUP_DIR"
73+
74+
echo -e "${BLUE}Cloning repository to $INSTALL_DIR...${NC}"
75+
git clone -b "$BRANCH" "$REPO_URL" "$INSTALL_DIR"
76+
else
77+
# Directory exists but is empty
78+
echo -e "${BLUE}Cloning repository to existing empty directory $INSTALL_DIR...${NC}"
79+
git clone -b "$BRANCH" "$REPO_URL" "$INSTALL_DIR"
80+
fi
81+
fi
82+
else
83+
echo -e "${BLUE}Cloning repository to $INSTALL_DIR...${NC}"
84+
mkdir -p "$(dirname "$INSTALL_DIR")"
85+
git clone -b "$BRANCH" "$REPO_URL" "$INSTALL_DIR"
86+
fi
87+
88+
# 4. Docker Check & Install
89+
if ! command -v docker &> /dev/null; then
90+
echo -e "${BLUE}Docker not found. Installing via official script...${NC}"
91+
curl -fsSL https://get.docker.com | bash
92+
systemctl enable docker
93+
systemctl start docker
94+
echo -e "${GREEN}Docker installed.${NC}"
95+
else
96+
echo -e "${GREEN}Docker detected.${NC}"
97+
fi
98+
99+
# 5. Handover to setup-services.sh
100+
DEPLOY_SCRIPT="$INSTALL_DIR/setup-services.sh"
101+
102+
if [ -f "$DEPLOY_SCRIPT" ]; then
103+
chmod +x "$DEPLOY_SCRIPT"
104+
echo -e "${BLUE}>>> Handing over to setup-services.sh...${NC}"
105+
echo ""
106+
# Switch to directory before execution to ensure relative paths work
107+
cd "$INSTALL_DIR"
108+
exec ./setup-services.sh
109+
else
110+
echo -e "${RED}Critical Error: setup-services.sh not found in downloaded repository!${NC}"
111+
exit 1
112+
fi

examples/bus-http/.env

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
SERVER_HOSTNAME='transcodegroup.cn'
44
## Public IP
55
SERVER_IP_PUBLIC='81.71.36.80'
6-
# Must configure a placeholder certificate even if not using https
7-
SSL_CERTIFICATE=/home/docker/nginx/ssl/placeholder
86

97
#---------Custom Initial Password, recommended to generate new random ones for replacement-------------
108
## MYSQL, Required, example: p92oVkNxrUttUUu8qyqs

examples/track-http/.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
SERVER_IP_PUBLIC='58.82.168.197'
22
SERVER_HOSTNAME='th-track.transcodegroup.cn'
3-
# Must configure a placeholder certificate even if not using https
4-
SSL_CERTIFICATE=/home/docker/nginx/ssl/placeholder
5-
WEB_PORT_HTTP=80
63

74
MYSQL_PASSWORD='12345678'
85
REDIS_PASSWORD='12345678'

jtt808/README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,9 @@ cd /home/docker-compose/opt/ifv2mp4
2525
# Download installer
2626
wget https://github.com/TranscodeGroup/docker/releases/download/v1.0.4/tlgrectomp4_linux1.0.0.4.tar.gz
2727
# Decompress
28-
tar -xzvf tlgrectomp4_linux1.0.0.2.tar.gz
28+
tar -xzvf tlgrectomp4_linux1.0.0.4.tar.gz
2929
# Add path
3030
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/docker-compose/opt/ifv2mp4/release
3131
# Verify
3232
/home/docker-compose/opt/ifv2mp4/release/tlgrectomp4 --help
3333
```
34-
35-
## Ensure jtt808 docker service includes the following configuration (Built-in for current version, manual padding for old version)
36-
37-
```bash
38-
jtt808:
39-
volumes:
40-
- /home/docker-compose/opt/ifv2mp4:/usr/local/bin/ifv2mp4
41-
- /home/docker-compose/opt/ffmpeg:/usr/local/bin/ffmpeg:ro
42-
- /home/docker-compose/opt/ffprobe:/usr/local/bin/ffprobe:ro
43-
```

mysql-backup/compose.cbus.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
services:
22
mysql-cron-backup-cbus:
33
image: fradelg/mysql-cron-backup
4+
depends_on:
5+
- mysql8
46
volumes:
57
- "${DATA_DIR:-/data}/mysql8/backup:/backup"
68
- /etc/localtime:/etc/localtime:ro

mysql-backup/compose.maintain.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
services:
22
mysql-cron-backup-maintain:
33
image: fradelg/mysql-cron-backup
4+
depends_on:
5+
- mysql8
46
volumes:
57
- "${DATA_DIR:-/data}/mysql8/backup:/backup"
68
- /etc/localtime:/etc/localtime:ro

0 commit comments

Comments
 (0)