Files
aiops/deploy/README.md
T
Logan.Li aac15122e5 chore(deploy): 删除废弃 nginx 配置并更新部署文档
- 移除 deploy/nginx/(旧前后端分离方案已无引用)
- 重写 deploy/README.md 对齐 embed 三种部署方式
- 更新 deploy/kubernetes/README.md(lghost/aiops 镜像与 release 命令)
2026-06-26 19:08:10 +08:00

114 lines
2.9 KiB
Markdown
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.
# AIOps 部署资源
本目录存放**运维部署清单**(与 `frontend/src/components/deploy/` 应用发布模块无关)。
## 目录结构
```
deploy/
├── kubernetes/ # K8s 清单(./run.sh kubernetes 使用)
│ ├── namespace.yaml
│ ├── secret.yaml
│ ├── configmap.yaml
│ ├── mysql.yaml / redis.yaml
│ ├── deployment.yaml # embed 单容器,镜像 lghost/aiops:<tag>
│ ├── ingress.yaml
│ └── README.md
└── binary/
└── install.sh # 裸机 systemd 安装脚本(可选)
```
> 已移除 `deploy/nginx/`:旧版前后端分离 Nginx 容器方案已废弃,统一 embed 单端口 8080。
---
## 部署方式对比
| 方式 | 命令 | 架构 |
|------|------|------|
| **Docker Compose** | `./run.sh docker up` | MySQL + Redis + AIOps embed(3 容器,:8080) |
| **独立二进制** | `./run.sh build` → `./aiops` | 单文件 embed,项目根目录 |
| **Kubernetes** | `./run.sh kubernetes deploy` | embed 单 Pod + MySQL/Redis StatefulSet |
| **发版推送** | `./run.sh release v1.5.0` | 二进制 + `lghost/aiops:v1.5.0` 镜像 |
详见 [docs/deployment.md](../docs/deployment.md)。
---
## 一、Docker Compose(推荐单机)
```bash
./run.sh docker up
./run.sh docker up v1.5.0 # 指定版本
# 访问
http://localhost:8080
http://localhost:8080/version
```
连接外部 MySQL/Redis 时使用根目录 `docker-compose.k8s.yml`。
---
## 二、独立二进制(无 Docker)
### 本机构建
```bash
./run.sh build tag v1.5.0
./aiops version
./run.sh binary upgrade # 本机后台启动
```
### 远程 Linux 服务器(systemd)
```bash
# 1. 在 Linux 上构建,或从 CI 拷贝 linux/amd64 二进制
scp ./aiops deploy/binary/install.sh root@<server>:/tmp/
# 2. 安装
ssh root@<server> 'cd /tmp && bash install.sh install'
# 3. 配置并启动
vim /opt/aiops/config.yaml
systemctl start aiops
systemctl status aiops
```
> Mac 上 `./run.sh build` 产出 darwin 二进制,不能直接在 Linux 运行。Linux 部署请用 Docker 镜像或在 Linux 上编译。
---
## 三、Kubernetes
```bash
# 一键部署(构建镜像 + apply 全部清单)
./run.sh kubernetes deploy
./run.sh kubernetes deploy v1.5.0
# 滚动更新 + 推送 Docker Hub
./run.sh release v1.5.0
./run.sh kubernetes upgrade v1.5.0
# 运维
./run.sh kubernetes status
./run.sh kubernetes logs
./run.sh kubernetes delete
```
清单目录:`deploy/kubernetes/`
默认镜像:`lghost/aiops:<tag>`,NodePort `30080`。
详见 [kubernetes/README.md](./kubernetes/README.md)。
---
## 快速选择
| 环境 | 推荐 |
|------|------|
| 本地开发 | `./run.sh dev` |
| 单机演示/测试 | `./run.sh docker up` |
| 无 Docker 的 Linux | `./aiops` + `deploy/binary/install.sh` |
| K8s 集群 | `./run.sh kubernetes deploy` |
| 版本发布 | `./run.sh release v1.x` |