AriStockAI/run-local.sh
fanfpy 92029b89e9 refactor(consul): 更新服务检查地址为远程IP并重构部署脚本
将Consul配置中的服务检查地址从容器名改为远程IP地址,以支持跨服务器健康检查
删除旧的部署脚本和配置文件,新增分离的远程和本地部署脚本
重构docker-compose配置为远程和本地两个版本,优化服务部署结构
2025-07-21 17:35:36 +08:00

43 lines
1.4 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
set -e
# 本地服务器启动脚本:部署业务服务
# 配置参数
REGISTRY="crpi-amr0dt5e5pywqwaf.cn-hangzhou.personal.cr.aliyuncs.com"
VERSION="latest"
COMPOSE_FILE=docker-compose.local.yml
USERNAME="2324802641zhengniannian@gmail.com"
# 远程Consul地址请替换为实际远程服务器IP
REMOTE_CONSUL_IP="your_remote_consul_server_ip"
# 检查Docker和Docker Compose
if ! command -v docker &> /dev/null; then
echo "错误: Docker未安装"
exit 1
fi
if ! docker compose version &> /dev/null; then
echo "错误: Docker Compose未安装"
exit 1
fi
# 登录Docker仓库
echo "登录阿里云Docker仓库..."
docker login --username=$USERNAME $REGISTRY
if [ $? -ne 0 ]; then
echo "错误: 仓库登录失败"
exit 1
fi
# 启动本地业务服务不包含Consul和Traefik
echo "正在启动本地业务服务..."
VERSION=$VERSION CONSUL_HTTP_ADDR="$REMOTE_CONSUL_IP:8500" docker compose -f $COMPOSE_FILE up -d data-service emotion-service frontend quant-service recommend-service user-service
# 显示状态
echo "\n本地服务状态:"
docker compose -f $COMPOSE_FILE ps data-service emotion-service frontend quant-service recommend-service user-service
echo "\n查看日志命令: docker compose -f $COMPOSE_FILE logs -f"
echo "停止服务命令: docker compose -f $COMPOSE_FILE down"
echo "\n本地业务服务启动完成"
exit 0