Files
bttoxin-pipeline/docker-start.sh
zly c75c85c53b Refactor: Unified pipeline execution, simplified UI, and fixed Docker config
- Backend: Refactored tasks.py to directly invoke run_single_fna_pipeline.py for consistency.
- Backend: Changed output format to ZIP and added auto-cleanup of intermediate files.
- Backend: Fixed language parameter passing in API and tasks.
- Frontend: Removed CRISPR Fusion UI elements from Submit and Monitor views.
- Frontend: Implemented simulated progress bar for better UX.
- Frontend: Restored One-click load button and added result file structure documentation.
- Docker: Fixed critical Restarting loop by removing incorrect image directive in docker-compose.yml.
- Docker: Optimized Dockerfile to correct .pixi environment path issues and prevent accidental deletion of frontend assets.
2026-01-20 20:25:25 +08:00

169 lines
4.5 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# BtToxin Pipeline Docker 启动脚本
# 用法: ./docker-start.sh [mode]
#
# 可用模式:
# simple - 单容器 Nginx 部署(默认,推荐用于快速测试)
# traefik - Traefik 多容器部署(生产环境)
# test - 测试配置
# dev - 开发模式(热重载)
set -e
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# 获取脚本所在目录
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DOCKER_DIR="${SCRIPT_DIR}/docker"
# 显示帮助信息
show_help() {
echo "BtToxin Pipeline Docker 启动脚本"
echo ""
echo "用法: ./docker-start.sh [mode]"
echo ""
echo "可用模式:"
echo " simple - 单容器 Nginx 部署(默认,推荐用于快速测试)"
echo " traefik - Traefik 多容器部署(生产环境)"
echo " test - 测试配置"
echo " dev - 开发模式(热重载)"
echo ""
echo "示例:"
echo " ./docker-start.sh # 使用默认 simple 模式"
echo " ./docker-start.sh simple # 单容器部署"
echo " ./docker-start.sh traefik # Traefik 部署"
echo ""
}
# 检查 Docker 是否运行
check_docker() {
if ! docker info > /dev/null 2>&1; then
echo -e "${RED}错误: Docker 未运行,请先启动 Docker${NC}"
exit 1
fi
}
# 创建必要的目录
create_directories() {
mkdir -p "${SCRIPT_DIR}/jobs"
mkdir -p "${SCRIPT_DIR}/Data/uploads"
mkdir -p "${SCRIPT_DIR}/Data/results"
# 确保权限宽容防止容器内非root用户无法写入
chmod 777 "${SCRIPT_DIR}/Data/uploads"
chmod 777 "${SCRIPT_DIR}/Data/results"
echo -e "${GREEN}✓ 已创建必要的目录 (jobs, Data/uploads, Data/results)${NC}"
}
# Simple 模式启动
start_simple() {
echo -e "${YELLOW}启动 Simple 模式...${NC}"
docker compose -f "${DOCKER_DIR}/compose/docker-compose.simple.yml" up -d
echo -e "${GREEN}✓ Simple 模式已启动${NC}"
echo ""
echo "访问地址:"
echo " 前端: http://localhost"
echo " API: http://localhost/api/docs"
}
# Traefik 模式启动
start_traefik() {
echo -e "${YELLOW}启动 Traefik 模式...${NC}"
# 初始化 acme.json
mkdir -p "${DOCKER_DIR}/traefik"
if [ ! -f "${DOCKER_DIR}/traefik/acme.json" ]; then
echo "{}" > "${DOCKER_DIR}/traefik/acme.json"
chmod 600 "${DOCKER_DIR}/traefik/acme.json"
echo -e "${GREEN}✓ 已初始化 acme.json${NC}"
fi
docker compose -f "${DOCKER_DIR}/compose/docker-compose.traefik.yml" up -d
echo -e "${GREEN}✓ Traefik 模式已启动${NC}"
echo ""
echo "访问地址:"
echo " 前端: http://localhost"
echo " API: http://localhost/api/docs"
echo " Traefik: http://localhost:8080"
}
# Test 模式启动
start_test() {
echo -e "${YELLOW}启动 Test 模式...${NC}"
docker compose -f "${DOCKER_DIR}/compose/docker-compose.test.yml" up -d
echo -e "${GREEN}✓ Test 模式已启动${NC}"
echo ""
echo "访问地址:"
echo " 服务: https://localhost:443"
}
# Dev 模式启动
start_dev() {
echo -e "${YELLOW}启动 Dev 模式...${NC}"
docker compose -f "${DOCKER_DIR}/compose/docker-compose.yml" up -d bttoxin-dev
echo -e "${GREEN}✓ Dev 模式已启动${NC}"
echo ""
echo "访问地址:"
echo " 前端: http://localhost:5173"
echo " 后端: http://localhost:8000"
}
# 主逻辑
main() {
local mode="${1:-simple}"
# 检查参数
if [ "$mode" = "-h" ] || [ "$mode" = "--help" ]; then
show_help
exit 0
fi
echo "=========================================="
echo " BtToxin Pipeline Docker 启动脚本"
echo "=========================================="
echo ""
# 检查 Docker
check_docker
# 创建目录
create_directories
# 根据模式启动
case "$mode" in
simple)
start_simple
;;
traefik)
start_traefik
;;
test)
start_test
;;
dev)
start_dev
;;
*)
echo -e "${RED}错误: 未知的模式 '$mode'${NC}"
echo ""
show_help
exit 1
;;
esac
echo ""
echo -e "${GREEN}启动完成!${NC}"
echo ""
echo "查看日志:"
echo " docker compose -f ${DOCKER_DIR}/compose/docker-compose.${mode}.yml logs -f"
echo ""
echo "停止服务:"
echo " docker compose -f ${DOCKER_DIR}/compose/docker-compose.${mode}.yml down"
}
# 运行主函数
main "$@"