From d1ee0bbad2c44a2e45f3de74429a856dc2e56681 Mon Sep 17 00:00:00 2001 From: YANG JIANKUAN Date: Fri, 3 Apr 2026 17:43:09 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=8A=A0=E5=9B=BA=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除未使用的 Redis 服务 - 移除 PostgreSQL 端口暴露,仅保留 Docker 内部访问 - server 添加 healthcheck,mcp 依赖 server 确保 migration 完成后启动 - .dockerignore 排除 .env 等敏感文件 - .env.example 对齐实际所需字段 Co-Authored-By: Claude Opus 4.6 --- .dockerignore | 6 ++++++ .env.example | 19 +++++-------------- docker-compose.dev.yml | 6 ------ docker-compose.yml | 29 +++++++---------------------- 4 files changed, 18 insertions(+), 42 deletions(-) diff --git a/.dockerignore b/.dockerignore index dd968c3..9f77524 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,5 +2,11 @@ node_modules .worktrees .claude .git +.env +.env.* +!.env.example +dist +docs +*.zip *.md !README.md diff --git a/.env.example b/.env.example index ef7bfe1..7f3f4b7 100644 --- a/.env.example +++ b/.env.example @@ -1,18 +1,9 @@ -DATABASE_URL=postgresql://agentfox:agentfox@localhost:5432/agentfox JWT_SECRET=change-me-to-a-random-secret JWT_REFRESH_SECRET=change-me-to-another-random-secret -GITHUB_CLIENT_ID= -GITHUB_CLIENT_SECRET= +API_KEY_ENCRYPTION_SECRET=change-me-to-a-64-char-hex-string GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= -MCP_BASE_URL=http://localhost:3001 -SERVER_PORT=3000 -MCP_PORT=3001 -WEB_PORT=5173 -REDIS_URL=redis://localhost:6379 -APPLE_CLIENT_ID= -APPLE_TEAM_ID= -APPLE_KEY_ID= -APPLE_PRIVATE_KEY= -OAUTH_CALLBACK_BASE_URL=http://localhost:3000 -FRONTEND_URL=http://localhost:5173 +GITHUB_CLIENT_ID= +GITHUB_CLIENT_SECRET= +OAUTH_CALLBACK_BASE_URL=https://your-domain.com +FRONTEND_URL=https://your-domain.com diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 96d0757..281552a 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -3,10 +3,6 @@ services: ports: - "5432:5432" - redis: - ports: - - "6379:6379" - server: build: context: . @@ -28,7 +24,6 @@ services: - ./prisma:/app/prisma environment: DATABASE_URL: postgresql://agentfox:agentfox@postgres:5432/agentfox - REDIS_URL: redis://redis:6379 JWT_SECRET: dev-secret JWT_REFRESH_SECRET: dev-refresh-secret SERVER_PORT: "3000" @@ -53,7 +48,6 @@ services: - ./prisma:/app/prisma environment: DATABASE_URL: postgresql://agentfox:agentfox@postgres:5432/agentfox - REDIS_URL: redis://redis:6379 MCP_PORT: "3001" NODE_ENV: development diff --git a/docker-compose.yml b/docker-compose.yml index 409b903..e26646d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,33 +7,18 @@ services: POSTGRES_DB: agentfox volumes: - pgdata:/var/lib/postgresql/data - ports: - - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U agentfox"] interval: 5s timeout: 5s retries: 5 - redis: - image: redis:7-alpine - ports: - - "6379:6379" - volumes: - - redisdata:/data - healthcheck: - test: ["CMD", "redis-cli", "ping"] - interval: 5s - timeout: 5s - retries: 5 - server: build: context: . dockerfile: packages/server/Dockerfile environment: DATABASE_URL: postgresql://agentfox:agentfox@postgres:5432/agentfox - REDIS_URL: redis://redis:6379 JWT_SECRET: ${JWT_SECRET:-change-me-in-production} JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:-change-me-refresh-in-production} API_KEY_ENCRYPTION_SECRET: ${API_KEY_ENCRYPTION_SECRET:-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef} @@ -49,8 +34,12 @@ services: depends_on: postgres: condition: service_healthy - redis: - condition: service_healthy + healthcheck: + test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/api/health"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 30s mcp: build: @@ -58,14 +47,11 @@ services: dockerfile: packages/mcp/Dockerfile environment: DATABASE_URL: postgresql://agentfox:agentfox@postgres:5432/agentfox - REDIS_URL: redis://redis:6379 MCP_PORT: "3001" ports: - "3001:3001" depends_on: - postgres: - condition: service_healthy - redis: + server: condition: service_healthy web: @@ -80,4 +66,3 @@ services: volumes: pgdata: - redisdata: