Refactor Docker Compose examples and documentation

- Updated README.md to include new example files for minimal and production configurations with detailed instructions.
- Added compose.production-alt.example.yml for an annotated production setup.
- Introduced new example files: compose.minimal.example.yml, compose.production.example.yml, nginx.example.conf, and traefik.example.yml for better clarity and usability.
- Removed outdated configuration files and consolidated documentation for OCR language support.
- Adjusted Nginx and Traefik configurations to reflect best practices and added necessary comments for user guidance.
- Minor formatting and consistency improvements across documentation files.
This commit is contained in:
Your Name 2026-01-24 00:36:58 +08:00
parent f6b45627e0
commit 8a84caa503
14 changed files with 175 additions and 821 deletions

View file

@ -0,0 +1,23 @@
# ConvertX-CN 最小配置
# 適用於:快速測試、個人使用
#
# 使用方式:
# 1. cp compose.minimal.example.yml docker-compose.yml
# 2. mkdir -p data
# 3. 修改 JWT_SECRET必填
# 4. docker compose up -d
services:
convertx:
image: convertx/convertx-cn:latest
container_name: convertx-cn
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- ./data:/app/data
environment:
- TZ=Asia/Taipei
# ⚠️ 必填:請更換為長且隨機的字串(至少 32 字元)
# 產生方式openssl rand -hex 32
- JWT_SECRET=YOUR_JWT_SECRET_HERE

View file

@ -24,7 +24,7 @@ services:
# =========================================================================
# 使用自訂 entrypoint 安裝額外語言包
# =========================================================================
entrypoint: [ "/bin/sh", "-c" ]
entrypoint: ["/bin/sh", "-c"]
command:
- |
echo "📦 正在安裝額外 OCR 語言包..."

View file

@ -1,5 +1,14 @@
# ConvertX-CN 生產環境配置
# 適用於:正式部署
# 適用於:正式部署(搭配反向代理)
#
# 使用方式:
# 1. cp compose.production.example.yml docker-compose.yml
# 2. mkdir -p data
# 3. 修改 JWT_SECRET必填
# 4. docker compose up -d
#
# 必須修改的欄位:
# - JWT_SECRET
services:
convertx:
@ -11,8 +20,9 @@ services:
volumes:
- ./data:/app/data
environment:
# 必填:登入驗證金鑰(至少 32 字元)
- JWT_SECRET=${JWT_SECRET:?請設定 JWT_SECRET}
# ⚠️ 必填:請更換為長且隨機的字串(至少 32 字元)
# 產生方式openssl rand -hex 32
- JWT_SECRET=YOUR_JWT_SECRET_HERE
# 時區
- TZ=Asia/Taipei

View file

