Files
2026-04-07 14:11:45 +08:00

94 lines
1.9 KiB
Bash
Raw Permalink 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
# ///
# start_amd64.sh
# 描述:AMD64 架构启动脚本 (Intel/AMD 服务器)
# 作者:AI Generated
# 创建日期:2026-04-05
#
# 使用方式:
# ./start_amd64.sh # 启动所有服务
# ./start_amd64.sh status # 查看服务状态
# ./start_amd64.sh stop # 停止所有服务
# ./start_amd64.sh logs # 查看日志
# ./start_amd64.sh rebuild # 重新构建镜像
# ///
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
check_docker() {
if ! command -v docker &> /dev/null; then
echo "❌ Docker 未安装,请先安装 Docker"
exit 1
fi
if ! command -v docker compose &> /dev/null && ! docker compose version &> /dev/null; then
echo "❌ Docker Compose 未安装"
exit 1
fi
}
start() {
echo "🚀 启动 WXAuto Center (AMD64)..."
mkdir -p data/db data/redis data/logs
docker compose up -d
echo "✅ 服务启动完成!"
echo " - PostgreSQL: localhost:5432"
echo " - Redis: localhost:6379"
echo " - WXAuto Center: http://localhost:8080"
echo " - API文档: http://localhost:8080/docs"
}
stop() {
echo "🛑 停止 WXAuto Center..."
docker compose down
echo "✅ 服务已停止"
}
status() {
echo "📊 服务状态:"
docker compose ps
}
logs() {
echo "📋 日志 (Ctrl+C 退出)"
docker compose logs -f
}
rebuild() {
echo "🔨 重新构建镜像..."
docker compose down
docker build -t wxauto-center:latest .
docker compose up -d
echo "✅ 重建完成"
}
case "${1:-start}" in
start)
check_docker
start
;;
stop)
stop
;;
status)
status
;;
logs)
logs
;;
rebuild)
rebuild
;;
*)
echo "用法: $0 {start|stop|status|logs|rebuild}"
exit 1
;;
esac