| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #!/bin/bash
- set -e
- echo "=== Auto-SSL 一键部署脚本 ==="
- # 1. 拉取最新代码
- echo "1. 拉取最新代码..."
- git pull origin 0.01
- # 2. 编译后端
- echo "2. 编译Go后端..."
- cd backend
- go build -o autossl .
- cd ..
- # 3. 编译前端
- echo "3. 编译Vue前端..."
- cd frontend
- npm install --include=dev
- npm run build
- cd ..
- # 4. 部署前端资源...
- echo "4. 部署前端资源..."
- rm -rf backend/dist
- mkdir -p backend/dist
- cp -rf frontend/dist/* backend/dist/
- # 5. 创建systemd服务
- echo "5. 安装systemd服务..."
- sudo cp autossl.service /etc/systemd/system/
- sudo systemctl daemon-reload
- sudo systemctl enable autossl
- # 6. 重启服务
- echo "6. 重启服务..."
- sudo systemctl restart autossl
- # 7. 检查状态
- sleep 2
- echo "7. 检查服务状态..."
- if curl -s http://127.0.0.1:9090/api/stats > /dev/null; then
- echo "✅ 部署成功!服务运行在 http://0.0.0.0:9090"
- echo "📝 日志查看:journalctl -u autossl -f"
- else
- echo "❌ 部署失败,请检查日志:journalctl -u autossl -n 50"
- exit 1
- fi
|