Compare commits
6 Commits
dev_1.0.0_
...
dev_1.0.0_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0d451cbe7 | ||
|
|
835e81282f | ||
|
|
c4582c99bc | ||
|
|
299765ed40 | ||
|
|
a8bbf2d6e9 | ||
|
|
d1b89c0cf6 |
@@ -10,6 +10,7 @@ Usage: $0 [OPTIONS]
|
||||
Options:
|
||||
--intranet Use intranet mirror for log/bind builds
|
||||
--master-offline Build master offline image (requires src/master/offline_wheels.tar.gz)
|
||||
--metric Build metric module images (ftp, prometheus, grafana, test nodes)
|
||||
--no-cache Build all images without using Docker layer cache
|
||||
-h, --help Show this help message
|
||||
|
||||
@@ -17,13 +18,15 @@ Examples:
|
||||
$0 # Build with default sources
|
||||
$0 --intranet # Build with intranet mirror
|
||||
$0 --master-offline # Additionally build argus-master:offline
|
||||
$0 --intranet --master-offline
|
||||
$0 --metric # Additionally build metric module images
|
||||
$0 --intranet --master-offline --metric
|
||||
EOF
|
||||
}
|
||||
|
||||
use_intranet=false
|
||||
build_master=true
|
||||
build_master_offline=false
|
||||
build_metric=true
|
||||
no_cache=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
@@ -41,6 +44,10 @@ while [[ $# -gt 0 ]]; do
|
||||
build_master_offline=true
|
||||
shift
|
||||
;;
|
||||
--metric)
|
||||
build_metric=true
|
||||
shift
|
||||
;;
|
||||
--no-cache)
|
||||
no_cache=true
|
||||
shift
|
||||
@@ -184,6 +191,33 @@ if [[ "$build_master" == true ]]; then
|
||||
popd >/dev/null
|
||||
fi
|
||||
|
||||
if [[ "$build_metric" == true ]]; then
|
||||
echo ""
|
||||
echo "Building Metric module images..."
|
||||
metric_root="$root/src/metric"
|
||||
pushd "$metric_root/tests" >/dev/null
|
||||
|
||||
# 检查docker-compose.yml是否存在
|
||||
if [[ ! -f "docker-compose.yml" ]]; then
|
||||
echo "docker-compose.yml not found in $metric_root/tests" >&2
|
||||
build_failed=true
|
||||
else
|
||||
# 构建metric镜像
|
||||
if docker compose build --no-cache; then
|
||||
images_built+=("argus-metric-ftp:latest")
|
||||
images_built+=("argus-metric-prometheus:latest")
|
||||
images_built+=("argus-metric-grafana:latest")
|
||||
images_built+=("argus-metric-test-node:latest")
|
||||
images_built+=("argus-metric-test-gpu-node:latest")
|
||||
else
|
||||
echo "Failed to build metric module images"
|
||||
build_failed=true
|
||||
fi
|
||||
fi
|
||||
|
||||
popd >/dev/null
|
||||
fi
|
||||
|
||||
echo "======================================="
|
||||
echo "📦 Build Summary"
|
||||
echo "======================================="
|
||||
@@ -210,7 +244,6 @@ if [[ "$build_master_offline" == true ]]; then
|
||||
echo ""
|
||||
echo "🧳 Master offline wheels 已解压到 $master_offline_dir"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🚀 Next steps:"
|
||||
echo " ./build/save_images.sh --compress # 导出镜像"
|
||||
|
||||
@@ -68,6 +68,11 @@ declare -A images=(
|
||||
["argus-kibana:latest"]="argus-kibana-latest.tar"
|
||||
["argus-bind9:latest"]="argus-bind9-latest.tar"
|
||||
["argus-master:offline"]="argus-master-offline.tar"
|
||||
["argus-metric-ftp:latest"]="argus-metric-ftp-latest.tar"
|
||||
["argus-metric-prometheus:latest"]="argus-metric-prometheus-latest.tar"
|
||||
["argus-metric-grafana:latest"]="argus-metric-grafana-latest.tar"
|
||||
["argus-metric-test-node:latest"]="argus-metric-test-node-latest.tar"
|
||||
["argus-metric-test-gpu-node:latest"]="argus-metric-test-gpu-node-latest.tar"
|
||||
)
|
||||
|
||||
# 函数:检查镜像是否存在
|
||||
|
||||
@@ -1,13 +1,31 @@
|
||||
# Alertmanager
|
||||
|
||||
## 启动示例
|
||||
## 构建
|
||||
1. 首先设置构建和部署的环境变量, 在项目根目录下执行:
|
||||
```bash
|
||||
cp src/alert/tests/.env.example src/alert/tests/.env
|
||||
```
|
||||
|
||||
然后找到复制出来的.env文件,修改环境变量。
|
||||
|
||||
2. 使用脚本构建,在项目根目录下执行:
|
||||
|
||||
```bash
|
||||
docker run -d --name alertmanager \
|
||||
-p 9093:9093 \
|
||||
-v /opt/alertmanager/data:/alertmanager \
|
||||
argus-alert:latest
|
||||
bash src/alert/alertmanager/build/build.sh
|
||||
```
|
||||
|
||||
构建成功后,会在项目根目录下生成argus-alertmanager-latest.tar
|
||||
|
||||
## 部署
|
||||
|
||||
提供docker-compose部署。在src/alert/tests目录下
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## 动态配置
|
||||
修改alertmanager.yml后,调用`/-/reload`接口可以重新加载配置
|
||||
配置文件放在`/private/argus/alert/alertmanager/alertmanager.yml`下,修改alertmanager.yml后,调用`http://alertmanager.alert.argus.com:9093/-/reload`接口(POST)可以重新加载配置.
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:9093/-/reload
|
||||
```
|
||||
|
||||
@@ -19,8 +19,11 @@ RUN wget https://github.com/prometheus/alertmanager/releases/download/v${ALERTMA
|
||||
rm alertmanager-${ALERTMANAGER_VERSION}.linux-amd64.tar.gz
|
||||
|
||||
ENV ALERTMANAGER_BASE_PATH=/private/argus/alert/alertmanager
|
||||
ENV ARGUS_UID=2133
|
||||
ENV ARGUS_GID=2015
|
||||
|
||||
ARG ARGUS_UID=2133
|
||||
ARG ARGUS_GID=2015
|
||||
ENV ARGUS_UID=${ARGUS_UID}
|
||||
ENV ARGUS_GID=${ARGUS_GID}
|
||||
|
||||
RUN mkdir -p /usr/share/alertmanager && \
|
||||
mkdir -p ${ALERTMANAGER_BASE_PATH} && \
|
||||
|
||||
13
src/alert/alertmanager/build/build.sh
Normal file
13
src/alert/alertmanager/build/build.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
docker pull ubuntu:24.04
|
||||
|
||||
source src/alert/tests/.env
|
||||
|
||||
docker build \
|
||||
--build-arg ARGUS_UID=${ARGUS_UID} \
|
||||
--build-arg ARGUS_GID=${ARGUS_GID} \
|
||||
-f src/alert/alertmanager/build/Dockerfile \
|
||||
-t argus-alertmanager:latest .
|
||||
|
||||
docker save -o argus-alertmanager-latest.tar argus-alertmanager:latest
|
||||
@@ -18,6 +18,7 @@ DOMAIN=alertmanager.alert.argus.com
|
||||
IP=$(ifconfig | grep -A 1 eth0 | grep inet | awk '{print $2}')
|
||||
echo "current IP: ${IP}"
|
||||
echo "${IP}" > /private/argus/etc/${DOMAIN}
|
||||
chmod 755 /private/argus/etc/${DOMAIN}
|
||||
|
||||
|
||||
echo "[INFO] Starting Alertmanager process..."
|
||||
|
||||
@@ -55,6 +55,6 @@ alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets:
|
||||
- "localhost:9093" # Alertmanager 地址
|
||||
- "alertmanager.alert.argus.com:9093" # Alertmanager 地址
|
||||
|
||||
```
|
||||
5
src/alert/tests/.env
Normal file
5
src/alert/tests/.env
Normal file
@@ -0,0 +1,5 @@
|
||||
DATA_ROOT=/home/argus/tmp/private/argus
|
||||
ARGUS_UID=1048
|
||||
ARGUS_GID=1048
|
||||
|
||||
USE_INTRANET=false
|
||||
5
src/alert/tests/.env.example
Normal file
5
src/alert/tests/.env.example
Normal file
@@ -0,0 +1,5 @@
|
||||
DATA_ROOT=/home/argus/tmp/private/argus
|
||||
ARGUS_UID=1048
|
||||
ARGUS_GID=1048
|
||||
|
||||
USE_INTRANET=false
|
||||
@@ -1,4 +1,3 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
alertmanager:
|
||||
build:
|
||||
@@ -17,20 +16,21 @@ services:
|
||||
ports:
|
||||
- "${ARGUS_PORT:-9093}:9093"
|
||||
volumes:
|
||||
- ${DATA_ROOT:-./data}/alertmanager:/private/argus/alert/alertmanager
|
||||
- ${DATA_ROOT:-./data}/alert/alertmanager:/private/argus/alert/alertmanager
|
||||
- ${DATA_ROOT:-./data}/etc:/private/argus/etc
|
||||
networks:
|
||||
- argus-network
|
||||
- argus-debug-net
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
networks:
|
||||
argus-network:
|
||||
argus-debug-net:
|
||||
driver: bridge
|
||||
name: argus-network
|
||||
name: argus-debug-net
|
||||
|
||||
volumes:
|
||||
alertmanager_data:
|
||||
|
||||
@@ -5,13 +5,6 @@ networks:
|
||||
|
||||
services:
|
||||
ftp:
|
||||
build:
|
||||
context: ../ftp/build
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
ARGUS_BUILD_UID: ${ARGUS_BUILD_UID:-2133}
|
||||
ARGUS_BUILD_GID: ${ARGUS_BUILD_GID:-2015}
|
||||
USE_INTRANET: ${USE_INTRANET:-false}
|
||||
image: argus-metric-ftp:latest
|
||||
container_name: argus-ftp
|
||||
restart: unless-stopped
|
||||
@@ -41,13 +34,6 @@ services:
|
||||
max-file: "3"
|
||||
|
||||
prometheus:
|
||||
build:
|
||||
context: ../prometheus/build
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
ARGUS_BUILD_UID: ${ARGUS_BUILD_UID:-2133}
|
||||
ARGUS_BUILD_GID: ${ARGUS_BUILD_GID:-2015}
|
||||
USE_INTRANET: ${USE_INTRANET:-false}
|
||||
image: argus-metric-prometheus:latest
|
||||
container_name: argus-prometheus
|
||||
restart: unless-stopped
|
||||
@@ -73,12 +59,6 @@ services:
|
||||
max-file: "3"
|
||||
|
||||
grafana:
|
||||
build:
|
||||
context: ../grafana/build
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
ARGUS_BUILD_UID: ${ARGUS_BUILD_UID:-2133}
|
||||
ARGUS_BUILD_GID: ${ARGUS_BUILD_GID:-2015}
|
||||
image: argus-metric-grafana:latest
|
||||
container_name: argus-grafana
|
||||
restart: unless-stopped
|
||||
@@ -109,9 +89,6 @@ services:
|
||||
max-file: "3"
|
||||
|
||||
test-node:
|
||||
build:
|
||||
context: ./client-test-node/build
|
||||
dockerfile: Dockerfile
|
||||
image: argus-metric-test-node:latest
|
||||
container_name: argus-metric-test-node
|
||||
hostname: test-metric-node-001
|
||||
@@ -143,9 +120,6 @@ services:
|
||||
max-file: "3"
|
||||
|
||||
test-gpu-node:
|
||||
build:
|
||||
context: ./client-test-gpu-node/build
|
||||
dockerfile: Dockerfile
|
||||
image: argus-metric-test-gpu-node:latest
|
||||
container_name: argus-metric-test-gpu-node
|
||||
hostname: test-metric-gpu-node-001
|
||||
|
||||
@@ -3,15 +3,8 @@ set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# 解析参数
|
||||
REBUILD_FLAG=""
|
||||
if [[ "$1" == "--rebuild" || "$1" == "-r" ]]; then
|
||||
REBUILD_FLAG="--rebuild"
|
||||
echo "[01] 启用强制重新构建模式"
|
||||
fi
|
||||
|
||||
echo "[01] 启动所有服务..."
|
||||
bash "$SCRIPT_DIR/common/start-all.sh" $REBUILD_FLAG
|
||||
bash "$SCRIPT_DIR/common/start-all.sh"
|
||||
|
||||
echo "[01] 等待服务就绪..."
|
||||
sleep 5
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
COMMON_DIR="$SCRIPT_DIR/common"
|
||||
|
||||
FTP_SERVER="${FTP_SERVER:-172.30.0.40}"
|
||||
FTP_USER="${FTP_USER:-ftpuser}"
|
||||
FTP_PASSWORD="${FTP_PASSWORD:-ZGClab1234!}"
|
||||
@@ -8,26 +11,37 @@ FTP_PORT="${FTP_PORT:-21}"
|
||||
|
||||
FTP_HOST="${FTP_SERVER}"
|
||||
|
||||
echo "[03] 进入测试节点执行安装..."
|
||||
echo "[03] 使用 FTP 地址: ${FTP_HOST}:${FTP_PORT}"
|
||||
echo "[04] 检测GPU环境..."
|
||||
# 检测GPU环境
|
||||
if bash "$COMMON_DIR/check-gpu.sh"; then
|
||||
echo "[04] GPU环境可用,继续执行GPU节点安装"
|
||||
GPU_AVAILABLE=true
|
||||
else
|
||||
echo "[04] GPU环境不可用,跳过GPU节点安装"
|
||||
GPU_AVAILABLE=false
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "[04] 进入测试节点执行安装..."
|
||||
echo "[04] 使用 FTP 地址: ${FTP_HOST}:${FTP_PORT}"
|
||||
|
||||
docker exec argus-metric-test-gpu-node bash -c "
|
||||
set -e
|
||||
|
||||
if ! command -v curl &>/dev/null; then
|
||||
echo '[03] curl 未安装,正在安装...'
|
||||
echo '[04] curl 未安装,正在安装...'
|
||||
apt-get update && apt-get install -y curl
|
||||
fi
|
||||
|
||||
cd /tmp
|
||||
echo '[03] 下载 setup.sh...'
|
||||
echo '[04] 下载 setup.sh...'
|
||||
curl -u ${FTP_USER}:${FTP_PASSWORD} ftp://${FTP_HOST}:${FTP_PORT}/setup.sh -o setup.sh
|
||||
|
||||
echo '[03] 执行安装...'
|
||||
echo '[04] 执行安装...'
|
||||
chmod +x setup.sh
|
||||
bash setup.sh --server ${FTP_HOST} --user ${FTP_USER} --password '${FTP_PASSWORD}' --port ${FTP_PORT}
|
||||
|
||||
echo '[03] 安装完成'
|
||||
echo '[04] 安装完成'
|
||||
"
|
||||
|
||||
echo "[03] 完成"
|
||||
echo "[04] 完成"
|
||||
|
||||
59
src/metric/tests/scripts/common/check-gpu.sh
Executable file
59
src/metric/tests/scripts/common/check-gpu.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
# GPU环境检测脚本
|
||||
# 检测系统是否有NVIDIA GPU硬件
|
||||
|
||||
set -e
|
||||
|
||||
# 检测函数
|
||||
check_gpu_support() {
|
||||
echo "检测GPU环境..."
|
||||
|
||||
# 方法1: 检测GPU设备文件
|
||||
if ls /dev/nvidia* &>/dev/null; then
|
||||
echo "✓ 检测到NVIDIA GPU设备文件"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# 方法2: 检测lspci中的NVIDIA设备(Linux)
|
||||
if command -v lspci &> /dev/null; then
|
||||
if lspci | grep -i nvidia &> /dev/null; then
|
||||
echo "✓ 检测到NVIDIA GPU硬件"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# 方法3: 检测nvidia-smi
|
||||
if command -v nvidia-smi &> /dev/null; then
|
||||
if nvidia-smi &> /dev/null; then
|
||||
echo "✓ 检测到NVIDIA GPU硬件"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "✗ 未检测到NVIDIA GPU硬件"
|
||||
return 1
|
||||
}
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
echo "=========================================="
|
||||
echo " GPU环境检测"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
if check_gpu_support; then
|
||||
echo ""
|
||||
echo "结果: GPU环境可用"
|
||||
exit 0
|
||||
else
|
||||
echo ""
|
||||
echo "结果: GPU环境不可用,将跳过GPU相关服务"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 如果直接运行此脚本
|
||||
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
|
||||
main "$@"
|
||||
fi
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 一键启动脚本
|
||||
# 用于初始化目录、构建镜像并启动所有服务
|
||||
# 用于初始化目录并启动所有服务
|
||||
# 镜像构建已移至 build/build_images.sh
|
||||
|
||||
set -e
|
||||
|
||||
@@ -9,12 +10,6 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TEST_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
cd "$TEST_DIR"
|
||||
|
||||
# 解析参数
|
||||
FORCE_REBUILD=false
|
||||
if [[ "$1" == "--rebuild" ]]; then
|
||||
FORCE_REBUILD=true
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
echo " Argus Metrics 一键启动脚本"
|
||||
echo "=========================================="
|
||||
@@ -37,26 +32,6 @@ echo "使用: docker compose"
|
||||
echo "Compose 文件: $TEST_DIR/docker-compose.yml"
|
||||
echo ""
|
||||
|
||||
# 检查必要的构建目录
|
||||
echo "检查构建目录..."
|
||||
BUILD_DIRS=(
|
||||
"../ftp/build"
|
||||
"../prometheus/build"
|
||||
"../grafana/build"
|
||||
"client-test-node/build"
|
||||
"client-test-gpu-node/build"
|
||||
)
|
||||
|
||||
for dir in "${BUILD_DIRS[@]}"; do
|
||||
if [ ! -d "$dir" ]; then
|
||||
echo "错误: 构建目录不存在: $dir"
|
||||
echo "完整路径: $(cd "$(dirname "$dir")" 2>/dev/null && pwd)/$(basename "$dir")"
|
||||
exit 1
|
||||
else
|
||||
echo " ✓ 找到: $dir"
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
|
||||
# 检查并创建 .env 文件
|
||||
if [ ! -f .env ]; then
|
||||
@@ -84,118 +59,65 @@ echo "1. 初始化目录结构..."
|
||||
bash "$SCRIPT_DIR/init-directories.sh"
|
||||
|
||||
echo ""
|
||||
echo "2. 准备 Docker 镜像..."
|
||||
|
||||
# 检查镜像是否存在
|
||||
IMAGE_CACHE_DIR="$TEST_DIR/images-cache"
|
||||
IMAGES=("argus-metric-ftp:latest" "argus-metric-prometheus:latest" "argus-metric-grafana:latest" "argus-metric-test-node:latest" "argus-metric-test-gpu-node:latest")
|
||||
all_images_exist=true
|
||||
|
||||
for image in "${IMAGES[@]}"; do
|
||||
if ! docker images --format "{{.Repository}}:{{.Tag}}" | grep -q "^${image}$"; then
|
||||
all_images_exist=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if $FORCE_REBUILD; then
|
||||
echo "强制重新构建镜像(--rebuild 模式)..."
|
||||
cd "$TEST_DIR"
|
||||
docker compose build --no-cache
|
||||
echo "镜像重新构建完成"
|
||||
elif $all_images_exist; then
|
||||
echo "所有镜像已存在,跳过构建"
|
||||
echo "2. 检测GPU环境..."
|
||||
# 检测GPU环境
|
||||
if bash "$SCRIPT_DIR/check-gpu.sh"; then
|
||||
echo "GPU环境可用,将启动GPU节点"
|
||||
GPU_AVAILABLE=true
|
||||
else
|
||||
echo "检测到缺失镜像,尝试从缓存加载..."
|
||||
|
||||
# 尝试从缓存加载
|
||||
loaded_from_cache=false
|
||||
if [ -d "$IMAGE_CACHE_DIR" ]; then
|
||||
for image in "${IMAGES[@]}"; do
|
||||
if ! docker images --format "{{.Repository}}:{{.Tag}}" | grep -q "^${image}$"; then
|
||||
# 镜像不存在,尝试加载
|
||||
case "$image" in
|
||||
"argus-metric-ftp:latest")
|
||||
cache_file="${IMAGE_CACHE_DIR}/argus-ftp.tar"
|
||||
;;
|
||||
"argus-metric-prometheus:latest")
|
||||
cache_file="${IMAGE_CACHE_DIR}/argus-prometheus.tar"
|
||||
;;
|
||||
"argus-metric-grafana:latest")
|
||||
cache_file="${IMAGE_CACHE_DIR}/argus-grafana.tar"
|
||||
;;
|
||||
"argus-metric-test-node:latest")
|
||||
cache_file="${IMAGE_CACHE_DIR}/argus-test-node.tar"
|
||||
;;
|
||||
"argus-metric-test-gpu-node:latest")
|
||||
cache_file="${IMAGE_CACHE_DIR}/argus-test-gpu-node.tar"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -f "$cache_file" ]; then
|
||||
echo " 从缓存加载: $image"
|
||||
docker load -i "$cache_file"
|
||||
loaded_from_cache=true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# 检查加载后是否还有缺失的镜像
|
||||
need_build=false
|
||||
for image in "${IMAGES[@]}"; do
|
||||
if ! docker images --format "{{.Repository}}:{{.Tag}}" | grep -q "^${image}$"; then
|
||||
need_build=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if $need_build; then
|
||||
echo ""
|
||||
echo "部分镜像缺失,开始构建..."
|
||||
echo "工作目录: $(pwd)"
|
||||
cd "$TEST_DIR"
|
||||
docker compose build --no-cache
|
||||
|
||||
# 询问是否保存镜像
|
||||
echo ""
|
||||
read -p "是否保存镜像到缓存以便下次快速启动? (Y/n): " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
|
||||
mkdir -p "$IMAGE_CACHE_DIR"
|
||||
echo "保存镜像到缓存..."
|
||||
for image in "${IMAGES[@]}"; do
|
||||
case "$image" in
|
||||
"argus-metric-ftp:latest")
|
||||
docker save -o "${IMAGE_CACHE_DIR}/argus-ftp.tar" "$image" && echo " 已保存: argus-ftp.tar"
|
||||
;;
|
||||
"argus-metric-prometheus:latest")
|
||||
docker save -o "${IMAGE_CACHE_DIR}/argus-prometheus.tar" "$image" && echo " 已保存: argus-prometheus.tar"
|
||||
;;
|
||||
"argus-metric-grafana:latest")
|
||||
docker save -o "${IMAGE_CACHE_DIR}/argus-grafana.tar" "$image" && echo " 已保存: argus-grafana.tar"
|
||||
;;
|
||||
"argus-metric-test-node:latest")
|
||||
docker save -o "${IMAGE_CACHE_DIR}/argus-test-node.tar" "$image" && echo " 已保存: argus-test-node.tar"
|
||||
;;
|
||||
"argus-metric-test-gpu-node:latest")
|
||||
docker save -o "${IMAGE_CACHE_DIR}/argus-test-gpu-node.tar" "$image" && echo " 已保存: argus-test-gpu-node.tar"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "镜像已保存到: $IMAGE_CACHE_DIR/"
|
||||
fi
|
||||
elif $loaded_from_cache; then
|
||||
echo ""
|
||||
echo "所有镜像已从缓存加载完成!"
|
||||
fi
|
||||
echo "GPU环境不可用,跳过GPU节点"
|
||||
GPU_AVAILABLE=false
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "3. 启动基础服务..."
|
||||
echo "3. 检查 Docker 镜像..."
|
||||
|
||||
# 检查必要的镜像是否存在
|
||||
BASE_IMAGES=("argus-metric-ftp:latest" "argus-metric-prometheus:latest" "argus-metric-grafana:latest" "argus-metric-test-node:latest")
|
||||
GPU_IMAGES=("argus-metric-test-gpu-node:latest")
|
||||
|
||||
# 先检查基础镜像
|
||||
missing_images=()
|
||||
for image in "${BASE_IMAGES[@]}"; do
|
||||
if ! docker images --format "{{.Repository}}:{{.Tag}}" | grep -q "^${image}$"; then
|
||||
missing_images+=("$image")
|
||||
fi
|
||||
done
|
||||
|
||||
# 检查GPU镜像(如果GPU环境可用)
|
||||
if [ "$GPU_AVAILABLE" = true ]; then
|
||||
for image in "${GPU_IMAGES[@]}"; do
|
||||
if ! docker images --format "{{.Repository}}:{{.Tag}}" | grep -q "^${image}$"; then
|
||||
missing_images+=("$image")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ${#missing_images[@]} -gt 0 ]; then
|
||||
echo "以下镜像缺失,请先运行 build/build_images.sh 构建镜像:"
|
||||
for image in "${missing_images[@]}"; do
|
||||
echo " • $image"
|
||||
done
|
||||
echo ""
|
||||
echo "构建命令:"
|
||||
echo " ./build/build_images.sh --metric"
|
||||
exit 1
|
||||
else
|
||||
echo "所有必要镜像已存在"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "4. 启动基础服务..."
|
||||
cd "$TEST_DIR"
|
||||
# 启动除GPU节点外的所有服务
|
||||
docker compose up -d ftp prometheus grafana test-node test-gpu-node
|
||||
|
||||
# 根据GPU环境决定启动的服务
|
||||
if [ "$GPU_AVAILABLE" = true ]; then
|
||||
echo "启动所有服务(包括GPU节点)..."
|
||||
docker compose up -d ftp prometheus grafana test-node test-gpu-node
|
||||
else
|
||||
echo "启动基础服务(跳过GPU节点)..."
|
||||
docker compose up -d ftp prometheus grafana test-node
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "4. 等待服务启动..."
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
version: "3.8"
|
||||
-version: "3.8"
|
||||
|
||||
networks:
|
||||
default:
|
||||
external: true
|
||||
name: argus-sys-net
|
||||
driver: bridge
|
||||
ipam:
|
||||
@@ -137,3 +138,156 @@ services:
|
||||
ports:
|
||||
- "2021:2020"
|
||||
restart: unless-stopped
|
||||
|
||||
ftp:
|
||||
image: argus-metric-ftp:latest
|
||||
container_name: argus-ftp
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- FTP_BASE_PATH=/private/argus/ftp
|
||||
- FTP_PASSWORD=${FTP_PASSWORD:-ZGClab1234!}
|
||||
- DOMAIN=${FTP_DOMAIN:-ftp.metric.argus.com}
|
||||
- ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}
|
||||
- ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}
|
||||
ports:
|
||||
- "${FTP_PORT:-21}:21"
|
||||
- "${FTP_DATA_PORT:-20}:20"
|
||||
- "21100-21110:21100-21110"
|
||||
volumes:
|
||||
- ./private/argus/metric/ftp:/private/argus/ftp
|
||||
- ./private/argus/etc:/private/argus/etc
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 172.29.0.40
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
prometheus:
|
||||
image: argus-metric-prometheus:latest
|
||||
container_name: argus-prometheus
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- PROMETHEUS_BASE_PATH=/private/argus/metric/prometheus
|
||||
- ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}
|
||||
- ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}
|
||||
ports:
|
||||
- "${PROMETHEUS_PORT:-9090}:9090"
|
||||
volumes:
|
||||
- ./private/argus/metric/prometheus:/private/argus/metric/prometheus
|
||||
- ./private/argus/etc:/private/argus/etc
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 172.29.0.41
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
grafana:
|
||||
image: argus-metric-grafana:latest
|
||||
container_name: argus-grafana
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- GRAFANA_BASE_PATH=/private/argus/metric/grafana
|
||||
- ARGUS_BUILD_UID=${ARGUS_BUILD_UID:-2133}
|
||||
- ARGUS_BUILD_GID=${ARGUS_BUILD_GID:-2015}
|
||||
- GF_SERVER_HTTP_PORT=3000
|
||||
- GF_LOG_LEVEL=warn
|
||||
- GF_LOG_MODE=console
|
||||
ports:
|
||||
- "${GRAFANA_PORT:-3000}:3000"
|
||||
volumes:
|
||||
- ./private/argus/metric/grafana:/private/argus/metric/grafana
|
||||
- ./private/argus/etc:/private/argus/etc
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 172.29.0.42
|
||||
depends_on:
|
||||
- prometheus
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
test-node:
|
||||
image: argus-metric-test-node:latest
|
||||
container_name: argus-metric-test-node
|
||||
hostname: test-metric-node-001
|
||||
restart: unless-stopped
|
||||
privileged: true
|
||||
depends_on:
|
||||
- ftp
|
||||
- prometheus
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- DEBIAN_FRONTEND=noninteractive
|
||||
- FTP_DOMAIN=${FTP_DOMAIN:-ftp.metric.argus.com}
|
||||
- FTP_SERVER=${FTP_SERVER:-172.29.0.40}
|
||||
- FTP_USER=${FTP_USER:-ftpuser}
|
||||
- FTP_PASSWORD=${FTP_PASSWORD:-ZGClab1234!}
|
||||
- FTP_PORT=${FTP_PORT:-21}
|
||||
volumes:
|
||||
- ./private/argus/agent:/private/argus/agent
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
command: sleep infinity
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 172.29.0.50
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
test-gpu-node:
|
||||
image: argus-metric-test-gpu-node:latest
|
||||
container_name: argus-metric-test-gpu-node
|
||||
hostname: test-metric-gpu-node-001
|
||||
restart: unless-stopped
|
||||
privileged: true
|
||||
runtime: nvidia
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities:
|
||||
- gpu
|
||||
depends_on:
|
||||
- ftp
|
||||
- prometheus
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- DEBIAN_FRONTEND=noninteractive
|
||||
- NVIDIA_VISIBLE_DEVICES=all
|
||||
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
||||
- GPU_MODE=gpu
|
||||
volumes:
|
||||
- ./private/argus/agent:/private/argus/agent
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
command: sleep infinity
|
||||
networks:
|
||||
default:
|
||||
ipv4_address: 172.29.0.51
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
@@ -27,17 +27,34 @@ mkdir -p \
|
||||
"$PRIVATE_CORE/argus/bind" \
|
||||
"$PRIVATE_CORE/argus/master" \
|
||||
"$PRIVATE_CORE/argus/metric/prometheus" \
|
||||
"$PRIVATE_CORE/argus/metric/ftp/share" \
|
||||
"$PRIVATE_CORE/argus/metric/grafana/data" \
|
||||
"$PRIVATE_CORE/argus/metric/grafana/logs" \
|
||||
"$PRIVATE_CORE/argus/metric/grafana/plugins" \
|
||||
"$PRIVATE_CORE/argus/metric/grafana/provisioning/datasources" \
|
||||
"$PRIVATE_CORE/argus/metric/grafana/provisioning/dashboards" \
|
||||
"$PRIVATE_CORE/argus/metric/grafana/data/sessions" \
|
||||
"$PRIVATE_CORE/argus/metric/grafana/data/dashboards" \
|
||||
"$PRIVATE_CORE/argus/metric/grafana/config" \
|
||||
"$PRIVATE_CORE/argus/metric/prometheus/data" \
|
||||
"$PRIVATE_CORE/argus/metric/prometheus/rules" \
|
||||
"$PRIVATE_CORE/argus/metric/prometheus/targets" \
|
||||
"$PRIVATE_CORE/argus/agent" \
|
||||
"$PRIVATE_CORE/argus/log/elasticsearch" \
|
||||
"$PRIVATE_CORE/argus/log/kibana" \
|
||||
"$PRIVATE_NODEA/argus/agent/dev-yyrshare-nbnyx10-cp2f-pod-0/health" \
|
||||
"$PRIVATE_NODEB/argus/agent/dev-yyrshare-uuuu10-ep2f-pod-0/health" \
|
||||
"$TMP_DIR"
|
||||
|
||||
# Align ownership for supervisor-managed services (ES/Kibana expect UID/GID inside container)
|
||||
# Align ownership for supervisor-managed services (ES/Kibana/Grafana expect UID/GID inside container)
|
||||
echo "[INFO] Fixing ownership for core private directories..."
|
||||
chown -R "${ARGUS_BUILD_UID}:${ARGUS_BUILD_GID}" \
|
||||
"$PRIVATE_CORE/argus/log/elasticsearch" \
|
||||
"$PRIVATE_CORE/argus/log/kibana" \
|
||||
"$PRIVATE_CORE/argus/metric/grafana" \
|
||||
"$PRIVATE_CORE/argus/metric/prometheus" \
|
||||
"$PRIVATE_CORE/argus/metric/ftp" \
|
||||
"$PRIVATE_CORE/argus/agent" \
|
||||
"$PRIVATE_CORE/argus/etc" 2>/dev/null || true
|
||||
|
||||
echo "[INFO] Distributing update-dns.sh for core services (bind/master/es/kibana)"
|
||||
@@ -55,6 +72,11 @@ ensure_image "argus-elasticsearch:latest"
|
||||
ensure_image "argus-kibana:latest"
|
||||
ensure_image "argus-bind9:latest"
|
||||
ensure_image "argus-master:latest"
|
||||
ensure_image "argus-metric-ftp:latest"
|
||||
ensure_image "argus-metric-prometheus:latest"
|
||||
ensure_image "argus-metric-grafana:latest"
|
||||
ensure_image "argus-metric-test-node:latest"
|
||||
ensure_image "argus-metric-test-gpu-node:latest"
|
||||
|
||||
echo "[INFO] Building agent binary..."
|
||||
pushd "$REPO_ROOT/src/agent" >/dev/null
|
||||
@@ -68,10 +90,44 @@ if [[ ! -x "$AGENT_BIN" ]]; then
|
||||
fi
|
||||
echo "$AGENT_BIN" > "$TMP_DIR/agent_binary_path"
|
||||
|
||||
echo "[INFO] Writing .env with UID/GID"
|
||||
# 检测GPU环境
|
||||
echo "[INFO] 检测GPU环境..."
|
||||
GPU_CHECK_SCRIPT="$REPO_ROOT/src/metric/tests/scripts/common/check-gpu.sh"
|
||||
if [ -f "$GPU_CHECK_SCRIPT" ]; then
|
||||
if bash "$GPU_CHECK_SCRIPT" >/dev/null 2>&1; then
|
||||
echo "[INFO] GPU环境可用,将启动test-gpu-node容器"
|
||||
GPU_AVAILABLE=true
|
||||
else
|
||||
echo "[INFO] GPU环境不可用,跳过test-gpu-node容器"
|
||||
GPU_AVAILABLE=false
|
||||
fi
|
||||
else
|
||||
echo "[WARN] 未找到GPU检测脚本: $GPU_CHECK_SCRIPT,跳过GPU检测"
|
||||
GPU_AVAILABLE=false
|
||||
fi
|
||||
|
||||
echo "[INFO] Writing .env with UID/GID and metric configuration"
|
||||
cat > "$TEST_ROOT/.env" <<EOF
|
||||
ARGUS_BUILD_UID=$ARGUS_BUILD_UID
|
||||
ARGUS_BUILD_GID=$ARGUS_BUILD_GID
|
||||
|
||||
# GPU 配置
|
||||
GPU_AVAILABLE=$GPU_AVAILABLE
|
||||
|
||||
# FTP 配置
|
||||
FTP_PORT=21
|
||||
FTP_DATA_PORT=20
|
||||
FTP_PASSWORD=ZGClab1234!
|
||||
FTP_DOMAIN=ftp.metric.argus.com
|
||||
|
||||
# Prometheus 配置
|
||||
PROMETHEUS_PORT=9090
|
||||
|
||||
# Grafana 配置
|
||||
GRAFANA_PORT=3000
|
||||
|
||||
# 网络配置
|
||||
USE_INTRANET=false
|
||||
EOF
|
||||
|
||||
echo "[OK] Bootstrap completed"
|
||||
|
||||
@@ -3,6 +3,7 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TEST_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
REPO_ROOT="$(cd "$TEST_ROOT/../../.." && pwd)"
|
||||
|
||||
compose() {
|
||||
if docker compose version >/dev/null 2>&1; then
|
||||
@@ -13,10 +14,40 @@ compose() {
|
||||
}
|
||||
|
||||
echo "[INFO] Bringing up system stack..."
|
||||
|
||||
# 检测GPU环境
|
||||
echo "[INFO] 检测GPU环境..."
|
||||
GPU_CHECK_SCRIPT="$REPO_ROOT/src/metric/tests/scripts/common/check-gpu.sh"
|
||||
if [ -f "$GPU_CHECK_SCRIPT" ]; then
|
||||
if bash "$GPU_CHECK_SCRIPT" >/dev/null 2>&1; then
|
||||
echo "[INFO] GPU环境可用,将启动GPU测试节点"
|
||||
GPU_AVAILABLE=true
|
||||
else
|
||||
echo "[INFO] GPU环境不可用,将跳过GPU测试节点"
|
||||
GPU_AVAILABLE=false
|
||||
fi
|
||||
else
|
||||
echo "[WARN] 未找到GPU检测脚本: $GPU_CHECK_SCRIPT,跳过GPU检测"
|
||||
GPU_AVAILABLE=false
|
||||
fi
|
||||
|
||||
pushd "$TEST_ROOT" >/dev/null
|
||||
compose -p argus-sys down --remove-orphans || true
|
||||
compose -p argus-sys up -d
|
||||
|
||||
# 根据GPU可用性决定启动的服务
|
||||
if [ "$GPU_AVAILABLE" = true ]; then
|
||||
echo "[INFO] 启动所有服务(包括test-gpu-node)..."
|
||||
compose -p argus-sys up -d
|
||||
else
|
||||
echo "[INFO] 启动基础服务(跳过test-gpu-node)..."
|
||||
compose -p argus-sys up -d --scale test-gpu-node=0
|
||||
fi
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
echo "[OK] Services started: master:32300 es:9200 kibana:5601 node-a:2020 node-b:2021"
|
||||
if [ "$GPU_AVAILABLE" = true ]; then
|
||||
echo "[OK] Services started: master:32300 es:9200 kibana:5601 node-a:2020 node-b:2021 test-gpu-node:172.29.0.51"
|
||||
else
|
||||
echo "[OK] Services started: master:32300 es:9200 kibana:5601 node-a:2020 node-b:2021 (test-gpu-node skipped)"
|
||||
fi
|
||||
|
||||
|
||||
61
src/sys/tests/scripts/05_publish_artifact.sh
Executable file
61
src/sys/tests/scripts/05_publish_artifact.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
TEST_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
REPO_ROOT="$(cd "$TEST_DIR/../../.." && pwd)"
|
||||
PLUGIN_DIR="$REPO_ROOT/src/metric/client-plugins/all-in-one-full"
|
||||
|
||||
# 加载 .env
|
||||
if [ -f "$TEST_DIR/.env" ]; then
|
||||
source "$TEST_DIR/.env"
|
||||
fi
|
||||
|
||||
# 检测容器挂载目录
|
||||
if docker ps --format '{{.Names}}' | grep -q '^argus-ftp$'; then
|
||||
FTP_MOUNT=$(docker inspect argus-ftp --format '{{range .Mounts}}{{if eq .Destination "/private/argus/ftp"}}{{.Source}}{{end}}{{end}}')
|
||||
OUTPUT_DIR="${FTP_MOUNT}/share"
|
||||
echo "[02] 容器挂载: $OUTPUT_DIR"
|
||||
else
|
||||
OUTPUT_DIR="${DATA_ROOT:-$TEST_DIR/private}/ftp/share"
|
||||
echo "[02] 默认路径: $OUTPUT_DIR"
|
||||
fi
|
||||
|
||||
OWNER="${ARGUS_BUILD_UID:-2133}:${ARGUS_BUILD_GID:-2015}"
|
||||
|
||||
cd "$PLUGIN_DIR"
|
||||
|
||||
echo "[02] 递增版本号..."
|
||||
bash scripts/version-manager.sh bump minor
|
||||
|
||||
VERSION_FILE="config/VERSION"
|
||||
if [ ! -f "$VERSION_FILE" ]; then
|
||||
echo "[02] 错误: 未找到 $VERSION_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(cat "$VERSION_FILE" | tr -d '[:space:]')
|
||||
echo "[02] 新版本: $VERSION"
|
||||
|
||||
echo "[02] 构建安装包..."
|
||||
bash scripts/package_artifact.sh --force
|
||||
|
||||
echo "[02] 发布到 FTP: $OUTPUT_DIR"
|
||||
sudo bash scripts/publish_artifact.sh "$VERSION" --output-dir "$OUTPUT_DIR" --owner "$OWNER"
|
||||
|
||||
echo "[02] 设置文件权限..."
|
||||
# 设置所有者
|
||||
sudo chown -R "$OWNER" "$OUTPUT_DIR"
|
||||
# 设置目录权限为 755 (rwxr-xr-x)
|
||||
sudo find "$OUTPUT_DIR" -type d -exec chmod 755 {} \;
|
||||
# 设置文件权限为 644 (rw-r--r--)
|
||||
sudo find "$OUTPUT_DIR" -type f -exec chmod 644 {} \;
|
||||
# 特别处理 .sh 文件,给予执行权限 755
|
||||
sudo find "$OUTPUT_DIR" -type f -name "*.sh" -exec chmod 755 {} \;
|
||||
echo "[02] 权限设置完成 (UID:GID=$OWNER, dirs=755, files=644, scripts=755)"
|
||||
|
||||
echo "[02] 发布完成,验证文件..."
|
||||
ls -lh "$OUTPUT_DIR"
|
||||
|
||||
echo "[02] 完成"
|
||||
|
||||
33
src/sys/tests/scripts/06_test_node_install.sh
Executable file
33
src/sys/tests/scripts/06_test_node_install.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
FTP_SERVER="${FTP_SERVER:-172.30.0.40}"
|
||||
FTP_USER="${FTP_USER:-ftpuser}"
|
||||
FTP_PASSWORD="${FTP_PASSWORD:-ZGClab1234!}"
|
||||
FTP_PORT="${FTP_PORT:-21}"
|
||||
|
||||
FTP_HOST="${FTP_SERVER}"
|
||||
|
||||
echo "[03] 进入测试节点执行安装..."
|
||||
echo "[03] 使用 FTP 地址: ${FTP_HOST}:${FTP_PORT}"
|
||||
|
||||
docker exec argus-metric-test-node bash -c "
|
||||
set -e
|
||||
|
||||
if ! command -v curl &>/dev/null; then
|
||||
echo '[03] curl 未安装,正在安装...'
|
||||
apt-get update && apt-get install -y curl
|
||||
fi
|
||||
|
||||
cd /tmp
|
||||
echo '[03] 下载 setup.sh...'
|
||||
curl -u ${FTP_USER}:${FTP_PASSWORD} ftp://${FTP_HOST}:${FTP_PORT}/setup.sh -o setup.sh
|
||||
|
||||
echo '[03] 执行安装...'
|
||||
chmod +x setup.sh
|
||||
bash setup.sh --server ${FTP_HOST} --user ${FTP_USER} --password '${FTP_PASSWORD}' --port ${FTP_PORT}
|
||||
|
||||
echo '[03] 安装完成'
|
||||
"
|
||||
|
||||
echo "[03] 完成"
|
||||
55
src/sys/tests/scripts/07_test_gpu_node_install.sh
Executable file
55
src/sys/tests/scripts/07_test_gpu_node_install.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TEST_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
REPO_ROOT="$(cd "$TEST_ROOT/../../.." && pwd)"
|
||||
|
||||
FTP_SERVER="${FTP_SERVER:-172.29.0.40}"
|
||||
FTP_USER="${FTP_USER:-ftpuser}"
|
||||
FTP_PASSWORD="${FTP_PASSWORD:-ZGClab1234!}"
|
||||
FTP_PORT="${FTP_PORT:-21}"
|
||||
|
||||
FTP_HOST="${FTP_SERVER}"
|
||||
|
||||
echo "[04] 检测GPU环境..."
|
||||
# 检测GPU环境
|
||||
GPU_CHECK_SCRIPT="$REPO_ROOT/metric/tests/scripts/common/check-gpu.sh"
|
||||
if [ -f "$GPU_CHECK_SCRIPT" ]; then
|
||||
if bash "$GPU_CHECK_SCRIPT"; then
|
||||
echo "[04] GPU环境可用,继续执行GPU节点安装"
|
||||
GPU_AVAILABLE=true
|
||||
else
|
||||
echo "[04] GPU环境不可用,跳过GPU节点安装"
|
||||
GPU_AVAILABLE=false
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "[04] 未找到GPU检测脚本: $GPU_CHECK_SCRIPT,跳过GPU节点安装"
|
||||
GPU_AVAILABLE=false
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "[04] 进入测试节点执行安装..."
|
||||
echo "[04] 使用 FTP 地址: ${FTP_HOST}:${FTP_PORT}"
|
||||
|
||||
docker exec argus-metric-test-gpu-node bash -c "
|
||||
set -e
|
||||
|
||||
if ! command -v curl &>/dev/null; then
|
||||
echo '[04] curl 未安装,正在安装...'
|
||||
apt-get update && apt-get install -y curl
|
||||
fi
|
||||
|
||||
cd /tmp
|
||||
echo '[04] 下载 setup.sh...'
|
||||
curl -u ${FTP_USER}:${FTP_PASSWORD} ftp://${FTP_HOST}:${FTP_PORT}/setup.sh -o setup.sh
|
||||
|
||||
echo '[04] 执行安装...'
|
||||
chmod +x setup.sh
|
||||
bash setup.sh --server ${FTP_HOST} --user ${FTP_USER} --password '${FTP_PASSWORD}' --port ${FTP_PORT}
|
||||
|
||||
echo '[04] 安装完成'
|
||||
"
|
||||
|
||||
echo "[04] 完成"
|
||||
96
src/sys/tests/scripts/08_check_services_installed.sh
Executable file
96
src/sys/tests/scripts/08_check_services_installed.sh
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "[04] 验证安装结果 - 检查监控端口..."
|
||||
echo "=========================================="
|
||||
|
||||
# 检查容器是否运行
|
||||
if ! docker ps --format '{{.Names}}' | grep -q '^argus-metric-test-node$'; then
|
||||
echo "错误: 容器 argus-metric-test-node 未运行"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ERRORS=0
|
||||
|
||||
# ==================== 检查监听端口 ====================
|
||||
echo ""
|
||||
echo "[1] 检查监听端口..."
|
||||
echo "----------------------------------------"
|
||||
CHECK_RESULT=$(docker exec argus-metric-test-node bash -c '
|
||||
if command -v netstat >/dev/null 2>&1; then
|
||||
echo "使用 netstat 检查端口:"
|
||||
if netstat -tlnp 2>/dev/null | grep -E ":(9100|9400|2020)"; then
|
||||
echo "✓ 找到监控端口"
|
||||
exit 0
|
||||
else
|
||||
echo "✗ 未找到监控端口 (9100/9400/2020)"
|
||||
exit 1
|
||||
fi
|
||||
elif command -v ss >/dev/null 2>&1; then
|
||||
echo "使用 ss 检查端口:"
|
||||
if ss -tlnp 2>/dev/null | grep -E ":(9100|9400|2020)"; then
|
||||
echo "✓ 找到监控端口"
|
||||
exit 0
|
||||
else
|
||||
echo "✗ 未找到监控端口 (9100/9400/2020)"
|
||||
exit 1
|
||||
fi
|
||||
elif command -v lsof >/dev/null 2>&1; then
|
||||
echo "使用 lsof 检查端口:"
|
||||
if lsof -i :9100 -i :9400 -i :2020 2>/dev/null | grep LISTEN; then
|
||||
echo "✓ 找到监控端口"
|
||||
exit 0
|
||||
else
|
||||
echo "✗ 未找到监控端口 (9100/9400/2020)"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "? 没有可用的端口检查工具 (netstat/ss/lsof),跳过此检查"
|
||||
exit 0
|
||||
fi
|
||||
')
|
||||
echo "$CHECK_RESULT"
|
||||
# 只有在明确失败时才计入错误(exit 1),没有工具(exit 0)不算错误
|
||||
if echo "$CHECK_RESULT" | grep -q "✗ 未找到监控端口"; then
|
||||
ERRORS=$((ERRORS + 1))
|
||||
fi
|
||||
|
||||
# ==================== 测试端口连通性 ====================
|
||||
echo ""
|
||||
echo "[2] 测试端口连通性..."
|
||||
echo "----------------------------------------"
|
||||
docker exec argus-metric-test-node bash -c '
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
FAILED=0
|
||||
for port in 9100 9400 2020; do
|
||||
echo -n "端口 $port: "
|
||||
if curl -s --connect-timeout 2 "http://localhost:$port/metrics" > /dev/null 2>&1; then
|
||||
echo "✓ 可访问 (/metrics)"
|
||||
elif curl -s --connect-timeout 2 "http://localhost:$port/" > /dev/null 2>&1; then
|
||||
echo "✓ 可访问 (根路径)"
|
||||
else
|
||||
echo "✗ 不可访问"
|
||||
FAILED=$((FAILED + 1))
|
||||
fi
|
||||
done
|
||||
exit $FAILED
|
||||
else
|
||||
echo "? curl 不可用,跳过连通性测试"
|
||||
exit 0
|
||||
fi
|
||||
' || ERRORS=$((ERRORS + 1))
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
if [ $ERRORS -eq 0 ]; then
|
||||
echo "✓ [04] 验证完成 - 所有端口检查通过"
|
||||
else
|
||||
echo "✗ [04] 验证失败 - 发现 $ERRORS 个问题"
|
||||
echo ""
|
||||
echo "调试建议:"
|
||||
echo " 1. 进入容器检查: docker exec -it argus-metric-test-node bash"
|
||||
echo " 2. 查看进程: docker exec argus-metric-test-node ps aux"
|
||||
echo " 3. 查看日志: docker exec argus-metric-test-node cat /tmp/argus_install.log"
|
||||
exit 1
|
||||
fi
|
||||
echo "=========================================="
|
||||
@@ -1,12 +1,34 @@
|
||||
# Argus-web
|
||||
|
||||
架构:React + Vite + Mantine
|
||||
前端页面架构:React + Vite + Mantine
|
||||
|
||||
该模块分为两个部分,argus-web-frontend和argus-web-proxy。其中argus-web-frontend负责前端页面展示,argus-web-proxy负责反向代理,实现对其他网站的反向代理功能
|
||||
|
||||
## 打包部署
|
||||
## 构建
|
||||
在构建前需要设置构建和部署的环境变量。根目录下运行:
|
||||
```bash
|
||||
cp src/web/tests/.env.example src/web/tests/.env
|
||||
```
|
||||
修改.env的内容。
|
||||
|
||||
### argus-web-frontend
|
||||
根目录下运行
|
||||
```bash
|
||||
bash src/web/buld_tools/frontend/build.sh
|
||||
```
|
||||
构建成功后,会在根目录下有一个打包好的tar包argus-web-frontend-latest.tar。
|
||||
|
||||
### argus-web-proxy
|
||||
根目录下运行
|
||||
```bash
|
||||
bash src/web/build_tools/proxy/build.sh
|
||||
```
|
||||
构建成功后,会在根目录下有一个打包好的tar包argus-web-proxy-latest.tar。
|
||||
|
||||
## 部署
|
||||
|
||||
提供docker-compose部署。在src/web/tests目录下
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
会同时启动argus-web-frontend和argus-web-proxy两个容器服务。
|
||||
|
||||
@@ -24,8 +24,10 @@ RUN apt-get update && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV FRONTEND_BASE_PATH=/private/argus/web/frontend
|
||||
ENV ARGUS_UID=2133
|
||||
ENV ARGUS_GID=2015
|
||||
ARG ARGUS_UID=2133
|
||||
ARG ARGUS_GID=2015
|
||||
ENV ARGUS_UID=${ARGUS_UID}
|
||||
ENV ARGUS_GID=${ARGUS_GID}
|
||||
|
||||
RUN mkdir -p ${FRONTEND_BASE_PATH} && \
|
||||
mkdir -p /private/argus/etc
|
||||
@@ -82,7 +84,7 @@ COPY src/web/build_tools/frontend/health-check.sh /usr/local/bin/health-check.sh
|
||||
RUN chmod +x /usr/local/bin/health-check.sh
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 80
|
||||
EXPOSE 8080
|
||||
|
||||
# 保持 root 用户,由 supervisor 控制 user 切换
|
||||
USER root
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
docker pull node:20
|
||||
docker pull ubuntu:24.04
|
||||
docker build -f src/web/build_tools/frontend/Dockerfile -t argus-web:0.1.1 .
|
||||
rm -f argus-web-0.1.1.tar && sudo docker image save argus-web:0.1.1 > argus-web-0.1.1.tar
|
||||
|
||||
source src/web/tests/.env
|
||||
|
||||
docker build \
|
||||
--build-arg ARGUS_UID=${ARGUS_UID} \
|
||||
--build-arg ARGUS_GID=${ARGUS_GID} \
|
||||
-f src/web/build_tools/frontend/Dockerfile -t argus-web-frontend:latest .
|
||||
docker save -o argus-web-frontend-latest.tar argus-web-frontend:latest
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
URL="http://127.0.0.1:80"
|
||||
URL="http://127.0.0.1:8080"
|
||||
|
||||
echo "[INFO] Starting Argus web health check loop for $URL..."
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ http {
|
||||
|
||||
# React 前端服务
|
||||
server {
|
||||
listen 80;
|
||||
listen 8080;
|
||||
server_name web.argus.com;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
@@ -25,32 +25,4 @@ http {
|
||||
}
|
||||
|
||||
|
||||
# Master 服务,需要增加 CORS 支持
|
||||
server {
|
||||
listen 80;
|
||||
server_name master.argus.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://master.argus.com;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# CORS 支持
|
||||
add_header 'Access-Control-Allow-Origin' 'http://web.argus.com' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
|
||||
|
||||
if ($request_method = OPTIONS) {
|
||||
add_header 'Access-Control-Allow-Origin' 'http://web.argus.com' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
|
||||
add_header 'Content-Length' 0;
|
||||
add_header 'Content-Type' 'text/plain';
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,20 +8,12 @@ DNS_SCRIPT="${DNS_DIR}/update-dns.sh"
|
||||
DOMAIN=web.argus.com
|
||||
WEB_DOMAIN_FILE="${DNS_DIR}/${DOMAIN}"
|
||||
RUNTIME_USER="${ARGUS_RUNTIME_USER:-argus}"
|
||||
RUNTIME_UID="${ARGUS_BUILD_UID:-2133}"
|
||||
RUNTIME_GID="${ARGUS_BUILD_GID:-2015}"
|
||||
RUNTIME_UID="${ARGUS_UID:-2133}"
|
||||
RUNTIME_GID="${ARGUS_GID:-2015}"
|
||||
|
||||
mkdir -p "$DNS_DIR"
|
||||
chown -R "$RUNTIME_UID:$RUNTIME_GID" "$DNS_DIR" 2>/dev/null || true
|
||||
|
||||
if [[ -x "$DNS_SCRIPT" ]]; then
|
||||
echo "[INFO] Running update-dns.sh before master starts"
|
||||
# 若脚本存在则执行,保证容器使用 bind 作为 DNS
|
||||
"$DNS_SCRIPT" || echo "[WARN] update-dns.sh execution failed"
|
||||
else
|
||||
echo "[WARN] DNS update script not found or not executable: $DNS_SCRIPT"
|
||||
fi
|
||||
|
||||
|
||||
# 记录容器 IP
|
||||
IP=$(ifconfig | grep -A 1 eth0 | grep inet | awk '{print $2}' || true)
|
||||
@@ -32,6 +24,7 @@ if [[ -n "${IP}" ]]; then
|
||||
else
|
||||
echo "[WARN] Failed to detect web IP via ifconfig"
|
||||
fi
|
||||
chmod 755 "$WEB_DOMAIN_FILE"
|
||||
|
||||
echo "[INFO] Launching nginx..."
|
||||
|
||||
|
||||
@@ -8,8 +8,10 @@ RUN apt-get update && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV FRONTEND_BASE_PATH=/private/argus/web/proxy
|
||||
ENV ARGUS_UID=2133
|
||||
ENV ARGUS_GID=2015
|
||||
ARG ARGUS_UID=2133
|
||||
ARG ARGUS_GID=2015
|
||||
ENV ARGUS_UID=${ARGUS_UID}
|
||||
ENV ARGUS_GID=${ARGUS_GID}
|
||||
|
||||
RUN mkdir -p ${FRONTEND_BASE_PATH} && \
|
||||
mkdir -p /private/argus/etc
|
||||
|
||||
9
src/web/build_tools/proxy/build.sh
Normal file
9
src/web/build_tools/proxy/build.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
docker pull ubuntu:24.04
|
||||
|
||||
source src/web/tests/.env
|
||||
|
||||
docker build \
|
||||
--build-arg ARGUS_UID=${ARGUS_UID} \
|
||||
--build-arg ARGUS_GID=${ARGUS_GID} \
|
||||
-f src/web/build_tools/proxy/Dockerfile -t argus-web-proxy:latest .
|
||||
docker save -o argus-web-proxy-latest.tar argus-web-proxy:latest
|
||||
@@ -3,6 +3,7 @@ server {
|
||||
server_name alertmanager.alert.argus.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://alertmanager.alert.argus.com:9093;
|
||||
set $alert_backend http://alertmanager.alert.argus.com:9093;
|
||||
proxy_pass $alert_backend;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ server {
|
||||
server_name es.log.argus.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://es.log.argus.com;
|
||||
set $es_backend http://es.log.argus.com:9200;
|
||||
proxy_pass $es_backend;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +15,7 @@ server {
|
||||
server_name kibana.log.argus.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://kibana.log.argus.com;
|
||||
set $kibana_backend http://kibana.log.argus.com:5601;
|
||||
proxy_pass $kibana_backend;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,25 +3,25 @@ server {
|
||||
server_name master.argus.com;
|
||||
|
||||
location / {
|
||||
# proxy_pass http://master.argus.com;
|
||||
proxy_pass http://master.argus.com;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
set $master_backend http://master.argus.com:3000;
|
||||
proxy_pass $master_backend;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# # CORS 支持
|
||||
# add_header 'Access-Control-Allow-Origin' 'http://web.argus.com' always;
|
||||
# add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
# add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
|
||||
# CORS 支持
|
||||
add_header 'Access-Control-Allow-Origin' 'http://web.argus.com' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
|
||||
|
||||
# if ($request_method = OPTIONS) {
|
||||
# add_header 'Access-Control-Allow-Origin' 'http://web.argus.com' always;
|
||||
# add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
# add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
|
||||
# add_header 'Content-Length' 0;
|
||||
# add_header 'Content-Type' 'text/plain';
|
||||
# return 204;
|
||||
# }
|
||||
if ($request_method = OPTIONS) {
|
||||
add_header 'Access-Control-Allow-Origin' 'http://web.argus.com' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization' always;
|
||||
add_header 'Content-Length' 0;
|
||||
add_header 'Content-Type' 'text/plain';
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,16 +4,18 @@ server {
|
||||
server_name prometheus.metric.argus.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://prom.metric.argus.com;
|
||||
set $prom_backend http://prom.metric.argus.com:9090;
|
||||
proxy_pass $prom_backend;
|
||||
}
|
||||
}
|
||||
|
||||
# # Grafana
|
||||
# server {
|
||||
# listen 80;
|
||||
# server_name grafana.metric.argus.com;
|
||||
# Grafana
|
||||
server {
|
||||
listen 80;
|
||||
server_name grafana.metric.argus.com;
|
||||
|
||||
# location / {
|
||||
# proxy_pass http://grafana.metric.argus.com;
|
||||
# }
|
||||
# }
|
||||
location / {
|
||||
set $grafana_backend http://grafana.metric.argus.com:3000;
|
||||
proxy_pass $grafana_backend;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ server {
|
||||
server_name web.argus.com;
|
||||
|
||||
location / {
|
||||
proxy_pass http://web.argus.com:80;
|
||||
set $web_backend http://web.argus.com:8080;
|
||||
proxy_pass $web_backend;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,6 @@ events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
proxy_pass http://web.argus.com:80;
|
||||
}
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
@@ -32,5 +24,16 @@ http {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
set $web_backend http://web.argus.com:8080;
|
||||
proxy_pass $web_backend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ DNS_CONF_PRIVATE="/private/argus/etc/dns.conf"
|
||||
DNS_CONF_SYSTEM="/etc/resolv.conf"
|
||||
DNS_DIR="/private/argus/etc"
|
||||
DNS_SCRIPT="${DNS_DIR}/update-dns.sh"
|
||||
RUNTIME_UID="${ARGUS_BUILD_UID:-2133}"
|
||||
RUNTIME_GID="${ARGUS_BUILD_GID:-2015}"
|
||||
RUNTIME_UID="${ARGUS_UID:-2133}"
|
||||
RUNTIME_GID="${ARGUS_GID:-2015}"
|
||||
|
||||
mkdir -p "$DNS_DIR"
|
||||
chown -R "$RUNTIME_UID:$RUNTIME_GID" "$DNS_DIR" 2>/dev/null || true
|
||||
|
||||
@@ -8,10 +8,10 @@ export function AlertFilters({ filters, setFilters, nodeOptions }) {
|
||||
value={filters.severity}
|
||||
onChange={(value) => setFilters((f) => ({ ...f, severity: value }))}
|
||||
data={[
|
||||
{ value: "all", label: "全部" },
|
||||
{ value: "critical", label: "严重" },
|
||||
{ value: "warning", label: "警告" },
|
||||
{ value: "info", label: "信息" },
|
||||
{ value: "all", label: "all" },
|
||||
{ value: "critical", label: "critical" },
|
||||
{ value: "warning", label: "warning" },
|
||||
{ value: "info", label: "info" },
|
||||
]}
|
||||
w={150}
|
||||
/>
|
||||
@@ -20,7 +20,7 @@ export function AlertFilters({ filters, setFilters, nodeOptions }) {
|
||||
value={filters.state}
|
||||
onChange={(value) => setFilters((f) => ({ ...f, state: value }))}
|
||||
data={[
|
||||
{ value: "all", label: "全部" },
|
||||
{ value: "all", label: "all" },
|
||||
{ value: "active", label: "Active" },
|
||||
{ value: "resolved", label: "Resolved" },
|
||||
]}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Table, Group, ActionIcon, Button } from "@mantine/core";
|
||||
import { IconChevronUp, IconChevronDown } from "@tabler/icons-react";
|
||||
import { Table, Group, ActionIcon, Button, Code } from "@mantine/core";
|
||||
import { IconChevronUp, IconChevronDown, IconInfoCircle } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
|
||||
export function AlertTable({
|
||||
alerts,
|
||||
@@ -16,6 +17,11 @@ export function AlertTable({
|
||||
formatRelativeTime,
|
||||
}) {
|
||||
const totalPages = Math.ceil(sortedAlerts.length / pageSize);
|
||||
const [expandedRow, setExpandedRow] = useState(null);
|
||||
|
||||
const toggleExpand = (index) => {
|
||||
setExpandedRow(expandedRow === index ? null : index);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -47,24 +53,52 @@ export function AlertTable({
|
||||
</Group>
|
||||
</Table.Th>
|
||||
))}
|
||||
<Table.Th>更多信息</Table.Th>
|
||||
</Table.Tr>
|
||||
</Table.Thead>
|
||||
|
||||
<Table.Tbody>
|
||||
{paginatedAlerts.map((alert, i) => (
|
||||
<Table.Tr key={i} style={{ backgroundColor: getRowColor(alert) }}>
|
||||
<Table.Td>{alert.labels?.alertname || "-"}</Table.Td>
|
||||
<Table.Td>{alert.labels?.instance || "-"}</Table.Td>
|
||||
<Table.Td style={{ color: getSeverityColor(alert.labels?.severity) }}>
|
||||
{alert.labels?.severity || "info"}
|
||||
</Table.Td>
|
||||
<Table.Td>{getStateBadge(alert.status?.state)}</Table.Td>
|
||||
<Table.Td title={alert.startsAt || "-"}>{formatRelativeTime(alert.startsAt)}</Table.Td>
|
||||
<Table.Td title={alert.endsAt || "-"}>
|
||||
{alert.endsAt ? new Date(alert.endsAt).toLocaleString() : "-"}
|
||||
</Table.Td>
|
||||
<Table.Td title={alert.updatedAt || "-"}>{formatRelativeTime(alert.updatedAt)}</Table.Td>
|
||||
<Table.Td>{alert.annotations?.summary || "-"}</Table.Td>
|
||||
</Table.Tr>
|
||||
<>
|
||||
<Table.Tr key={i} style={{ backgroundColor: getRowColor(alert) }}>
|
||||
<Table.Td>{alert.labels?.alertname || "-"}</Table.Td>
|
||||
<Table.Td>{alert.labels?.instance || "-"}</Table.Td>
|
||||
<Table.Td style={{ color: getSeverityColor(alert.labels?.severity) }}>
|
||||
{alert.labels?.severity || "info"}
|
||||
</Table.Td>
|
||||
<Table.Td>{getStateBadge(alert.status?.state)}</Table.Td>
|
||||
<Table.Td title={alert.startsAt || "-"}>{formatRelativeTime(alert.startsAt)}</Table.Td>
|
||||
<Table.Td title={alert.endsAt || "-"}>
|
||||
{alert.endsAt ? new Date(alert.endsAt).toLocaleString() : "-"}
|
||||
</Table.Td>
|
||||
<Table.Td title={alert.updatedAt || "-"}>{formatRelativeTime(alert.updatedAt)}</Table.Td>
|
||||
<Table.Td>{alert.annotations?.summary || "-"}</Table.Td>
|
||||
<Table.Td>
|
||||
<ActionIcon
|
||||
onClick={() => toggleExpand(i)}
|
||||
variant="subtle"
|
||||
color="blue"
|
||||
title="显示/隐藏更多信息"
|
||||
>
|
||||
<IconInfoCircle size={18} />
|
||||
</ActionIcon>
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
|
||||
{expandedRow === i && (
|
||||
<Table.Tr key={`details-${i}`} style={{ backgroundColor: "#f9fafb" }}>
|
||||
<Table.Td colSpan={9}>
|
||||
<div style={{ fontSize: "0.85rem", lineHeight: 1.5 }}>
|
||||
{Object.entries(alert.labels || {}).map(([k, v]) => (
|
||||
<div key={k}>
|
||||
<Code color="blue">{k}</Code> :{v}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</Table.Tbody>
|
||||
</Table>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import {
|
||||
Drawer,
|
||||
Text,
|
||||
@@ -102,11 +102,6 @@ export default function NodeDetailDrawer({ opened, nodeId, onClose }) {
|
||||
{/* 滚动内容 */}
|
||||
<ScrollArea style={{ flex: 1 }}>
|
||||
<Stack spacing="md">
|
||||
{/* 配置信息 */}
|
||||
<NodeConfigCard nodeId={node.id} config={node.config || {}} onSaved={() => fetchNodeDetail(node.id)} />
|
||||
|
||||
{/* 标签信息 */}
|
||||
<NodeLabelCard nodeId={node.id} labels={Array.isArray(node.label) ? node.label : []} onSaved={() => fetchNodeDetail(node.id)} />
|
||||
|
||||
{/* 元数据 */}
|
||||
<NodeMetaCard node={node} />
|
||||
@@ -114,6 +109,12 @@ export default function NodeDetailDrawer({ opened, nodeId, onClose }) {
|
||||
{/* 健康信息 */}
|
||||
<NodeHealthCard node={node} />
|
||||
|
||||
{/* 配置信息 */}
|
||||
<NodeConfigCard nodeId={node.id} config={node.config || {}} onSaved={() => fetchNodeDetail(node.id)} />
|
||||
|
||||
{/* 标签信息 */}
|
||||
<NodeLabelCard nodeId={node.id} labels={Array.isArray(node.label) ? node.label : []} onSaved={() => fetchNodeDetail(node.id)} />
|
||||
|
||||
{/* 其他基础信息展示 */}
|
||||
<Stack spacing="xs">
|
||||
<Text fw={500}>注册时间: <Text span c="dimmed">{new Date(node.register_time).toLocaleString()}</Text></Text>
|
||||
|
||||
@@ -2,54 +2,62 @@ import { useState } from "react";
|
||||
import { Card, Text, Stack, Group, ActionIcon, Badge, Popover } from "@mantine/core";
|
||||
import { IconInfoCircle } from "@tabler/icons-react";
|
||||
|
||||
|
||||
// 子组件:单条健康信息
|
||||
function HealthItem({ moduleName, data }) {
|
||||
const status = data?.status || "unknown";
|
||||
const color = status === "healthy" ? "green" : status === "unhealthy" ? "red" : "gray";
|
||||
const [opened, setOpened] = useState(false);
|
||||
|
||||
return (
|
||||
<Group key={moduleName} spacing="xs" align="center">
|
||||
<Text size="sm" fw={500}>{moduleName}</Text>
|
||||
<Badge color={color} variant="light">{status}</Badge>
|
||||
{(data?.error || data?.timestamp) && (
|
||||
<Popover
|
||||
opened={opened}
|
||||
onClose={() => setOpened(false)}
|
||||
position="bottom"
|
||||
withArrow
|
||||
shadow="sm"
|
||||
>
|
||||
<Popover.Target>
|
||||
<ActionIcon
|
||||
size="xs"
|
||||
color="blue"
|
||||
variant="light"
|
||||
onClick={() => setOpened((o) => !o)}
|
||||
>
|
||||
<IconInfoCircle size={14} />
|
||||
</ActionIcon>
|
||||
</Popover.Target>
|
||||
<Popover.Dropdown>
|
||||
<Stack spacing={4}>
|
||||
{data.error && <Text size="xs" c="red">Error: {data.error}</Text>}
|
||||
{data.timestamp && (
|
||||
<Text size="xs" c="dimmed">
|
||||
Updated: {new Date(data.timestamp).toLocaleString()}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
</Popover.Dropdown>
|
||||
</Popover>
|
||||
)}
|
||||
</Group>
|
||||
);
|
||||
}
|
||||
|
||||
// 主组件:健康信息卡片
|
||||
export default function NodeHealthCard({ node }) {
|
||||
const health = node.health || {};
|
||||
|
||||
const renderHealthItem = (moduleName, data) => {
|
||||
const status = data?.status || "unknown";
|
||||
const color = status === "healthy" ? "green" : status === "unhealthy" ? "red" : "gray";
|
||||
const [opened, setOpened] = useState(false);
|
||||
|
||||
return (
|
||||
<Group key={moduleName} spacing="xs" align="center">
|
||||
<Text size="sm" fw={500}>{moduleName}</Text>
|
||||
<Badge color={color} variant="light">{status}</Badge>
|
||||
{(data?.error || data?.timestamp) && (
|
||||
<Popover
|
||||
opened={opened}
|
||||
onClose={() => setOpened(false)}
|
||||
position="bottom"
|
||||
withArrow
|
||||
shadow="sm"
|
||||
>
|
||||
<Popover.Target>
|
||||
<ActionIcon size="xs" color="blue" variant="light" onClick={() => setOpened((o) => !o)}>
|
||||
<IconInfoCircle size={14} />
|
||||
</ActionIcon>
|
||||
</Popover.Target>
|
||||
<Popover.Dropdown>
|
||||
<Stack spacing={4}>
|
||||
{data.error && <Text size="xs" c="red">Error: {data.error}</Text>}
|
||||
{data.timestamp && (
|
||||
<Text size="xs" c="dimmed">
|
||||
Updated: {new Date(data.timestamp).toLocaleString()}
|
||||
</Text>
|
||||
)}
|
||||
</Stack>
|
||||
</Popover.Dropdown>
|
||||
</Popover>
|
||||
)}
|
||||
</Group>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Card shadow="xs" radius="md" withBorder>
|
||||
<Text fw={600} mb="sm">健康信息</Text>
|
||||
<Stack spacing="xs">
|
||||
{Object.entries(health).map(([moduleName, data]) =>
|
||||
renderHealthItem(moduleName, data)
|
||||
)}
|
||||
{Object.entries(health).map(([moduleName, data]) => (
|
||||
<HealthItem key={moduleName} moduleName={moduleName} data={data} />
|
||||
))}
|
||||
</Stack>
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Link } from "react-router-dom";
|
||||
import NodeStatus from "./NodeStatus";
|
||||
import PaginationControl from "./PaginationControl";
|
||||
import { apiRequest } from "../config/request";
|
||||
import { MASTER_API } from "../config/api";
|
||||
import { MASTER_API, EXTERNAL_HOST } from "../config/api";
|
||||
|
||||
export function NodeTable({
|
||||
withSearch = false,
|
||||
@@ -56,13 +56,28 @@ export function NodeTable({
|
||||
<Table.Td>{node.version}</Table.Td>
|
||||
{withActions && (
|
||||
<Table.Td>
|
||||
<Button
|
||||
size="xs"
|
||||
variant="light"
|
||||
onClick={() => fetchDetail && fetchDetail(node.id)}
|
||||
>
|
||||
查看详情
|
||||
</Button>
|
||||
<Group spacing="xs">
|
||||
{/* 查看详情 */}
|
||||
<Button
|
||||
size="xs"
|
||||
variant="light"
|
||||
onClick={() => fetchDetail && fetchDetail(node.id)}
|
||||
>
|
||||
查看详情
|
||||
</Button>
|
||||
|
||||
{/* Grafana Dashboard 链接 */}
|
||||
<Button
|
||||
size="xs"
|
||||
variant="outline"
|
||||
component="a"
|
||||
href={`${EXTERNAL_HOST.GRAFANA}/d/node_gpu_metrics/node-and-gpu-metrics?var-hostname=${encodeURIComponent(node.name)}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Grafana
|
||||
</Button>
|
||||
</Group>
|
||||
</Table.Td>
|
||||
)}
|
||||
</Table.Tr>
|
||||
@@ -71,8 +86,6 @@ export function NodeTable({
|
||||
return (
|
||||
<Card shadow="sm" radius="md" p="lg">
|
||||
{/* 标题 + 查看更多 */}
|
||||
|
||||
|
||||
{(title || viewMoreLink) && (
|
||||
<Group position="apart" mb="sm">
|
||||
{title && <Text fw={700} size="lg">{title}</Text>}
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function Sidebar() {
|
||||
const location = useLocation(); // 路由变化时会触发 Sidebar 重新渲染
|
||||
|
||||
const links = [
|
||||
{ to: "/dashboard", label: "概览仪表盘", icon: <IconGauge size={16} /> },
|
||||
{ to: "/dashboard", label: "仪表盘", icon: <IconGauge size={16} /> },
|
||||
{ to: "/nodeInfo", label: "节点信息", icon: <IconServer size={16} /> },
|
||||
{ to: "/metrics", label: "指标详情", icon: <IconActivity size={16} /> },
|
||||
{ to: "/logs", label: "日志详情", icon: <IconFileText size={16} /> },
|
||||
|
||||
@@ -17,14 +17,14 @@ export const MASTER_API = {
|
||||
|
||||
// 其他外部 API
|
||||
export const EXTERNAL_API = {
|
||||
ALERTS_INFOS: "http://localhost:9093/api/v2/alerts",
|
||||
ALERTS_INFOS: "http://alertmanager.alert.argus.com/api/v2/alerts",
|
||||
};
|
||||
|
||||
// 外部服务 Host
|
||||
export const EXTERNAL_HOST = {
|
||||
ALERTS: "http://localhost:9093",
|
||||
ALERTS: "http://alertmanager.alert.argus.com",
|
||||
GRAFANA: "http://grafana.metric.argus.com",
|
||||
GRAFANA_DASHBOARD: "http://grafana.metric.argus.com/d/cluster-dashboard/cluster-dashboard",
|
||||
PROMETHEUS: "http://prometheus.metric.argus.com",
|
||||
ES: "http://es.log.argus.com",
|
||||
KIBANA: "http://kibana.log.argus.com",
|
||||
KIBANA: "http://kibana.log.argus.com/app/discover",
|
||||
};
|
||||
|
||||
@@ -5,12 +5,11 @@ import kibanaLogo from "../assets/kibana.png";
|
||||
import { EXTERNAL_HOST } from "./api";
|
||||
|
||||
export const metricsEntries = [
|
||||
{ label: "Grafana", href: EXTERNAL_HOST.GRAFANA, icon: grafanaLogo },
|
||||
{ label: "Grafana", href: EXTERNAL_HOST.GRAFANA_DASHBOARD, icon: grafanaLogo },
|
||||
{ label: "Prometheus", href: EXTERNAL_HOST.PROMETHEUS, icon: prometheusLogo },
|
||||
];
|
||||
|
||||
export const logsEntries = [
|
||||
{ label: "Elasticsearch", href: EXTERNAL_HOST.ES, icon: esLogo },
|
||||
{ label: "Kibana", href: EXTERNAL_HOST.KIBANA, icon: kibanaLogo },
|
||||
];
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState, useMemo } from "react";
|
||||
import { Stack, Title, Loader, Center, Group, Button, Badge, ActionIcon } from "@mantine/core";
|
||||
import { Stack, Title, Loader, Center, Group, Button, Badge, ActionIcon, Switch } from "@mantine/core";
|
||||
import { IconRefresh } from "@tabler/icons-react";
|
||||
import { apiRequest } from "../config/request";
|
||||
import { EXTERNAL_API } from "../config/api";
|
||||
@@ -17,18 +17,20 @@ export default function Alerts() {
|
||||
const [page, setPage] = useState(1);
|
||||
const pageSize = 10;
|
||||
const [sortConfig, setSortConfig] = useState({ key: "startsAt", direction: "desc" });
|
||||
const [autoRefresh, setAutoRefresh] = useState(true); // 默认开启自动刷新
|
||||
|
||||
async function fetchAlerts() {
|
||||
setLoading(true);
|
||||
const data = await apiRequest(EXTERNAL_API.ALERTS_INFOS);
|
||||
if (data && Array.isArray(data)) {
|
||||
setAlerts(data);
|
||||
const counts = { critical: 0, warning: 0, info: 0 };
|
||||
const counts = { critical: 0, warning: 0, info: 0, total: 0 };
|
||||
data.forEach((alert) => {
|
||||
const sev = alert.labels?.severity || "info";
|
||||
if (sev === "critical") counts.critical++;
|
||||
else if (sev === "warning") counts.warning++;
|
||||
else counts.info++;
|
||||
counts.total++;
|
||||
});
|
||||
setStats(counts);
|
||||
}
|
||||
@@ -37,9 +39,14 @@ export default function Alerts() {
|
||||
|
||||
useEffect(() => {
|
||||
fetchAlerts();
|
||||
const timer = setInterval(fetchAlerts, 30000);
|
||||
|
||||
let timer;
|
||||
if (autoRefresh) {
|
||||
timer = setInterval(fetchAlerts, 30000);
|
||||
}
|
||||
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
}, [autoRefresh]);
|
||||
|
||||
// 节点选项
|
||||
const nodeOptions = useMemo(() => {
|
||||
@@ -124,7 +131,14 @@ export default function Alerts() {
|
||||
<Stack spacing="lg" p="md">
|
||||
<Group position="apart">
|
||||
<Title order={2}>告警详情</Title>
|
||||
<Button component="a" href="{EXTERNAL_HOST.ALERTS}" target="_blank" variant="outline">
|
||||
<Switch
|
||||
checked={autoRefresh}
|
||||
onChange={(e) => setAutoRefresh(e.currentTarget.checked)}
|
||||
label="自动刷新"
|
||||
color="green"
|
||||
size="sm"
|
||||
/>
|
||||
<Button component="a" href={EXTERNAL_HOST.ALERTS} target="_blank" variant="outline">
|
||||
打开 Alertmanager
|
||||
</Button>
|
||||
<ActionIcon onClick={fetchAlerts} color="blue" variant="filled" size="lg" title="刷新">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Grid, Text } from "@mantine/core";
|
||||
import { Grid, Text, Stack, Title } from "@mantine/core";
|
||||
import { NodeTable } from "../components/NodeTable";
|
||||
import { HealthCard } from "../components/HealthCard";
|
||||
import { AlertStats } from "../components/AlertStats";
|
||||
@@ -14,12 +14,13 @@ export default function Dashboard() {
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
const countAlerts = (data) => {
|
||||
const stats = { critical: 0, warning: 0, info: 0 };
|
||||
const stats = { critical: 0, warning: 0, info: 0, total: 0 };
|
||||
data?.forEach((alert) => {
|
||||
const severity = alert.labels?.severity || "info";
|
||||
if (severity === "critical") stats.critical++;
|
||||
else if (severity === "warning") stats.warning++;
|
||||
else stats.info++;
|
||||
stats.total++;
|
||||
});
|
||||
return stats;
|
||||
};
|
||||
@@ -41,7 +42,7 @@ export default function Dashboard() {
|
||||
status_statistics: healthRes?.status_statistics || [],
|
||||
});
|
||||
|
||||
setAlerts(countAlerts(alertsRes?.data || []));
|
||||
setAlerts(countAlerts(alertsRes || []));
|
||||
} catch (err) {
|
||||
console.error("获取 Dashboard 数据失败:", err);
|
||||
} finally {
|
||||
@@ -61,13 +62,16 @@ export default function Dashboard() {
|
||||
}
|
||||
|
||||
return (
|
||||
<Grid>
|
||||
<Stack spacing="lg" p="md">
|
||||
<Title order={1} mb="md">仪表盘</Title>
|
||||
<Grid>
|
||||
|
||||
<Grid.Col span={6}><HealthCard health={health} /></Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<AlertStats stats={alerts} layout="column" title="告警统计" link="/alerts" />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={12}><NodeTable clusterData={cluster} title="集群节点" viewMoreLink="/nodeInfo" /></Grid.Col>
|
||||
</Grid>
|
||||
<Grid.Col span={6}><HealthCard health={health} /></Grid.Col>
|
||||
<Grid.Col span={6}>
|
||||
<AlertStats stats={alerts} layout="column" title="告警统计" link="/alerts" />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={12}><NodeTable clusterData={cluster} title="集群节点" viewMoreLink="/nodeInfo" /></Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { metricsEntries } from "../config/entries";
|
||||
export default function Metrics() {
|
||||
return (
|
||||
<Stack spacing="lg" p="md">
|
||||
<Title order={2}>指标入口</Title>
|
||||
<Title order={2}>指标详情</Title>
|
||||
<Grid gutter="lg">
|
||||
{metricsEntries.map((entry) => (
|
||||
<Grid.Col key={entry.href} span={{ base: 12, sm: 4, md: 3 }}>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from "react";
|
||||
import { Grid } from "@mantine/core";
|
||||
import { Grid, Stack, Title } from "@mantine/core";
|
||||
import { apiRequest } from "../config/request";
|
||||
import { MASTER_API } from "../config/api";
|
||||
import { NodeTable } from "../components/NodeTable";
|
||||
@@ -23,24 +23,30 @@ export default function NodePage() {
|
||||
};
|
||||
|
||||
return (
|
||||
<Grid gutter="lg">
|
||||
{/* 左侧:节点表格 */}
|
||||
<Grid.Col span={drawerOpen ? 8 : 12}>
|
||||
<NodeTable
|
||||
withSearch
|
||||
withPagination
|
||||
withActions
|
||||
fetchDetail={fetchNodeDetail}
|
||||
/>
|
||||
</Grid.Col>
|
||||
<Stack spacing="lg" p="md">
|
||||
<Title order={2} mb="md">
|
||||
节点信息
|
||||
</Title>
|
||||
|
||||
{/* 节点详情 Drawer */}
|
||||
<NodeDetailDrawer
|
||||
opened={drawerOpen}
|
||||
onClose={() => setDrawerOpen(false)}
|
||||
nodeId={selectedNodeId}
|
||||
loading={detailLoading}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid gutter="lg">
|
||||
{/* 左侧:节点表格 */}
|
||||
<Grid.Col span={drawerOpen ? 8 : 12}>
|
||||
<NodeTable
|
||||
withSearch
|
||||
withPagination
|
||||
withActions
|
||||
fetchDetail={fetchNodeDetail}
|
||||
/>
|
||||
</Grid.Col>
|
||||
|
||||
{/* 节点详情 Drawer */}
|
||||
<NodeDetailDrawer
|
||||
opened={drawerOpen}
|
||||
onClose={() => setDrawerOpen(false)}
|
||||
nodeId={selectedNodeId}
|
||||
loading={detailLoading}
|
||||
/>
|
||||
</Grid>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
||||
5
src/web/tests/.env.example
Normal file
5
src/web/tests/.env.example
Normal file
@@ -0,0 +1,5 @@
|
||||
DATA_ROOT=/home/argus/tmp/private/argus
|
||||
ARGUS_UID=1048
|
||||
ARGUS_GID=1048
|
||||
|
||||
USE_INTRANET=false
|
||||
@@ -1,4 +1,3 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
web-frontend:
|
||||
build:
|
||||
@@ -20,7 +19,7 @@ services:
|
||||
- ${DATA_ROOT:-./data}/web:/private/argus/web/frontend
|
||||
- ${DATA_ROOT:-./data}/etc:/private/argus/etc
|
||||
networks:
|
||||
- argus-network
|
||||
- argus-debug-net
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: "json-file"
|
||||
@@ -45,7 +44,7 @@ services:
|
||||
volumes:
|
||||
- ${DATA_ROOT:-./data}/etc:/private/argus/etc
|
||||
networks:
|
||||
- argus-network
|
||||
- argus-debug-net
|
||||
restart: unless-stopped
|
||||
logging:
|
||||
driver: "json-file"
|
||||
@@ -54,9 +53,8 @@ services:
|
||||
max-file: "3"
|
||||
|
||||
networks:
|
||||
argus-network:
|
||||
driver: bridge
|
||||
name: argus-network
|
||||
argus-debug-net:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
web-frontend_data:
|
||||
|
||||
Reference in New Issue
Block a user