36fce94692
Add a single-service docker-compose setup with bind-mounted config / templates / apps / playbooks / data so users can iterate on inventory and intents without rebuilding the image. Dockerfile uses python:3.12-slim with tini for clean signal handling, and ships openssh-client for in- container troubleshooting. Health check hits the /health endpoint. README documents project background, the L1-L5 architecture, both local and Docker deployment paths, configuration keys, intent template extension, and the safety model. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
50 lines
1.5 KiB
YAML
50 lines
1.5 KiB
YAML
services:
|
|
ops:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
image: ai-app-ops-tools:latest
|
|
container_name: ai-app-ops-tools
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${OPS_PORT:-8000}:8000"
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
# 容器内固定监听 0.0.0.0;对外端口通过上面的 ports 映射
|
|
OPS_HOST: "0.0.0.0"
|
|
OPS_PORT: "8000"
|
|
# SQLite 数据库路径与卷挂载点一致
|
|
OPS_DB_URL: "sqlite+aiosqlite:////app/data/ops.db"
|
|
volumes:
|
|
# 配置、模板、台账、剧本都用 bind mount,方便不重启即可编辑
|
|
- ./config:/app/config
|
|
- ./templates:/app/templates
|
|
- ./apps:/app/apps
|
|
- ./playbooks:/app/playbooks
|
|
# 审计日志 + SQLite 持久化
|
|
- ./data:/app/data
|
|
# SSH 密钥(按需启用;Windows 上路径需自行调整)
|
|
# - ${HOME}/.ssh:/root/.ssh:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3)\""]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# 未来如需切换到 PostgreSQL,可解开下面的注释并修改 OPS_DB_URL
|
|
# db:
|
|
# image: postgres:16-alpine
|
|
# container_name: ai-app-ops-tools-db
|
|
# restart: unless-stopped
|
|
# environment:
|
|
# POSTGRES_USER: ops
|
|
# POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
|
|
# POSTGRES_DB: ops
|
|
# volumes:
|
|
# - pgdata:/var/lib/postgresql/data
|
|
#
|
|
# volumes:
|
|
# pgdata:
|