@ -1,11 +1,20 @@
# ConvertX-CN Nginx 反向代理配置範例
# 檔案位置:/etc/nginx/sites-available/convertx
#
# 使用方式:
# 1. 複製到 /etc/nginx/sites-available/convertx
# 2. 將 YOUR_DOMAIN_HERE 替換為你的網域
# 3. ln -s /etc/nginx/sites-available/convertx /etc/nginx/sites-enabled/
# 4. sudo nginx -t && sudo systemctl reload nginx
#
# 必須修改的欄位:
# - YOUR_DOMAIN_HERE共 5 處)
# HTTP → HTTPS 重導向
server {
listen 80;
listen [::]:80;
server_name convertx.example.com;
server_name YOUR_DOMAIN_HERE;
# Let's Encrypt 驗證
location /.well-known/acme-challenge/ {
@ -22,11 +31,11 @@ server {
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name convertx.example.com;
server_name YOUR_DOMAIN_HERE;
# SSL 憑證Let's Encrypt
ssl_certificate /etc/letsencrypt/live/convertx.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/convertx.example.com/privkey.pem;
ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN_HERE/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN_HERE/privkey.pem;
# SSL 設定(安全強化)
ssl_protocols TLSv1.2 TLSv1.3;

View file

@ -1,5 +1,16 @@
# ConvertX-CN + Traefik 配置
# 適用於:使用 Traefik 作為反向代理
#
# 使用方式:
# 1. 確保已有 Traefik 服務且建立 traefik-network
# 2. 複製此檔案並重命名為 docker-compose.yml
# 3. 將 YOUR_DOMAIN_HERE 替換為你的網域
# 4. 將 YOUR_JWT_SECRET_HERE 替換為隨機字串
# 5. docker compose up -d
#
# 必須修改的欄位:
# - YOUR_JWT_SECRET_HERE
# - YOUR_DOMAIN_HERE共 2 處)
services:
convertx:
@ -9,7 +20,8 @@ services:
volumes:
- ./data:/app/data
environment:
- JWT_SECRET=${JWT_SECRET:?請設定 JWT_SECRET}
# ⚠️ 必填:請更換為長且隨機的字串(至少 32 字元)
- JWT_SECRET=YOUR_JWT_SECRET_HERE
- TZ=Asia/Taipei
- HTTP_ALLOWED=false
- TRUST_PROXY=true
@ -17,11 +29,11 @@ services:
labels:
- "traefik.enable=true"
# HTTP 路由
- "traefik.http.routers.convertx.rule=Host(`convertx.example.com`)"
- "traefik.http.routers.convertx.rule=Host(`YOUR_DOMAIN_HERE`)"
- "traefik.http.routers.convertx.entrypoints=web"
- "traefik.http.routers.convertx.middlewares=https-redirect"
# HTTPS 路由
- "traefik.http.routers.convertx-secure.rule=Host(`convertx.example.com`)"
- "traefik.http.routers.convertx-secure.rule=Host(`YOUR_DOMAIN_HERE`)"
- "traefik.http.routers.convertx-secure.entrypoints=websecure"
- "traefik.http.routers.convertx-secure.tls=true"
- "traefik.http.routers.convertx-secure.tls.certresolver=letsencrypt"

View file

@ -1,15 +0,0 @@
# ConvertX-CN 最小配置
# 適用於:快速測試、個人使用
services:
convertx:
image: convertx/convertx-cn:latest
container_name: convertx-cn
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- ./data:/app/data
environment:
- TZ=Asia/Taipei
- JWT_SECRET=請更換為長且隨機的字串至少32字元

View file

@ -6,46 +6,53 @@
## 範例檔案
| 檔案 | 用途 | 說明 |
| --------------------------- | ------------ | ----------------- |
| `最小配置.yml` | 快速啟動 | 最精簡配置 |
| `生產環境配置.yml` | 生產環境 | 包含安全設定 |
| `compose.ocr-languages.yml` | OCR 語言擴展 | 安裝額外 OCR 語言 |
| `Traefik配置.yml` | 反向代理 | Traefik 整合 |
| `Nginx範例配置.conf` | Nginx 設定 | 反向代理設定範例 |
| 檔案 | 用途 | 說明 |
| -------------------------------- | ------------ | ----------------- |
| `compose.minimal.example.yml` | 快速啟動 | 最精簡配置 |
| `compose.production.example.yml` | 生產環境 | 包含安全設定 |
| `compose.ocr-languages.yml` | OCR 語言擴展 | 安裝額外 OCR 語言 |
| `traefik.example.yml` | 反向代理 | Traefik 整合 |
| `nginx.example.conf` | Nginx 設定 | 反向代理設定範例 |
---
## 如何使用
## 快速開始
### 1. 下載範例
### 最小配置(測試 / 個人使用)
```bash
# 下載最小配置
curl -O https://raw.githubusercontent.com/pi-docket/ConvertX-CN/main/docs/samples/compose.minimal.yml
# 1. 複製範例
cp compose.minimal.example.yml docker-compose.yml
# 重命名
mv compose.minimal.yml docker-compose.yml
```
### 2. 修改設定
```bash
# 編輯配置
nano docker-compose.yml
# 重點修改:
# - JWT_SECRET
# - TZ
```
### 3. 啟動
```bash
# 2. 建立資料夾
mkdir -p data
# 3. 修改以下欄位:
# - JWT_SECRET至少 32 字元隨機字串)
# 4. 啟動
docker compose up -d
```
### 生產環境配置
```bash
# 1. 複製範例
cp compose.production.example.yml docker-compose.yml
# 2. 建立資料夾
mkdir -p data
# 3. 修改以下欄位:
# - JWT_SECRET至少 32 字元隨機字串)
# - TZ時區預設 Asia/Taipei
# 4. 啟動
docker compose up -d
```
> 💡 產生隨機 JWT_SECRET`openssl rand -hex 32`
---
## 相關文件