refactor: simplify deployment - unified env and startup script

- Remove Docker deployment files (1panel doesn't use Docker)
- Unify .env files: .env.example -> .env (single config file)
- Merge start.sh and start-prod.sh into unified start.sh with --prod flag
- Update setup_dev_env.sh to use .env instead of .env.local
- Add DEPLOY.md with 1panel deployment guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-14 15:16:26 +08:00
parent e255039419
commit f46402f6c9
13 changed files with 375 additions and 841 deletions

111
.env
View File

@@ -1,49 +1,116 @@
# Tool_OCR - Production/Docker Environment Configuration
# For local development, copy .env.example to .env.local and configure there
#
# This file is for Docker deployment or production use.
# Sensitive values should be set via environment variables or secrets management.
# Tool_OCR - Environment Configuration Template
# Copy this file to .env and fill in your actual values
# ===== Database Configuration =====
# Set these via Docker secrets or environment variables in production
MYSQL_HOST=${MYSQL_HOST:-localhost}
MYSQL_PORT=${MYSQL_PORT:-3306}
MYSQL_USER=${MYSQL_USER:-}
MYSQL_PASSWORD=${MYSQL_PASSWORD:-}
MYSQL_DATABASE=${MYSQL_DATABASE:-}
MYSQL_HOST=mysql.theaken.com
MYSQL_PORT=33306
MYSQL_USER=A060
MYSQL_PASSWORD=WLeSCi0yhtc7
MYSQL_DATABASE=db_A060
# ===== Application Configuration =====
# Production port (different from development)
FRONTEND_PORT=12010
# Server ports
BACKEND_PORT=8000
FRONTEND_PORT=5173
# Security - MUST be set via environment variable in production
SECRET_KEY=${SECRET_KEY:-change-this-in-production}
# Security
SECRET_KEY=your-secret-key-here-please-change-this-to-random-string
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440
# ===== External Authentication Configuration =====
EXTERNAL_AUTH_API_URL=${EXTERNAL_AUTH_API_URL:-https://your-auth-api.example.com}
# External authentication API URL
EXTERNAL_AUTH_API_URL=https://pj-auth-api.vercel.app
# Authentication endpoint path
EXTERNAL_AUTH_ENDPOINT=/api/auth/login
# API request timeout in seconds
EXTERNAL_AUTH_TIMEOUT=30
# Token refresh buffer in seconds (refresh tokens X seconds before expiry)
TOKEN_REFRESH_BUFFER=300
# ===== Task Management Configuration =====
# Database table prefix for clear namespace separation
DATABASE_TABLE_PREFIX=tool_ocr_
# Enable task history feature
ENABLE_TASK_HISTORY=true
# Auto-delete old tasks after X days (0 to disable)
TASK_RETENTION_DAYS=30
# Maximum tasks per user (0 for unlimited)
MAX_TASKS_PER_USER=1000
# ===== OCR Configuration =====
# Note: PaddleOCR/PaddleX models are stored in ~/.paddleocr/ and ~/.paddlex/ by default
# Supported languages (comma-separated)
OCR_LANGUAGES=ch,en,japan,korean
# Default confidence threshold
OCR_CONFIDENCE_THRESHOLD=0.5
# Maximum concurrent OCR workers
MAX_OCR_WORKERS=4
# ===== File Configuration =====
# GPU Acceleration Configuration
# Force CPU mode even if GPU is available (default: false)
FORCE_CPU_MODE=false
# GPU memory fraction (0.0-1.0, default: 0.8)
GPU_MEMORY_FRACTION=0.8
# GPU device ID to use (default: 0, -1 for CPU)
GPU_DEVICE_ID=0
# ===== File Upload Configuration =====
# Maximum file size in bytes (50MB default)
MAX_UPLOAD_SIZE=52428800
# Allowed file extensions (comma-separated)
ALLOWED_EXTENSIONS=png,jpg,jpeg,pdf,bmp,tiff,doc,docx,ppt,pptx
# Upload directories
UPLOAD_DIR=./uploads
TEMP_DIR=./uploads/temp
PROCESSED_DIR=./uploads/processed
IMAGES_DIR=./uploads/images
# ===== Export Configuration =====
# Storage directories
STORAGE_DIR=./storage
MARKDOWN_DIR=./storage/markdown
JSON_DIR=./storage/json
EXPORTS_DIR=./storage/exports
# ===== PDF Generation Configuration =====
# Pandoc path (Linux)
PANDOC_PATH=/usr/bin/pandoc
# WeasyPrint font directory
FONT_DIR=/usr/share/fonts
# Default PDF page size
PDF_PAGE_SIZE=A4
# Default PDF margins (mm)
PDF_MARGIN_TOP=20
PDF_MARGIN_BOTTOM=20
PDF_MARGIN_LEFT=20
PDF_MARGIN_RIGHT=20
# ===== Translation Configuration (DIFY API) =====
ENABLE_TRANSLATION=${ENABLE_TRANSLATION:-false}
DIFY_BASE_URL=${DIFY_BASE_URL:-}
DIFY_API_KEY=${DIFY_API_KEY:-}
# Enable translation feature
ENABLE_TRANSLATION=true
# DIFY API base URL
DIFY_BASE_URL=https://dify.theaken.com/v1
# DIFY API key (required for translation)
DIFY_API_KEY=app-YOPrF2ro5fshzMkCZviIuUJd
# API request timeout in seconds
DIFY_TIMEOUT=120.0
# Maximum retry attempts
DIFY_MAX_RETRIES=3
# Batch translation limits
DIFY_MAX_BATCH_CHARS=5000
DIFY_MAX_BATCH_ITEMS=20
# ===== Background Tasks Configuration =====
# Task queue type: memory (default) or redis (future)
TASK_QUEUE_TYPE=memory
# Redis URL (if using redis)
# REDIS_URL=redis://localhost:6379/0
# ===== CORS Configuration =====
CORS_ORIGINS=http://localhost:12010,http://127.0.0.1:12010
# Allowed origins (comma-separated, * for all)
CORS_ORIGINS=http://localhost:5173,http://127.0.0.1:5173
# ===== Logging Configuration =====
LOG_LEVEL=INFO
LOG_LEVEL=DEBUG
LOG_FILE=./logs/app.log