Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions ENV_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,46 @@ export SEARCH_BACKEND=DuckDuckGo
export NO_FORCE_TERMINAL=false
```

## Alerting 服务环境变量(数据库 + Webhook 鉴权)

用于接收 Alertmanager Webhook 并将事件入库。

### macOS/Linux
```bash
# 数据库连接(示例:本机 Docker Postgres)
export DB_HOST=localhost
export DB_PORT=5432
export DB_USER=postgres
export DB_PASSWORD=postgres
export DB_NAME=zeroops
export DB_SSLMODE=disable

# Webhook 鉴权(与 Alertmanager http_config 对齐,二选一)
# 1) Basic Auth
export ALERT_WEBHOOK_BASIC_USER=alert
export ALERT_WEBHOOK_BASIC_PASS=REDACTED
# 2) Bearer Token(如使用该方式,注释掉上面的 Basic)
# export ALERT_WEBHOOK_BEARER=your_token_here
```

### Windows(PowerShell)
```powershell
$env:DB_HOST="localhost"
$env:DB_PORT="5432"
$env:DB_USER="postgres"
$env:DB_PASSWORD="postgres"
$env:DB_NAME="zeroops"
$env:DB_SSLMODE="disable"

# Basic Auth
$env:ALERT_WEBHOOK_BASIC_USER="alert"
$env:ALERT_WEBHOOK_BASIC_PASS="REDACTED"
# 或 Bearer
# $env:ALERT_WEBHOOK_BEARER="your_token_here"
```

> 启动服务后,可用 README 中的 curl 示例向 `/v1/integrations/alertmanager/webhook` 发送事件并在数据库中验证。

## 环境变量详细说明

### 必需配置
Expand Down
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"typescript": "~5.8.0",
"vite": "^7.0.6",
"vite-plugin-vue-devtools": "^8.0.0",
"vue-eslint-parser": "^10",
"vue-tsc": "^3.0.4"
}
}
1 change: 0 additions & 1 deletion client/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import axios from 'axios'

// 创建 axios 实例
const api = axios.create({
baseURL: 'http://localhost:8070', // 发布准备服务端口
timeout: 10000,
headers: {
'Content-Type': 'application/json'
Expand Down
32 changes: 32 additions & 0 deletions client/src/mock/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,38 @@ export class MockApiService {
return { status: 200 }
}

// 创建部署计划 - 新的API接口
static async createDeployment(data: {service: string, version: string, scheduleTime?: string}): Promise<{ status: number, data: {id: string, message: string} }> {
await delay(500)
console.log(`Mock API: 创建部署计划 - service: ${data.service}, version: ${data.version}`)

// 生成模拟的部署ID
const deployID = `deploy-${Date.now()}`

// 模拟创建成功,返回状态码201
return {
status: 201,
data: {
id: deployID,
message: 'deployment created successfully'
}
}
}

// 更新部署计划 - 新的API接口
static async updateDeployment(deployID: string, data: {version?: string, scheduleTime?: string}): Promise<{ status: number, data: {message: string} }> {
await delay(300)
console.log(`Mock API: 更新部署计划 - ${deployID}`, data)

// 模拟更新成功,返回状态码200
return {
status: 200,
data: {
message: 'deployment updated successfully'
}
}
}

// 获取部署变更记录 - 新的API接口
static async getDeploymentChangelog(start?: string, limit?: number): Promise<DeploymentChangelogResponse> {
await delay(300)
Expand Down
Loading