بنقرة واحدة
aegis-build-test
Aegis 系统构建测试技能 - agent/server/dc/api-server 构建部署和 gRPC 数据流测试
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Aegis 系统构建测试技能 - agent/server/dc/api-server 构建部署和 gRPC 数据流测试
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Aegis Software Designer skill - design-driven development workflow with TDD, documentation-first, and mandatory build/test verification
Use this skill when writing or modifying application code that needs normal operational logging, especially when the code lacks logs or a unified logging library.
Use this skill when the current task is essentially a bug, runtime error, failed test, CI failure, abnormal behavior, feature regression, or unexpected functionality. The AI must first trace the complete bug-related call chain, analyze the root cause based on business logic, and then apply the smallest safe fix.
Aegis 离线部署包构建技能 - Docker 镜像导出、数据库初始化、一键启动脚本、MinIO Agent 预置
| name | aegis-build-test |
| description | Aegis 系统构建测试技能 - agent/server/dc/api-server 构建部署和 gRPC 数据流测试 |
| version | 1.1.0 |
| source | manual-creation |
本技能用于 AI 学习 Aegis 系统架构、构建部署流程和 API 测试。
| 服务 | HTTP 端口 | gRPC 端口 | 容器名 |
|---|---|---|---|
| api-server | 8082 | 19093 | aegis-api-server |
| server | - | 19090, 19094 | aegis-server |
| dc | - | 19092 | aegis-dc |
| frontend | 8081 | - | aegis-frontend |
| postgres | 5432 | - | aegis-postgres |
| redis | 6379 | - | aegis-redis |
| minio | 9000/9001 | - | aegis-minio |
| kafka | 29092 | - | aegis-kafka |
cat aegis_system_design_v5.5/README.md
cat aegis_system_design_v5.5/architecture_design_v5.5.md
cat aegis_system_design_v5.5/communication_protocol_design_v5.5.md
cat aegis_system_design_v5.5/backend_detailed_design_v5.5_complete.md
cat aegis_system_design_v5.5/agent_detailed_design_v5.5_complete.md
cat aegis_system_design_v5.5/frontend_detailed_design_v5.5_complete.md
cat aegis_system_design_v5.5/database_structure_design_v5.5_complete.md
适用于:修改单个服务代码后快速构建部署
# 仅构建单个服务镜像(不启动)
docker compose build <service>
# 构建并启动单个服务(会重建容器)
docker compose up -d --build <service>
# 可用服务: api-server, server, dc, frontend
示例:修改 api-server 后快速部署
docker compose up -d --build api-server
docker compose logs -f api-server # 查看日志确认启动
# API Server
cd api-server && make build
# Server
cd server && make build
# DC
cd dc && make build
# Agent(包含 eBPF 编译)
cd agent && make all
# 启动/停止/重启单个服务
docker compose start <service>
docker compose stop <service>
docker compose restart <service>
# 重建并重启(代码修改后使用)
docker compose up -d --build <service>
# 查看实时日志
docker compose logs -f <service>
# 查看服务状态
docker compose ps
# 检查服务健康
docker compose exec <service> wget --spider -q localhost:<port>/health 2>/dev/null && echo "OK" || echo "FAIL"
# 启动/停止所有服务
docker compose up -d
docker compose down
# 停止并清除数据卷(慎用!)
docker compose down -v
# 重新构建所有镜像
docker compose build --no-cache
docker compose up -d
| 服务 | 检查命令 | 期望输出 |
|---|---|---|
| api-server | curl -s http://localhost:8082/health | {"status":"ok"} |
| server | nc -z localhost 19090 && echo OK | OK |
| dc | nc -z localhost 19092 && echo OK | OK |
| postgres | pg_isready -U aegis_user -d aegis_db | accepting connections |
| redis | redis-cli -a <password> ping | PONG |
| minio | mc ready local | OK |
MINIO 服务地址: http://localhost:9000
MINIO Console: http://localhost:9001
IMPORTANT: Credentials must NEVER be hardcoded. Users MUST provide their MINIO credentials in the conversation when needed.
在 .env 文件中配置(使用用户提供的凭证):
MINIO_ACCESS_KEY=<USER_PROVIDED_ACCESS_KEY>
MINIO_SECRET_KEY=<USER_PROVIDED_SECRET_KEY>
# 1. 设置环境变量(使用用户提供的凭证)
export MINIO_ENDPOINT=localhost:9000
export MINIO_ACCESS_KEY=<USER_PROVIDED_ACCESS_KEY>
export MINIO_SECRET_KEY=<USER_PROVIDED_SECRET_KEY>
# 2. 构建并上传(一次性完成)
cd agent && make all && make upload
# 3. 验证上传
# 访问 http://localhost:9001 → agent-artifacts bucket
MINIO_ENDPOINT=<server>:9000 \
MINIO_ACCESS_KEY=<your_key> \
MINIO_SECRET_KEY=<your_secret> \
make upload
cd agent && make all && make upload
sudo /opt/aegis-agent/uninstall.sh
curl -sSL http://<API_SERVER_IP>:8082/api/v1/agent/install.sh | sudo bash
# 检查服务状态
sudo systemctl status aegis-agent
# 查看实时日志
sudo journalctl -u aegis-agent -f
# 检查进程
ps aux | grep aegis-agent
curl http://localhost:8082/health
curl -X POST http://localhost:8082/api/v1/vulnerability/scan \
-H "Content-Type: application/json" \
-d '{"host_id":1,"scan_type":"full"}'
Agent → Server (19090) → Kafka → DC (19092) → PostgreSQL
测试步骤:
docker compose logs server | grep agentdocker compose exec kafka kafka-console-consumer --topic aegis.security.events --from-beginningdocker compose logs dcdocker compose exec postgres psql -U aegis_user -d aegis_db -c "SELECT COUNT(*) FROM alerts;"# 1. 查看详细日志
docker compose logs <service>
# 2. 检查端口占用
netstat -tlnp | grep <port>
# 3. 检查依赖服务是否就绪
docker compose ps
# 1. 检查 Server gRPC 端口
docker compose exec server nc -z localhost 19090
# 2. 检查 Agent 日志
sudo journalctl -u aegis-agent | grep -i error
# 3. 验证网络连通性
telnet <server_ip> 19090
# 1. 验证 MINIO 服务
docker compose ps minio
# 2. 检查凭证
mc alias list
# 3. 手动测试上传
mc cp dist/aegis-agent.tar.gz local/agent-artifacts/
docker compose up -d --build
# 修改代码后快速重建
docker compose up -d --build <service>
# 查看日志
docker compose logs -f <service>