merge origin/main: sync upstream; docker-compose.yml use remote version
Some checks are pending
Test start.ps1 (Windows) / test-windows (push) Waiting to run

Made-with: Cursor
This commit is contained in:
wangbolhr 2026-04-10 16:39:00 +08:00
commit 3b7b06e06f
4 changed files with 91 additions and 19 deletions

View File

@ -1,6 +1,6 @@
## 一键部署
### Linux
### Linux/Mac
```bash
git clone https://git.51easyai.com/wangbo/easyai.git && cd easyai && chmod +x start.sh && ./start.sh
@ -29,6 +29,11 @@ git clone "https://git.51easyai.com/wangbo/easyai.git" "easyai"; Set-Location "e
---
🚀部署问题扫码咨询
![img.png](img.png)
## 更新升级
### 老用户(旧版本部署包)升级教程

View File

@ -11,10 +11,7 @@ services:
- "com.centurylinklabs.watchtower.enable=true"
ports:
- "${WEB_PORT}:3010"
read_only: true
volumes:
# 这一行是关键。它将一个名为 './data/forend/.pm2' 的持久化卷挂载到容器内的 /app/.pm2 目录
- ./data/forend/.pm2:/app/.pm2
# read_only: true
networks:
easyai:
ipv4_address: 172.21.0.8
@ -54,7 +51,7 @@ services:
- "com.centurylinklabs.watchtower.enable=true"
ports:
- "${SERVER_HTTP_PORT}:3001" #http端口
read_only: true
# read_only: true
networks:
easyai:
ipv4_address: 172.21.0.6
@ -68,7 +65,6 @@ services:
- ./data/restores:/app/restores
- ./data/backend/app/tmp:/app/tmp
- ./data/tmp:/tmp
- ./data/backend/.pm2:/app/.pm2
# - ./data/backend/pm2.config.js:/app/pm2.config.js
restart: unless-stopped
environment:
@ -200,7 +196,7 @@ services:
command: [ "redis-server", "/etc/redis/redis.conf" ] # 让 Redis 读取配置文件
# ports:
# - ${REDIS_PORT+${REDIS_PORT}:6379}
read_only: true
# read_only: true
networks:
easyai:
ipv4_address: 172.21.0.4

BIN
img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -143,7 +143,7 @@ run_deploy_questions() {
if [ -n "$DEPLOY_HTTPS_INPUT" ]; then
DEPLOY_HTTPS=$DEPLOY_HTTPS_INPUT
else
read -r -p "3.1 是否启用 HTTPS[y/N]: " https_choice
read -r -p "3.1 是否签名 HTTPS 证书?原来已经有 HTTPS 证书这里选择 N第一次部署或者原来没有证书选 Y [y/N]: " https_choice
DEPLOY_HTTPS=false
if [[ "$https_choice" =~ ^[yY] ]]; then
DEPLOY_HTTPS=true
@ -195,7 +195,13 @@ setup_env_files() {
# 7. Nginx 配置(域名模式)
PROXY_CONF="${DEPLOY_DOMAIN}.conf"
if [ ! -f "$PROXY_CONF" ]; then
sed "s/51easyai.com/${DEPLOY_DOMAIN}/g" easyai-proxy.conf.sample > "$PROXY_CONF"
local proxy_template="easyai-proxy.conf.sample"
if [ ! -f "$proxy_template" ]; then
echo "❌ 未找到 Nginx 配置模板: easyai-proxy.conf.sample"
echo " 请确认仓库文件完整后重试"
exit 1
fi
sed "s/51easyai.com/${DEPLOY_DOMAIN}/g" "$proxy_template" > "$PROXY_CONF"
echo " ✓ Nginx 配置已生成: $PROXY_CONF"
fi
fi
@ -210,20 +216,29 @@ install_docker() {
echo " Docker 安装与检查"
echo "================================"
if [ -f /etc/os-release ]; then
local host_os
host_os="$(uname -s 2>/dev/null || echo Unknown)"
if [[ "$host_os" == "Darwin" ]]; then
OS_FAMILY="macOS"
OS_VERSION_ID="0"
OS_CODENAME=""
elif [ -f /etc/os-release ]; then
. /etc/os-release
case "${ID:-}" in
ubuntu|debian) OS_FAMILY="Ubuntu" ;;
centos|rhel|fedora) OS_FAMILY="CentOS" ;;
*) OS_FAMILY="${ID:-Unknown}" ;;
esac
OS_VERSION_ID=$(grep -oP '(?<=^VERSION_ID=")[0-9.]+' /etc/os-release 2>/dev/null | cut -d'.' -f1 || echo "0")
OS_CODENAME=""
if [[ "$OS_FAMILY" == "Ubuntu" ]]; then
OS_CODENAME=$(lsb_release -cs 2>/dev/null || (grep VERSION_CODENAME /etc/os-release 2>/dev/null | cut -d= -f2 | tr -d '"'))
fi
else
OS_FAMILY=$(hostnamectl 2>/dev/null | grep "Operating System" | awk '{print $3}' || echo "Unknown")
fi
OS_VERSION_ID=$(grep -oP '(?<=^VERSION_ID=")[0-9.]+' /etc/os-release 2>/dev/null | cut -d'.' -f1 || echo "0")
OS_CODENAME=""
if [[ "$OS_FAMILY" == "Ubuntu" ]]; then
OS_CODENAME=$(lsb_release -cs 2>/dev/null || (grep VERSION_CODENAME /etc/os-release 2>/dev/null | cut -d= -f2 | tr -d '"'))
OS_VERSION_ID="0"
OS_CODENAME=""
fi
UBUNTU_DOCKER_MIRROR_URL="https://mirrors.ustc.edu.cn/docker-ce"
@ -240,6 +255,38 @@ install_docker() {
}
check_network
install_docker_macos() {
if ! command -v brew &>/dev/null; then
echo "❌ 未检测到 Homebrew无法自动安装 Docker Desktop。"
echo " 请先安装 Homebrew: https://brew.sh/"
return 1
fi
if brew list --cask docker &>/dev/null; then
echo "✅ Docker Desktop 已安装Homebrew"
else
echo "📦 正在通过 Homebrew 安装 Docker Desktop..."
brew install --cask docker
fi
echo "🚀 正在尝试启动 Docker Desktop..."
open -a Docker || true
echo "⏳ 等待 Docker 引擎就绪(最多 120 秒)..."
local i
for i in $(seq 1 60); do
if docker info &>/dev/null; then
echo "✅ Docker Desktop 已启动并可用"
return 0
fi
sleep 2
done
echo "⚠️ Docker Desktop 已安装,但尚未就绪。"
echo " 请手动打开 Docker Desktop待状态正常后重新运行 ./start.sh"
return 1
}
if command -v docker &>/dev/null; then
echo "✅ Docker 已安装"
else
@ -259,13 +306,37 @@ install_docker() {
sudo sed -i "s+https://download.docker.com+$CENTOS_DOCKER_MIRROR_URL+g" /etc/yum.repos.d/docker-ce.repo
[[ "$OS_VERSION_ID" -ge "8" ]] && sudo yum module disable -y container-tools 2>/dev/null || true
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
elif [[ "$OS_FAMILY" == "macOS" ]]; then
echo "⚠️ 检测到 macOS未找到 Docker。"
echo "请选择安装方式:"
echo " [1] 自动安装 Docker Desktop需要 Homebrew"
echo " [2] 手动安装(默认)"
read -r -p "请选择 [1/2]: " mac_install_choice
case "${mac_install_choice:-2}" in
1)
if ! install_docker_macos; then
exit 1
fi
;;
2)
echo " 请手动安装 Docker Desktop: https://www.docker.com/products/docker-desktop/"
echo " 安装并启动 Docker Desktop 后,重新运行 ./start.sh"
exit 1
;;
*)
echo "❌ 无效选择"
exit 1
;;
esac
else
echo "❌ 不支持的操作系统: $OS_FAMILY"
exit 1
fi
sudo systemctl enable docker
sudo systemctl start docker
getent group docker | grep -qw "$USER" || sudo usermod -aG docker "$USER"
if [[ "$OS_FAMILY" != "macOS" ]]; then
sudo systemctl enable docker
sudo systemctl start docker
getent group docker | grep -qw "$USER" || sudo usermod -aG docker "$USER"
fi
fi
if docker compose version &>/dev/null; then