refactor: 统一 DB/Redis 配置为 DSN 模式 + 移除 Helm/K8s 部署

- DatabaseConfig: Host/Port/User/Password/Name/DBName/SSLMode → 单个 DSN 字段
- RedisConfig: Host/Port/Password/DB/URL → 单个 DSN 字段
- 环境变量: GOCHAT_DATABASE_* (7个) → GOCHAT_DATABASE_DSN, GOCHAT_REDIS_* (5个) → GOCHAT_REDIS_DSN
- validator.go: DSN URL 解析校验 (scheme + host)
- redis.go: redis.ParseURL(cfg.DSN) 直连
- 所有 docker-compose / CI / shell 脚本 / .env 同步更新
- 删除 deploy/helm/ 整个目录 (20个文件)
- CI 删除 helm-validate / deploy-staging / deploy-production 三个 job
- 文档同步更新 (README, 架构设计, PRD, 滚动升级)
This commit is contained in:
Rogee
2026-07-29 20:58:10 +08:00
parent 851ca7e372
commit 92f0d51375
46 changed files with 185 additions and 1464 deletions
+4 -14
View File
@@ -60,13 +60,8 @@ services:
env_file: ../../.env
environment:
- GOCHAT_ENV=development
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_DATABASE=gochat_dev
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- REDIS_HOST=redis
- REDIS_PORT=6379
- GOCHAT_DATABASE_DSN=postgres://postgres:postgres@postgres:5432/gochat_dev?sslmode=disable
- GOCHAT_REDIS_DSN=redis://redis:6379
- SMTP_HOST=mailhog
- SMTP_PORT=1025
@@ -86,13 +81,8 @@ services:
env_file: ../../.env
environment:
- GOCHAT_ENV=development
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_DATABASE=gochat_dev
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- REDIS_HOST=redis
- REDIS_PORT=6379
- GOCHAT_DATABASE_DSN=postgres://postgres:postgres@postgres:5432/gochat_dev?sslmode=disable
- GOCHAT_REDIS_DSN=redis://redis:6379
volumes:
postgres_data:
+4 -8
View File
@@ -60,10 +60,8 @@ services:
env_file: ../../.env
environment:
- GOCHAT_ENV=production
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- REDIS_HOST=redis
- REDIS_PORT=6379
- GOCHAT_DATABASE_DSN=postgres://${POSTGRES_USER:-gochat}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-gochat_production}?sslmode=disable
- GOCHAT_REDIS_DSN=redis://:${REDIS_PASSWORD}@redis:6379
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
@@ -92,10 +90,8 @@ services:
env_file: ../../.env
environment:
- GOCHAT_ENV=production
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- REDIS_HOST=redis
- REDIS_PORT=6379
- GOCHAT_DATABASE_DSN=postgres://${POSTGRES_USER:-gochat}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-gochat_production}?sslmode=disable
- GOCHAT_REDIS_DSN=redis://:${REDIS_PASSWORD}@redis:6379
deploy:
resources:
limits:
+2 -7
View File
@@ -40,12 +40,7 @@ services:
condition: service_healthy
environment:
- GOCHAT_ENV=test
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DATABASE=gochat_test
- REDIS_HOST=redis
- REDIS_PORT=6379
- GOCHAT_DATABASE_DSN=postgres://postgres:postgres@postgres:5432/gochat_test?sslmode=disable
- GOCHAT_REDIS_DSN=redis://redis:6379
- GOCHAT_JWT_SECRET=test_secret
command: ["test"]
+2 -6
View File
@@ -58,12 +58,8 @@ services:
env_file: ../../.env
environment:
- GOCHAT_ENV=development
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_DATABASE=gochat_dev
- POSTGRES_USERNAME=postgres
- POSTGRES_PASSWORD=postgres
- REDIS_URL=redis://redis:6379
- GOCHAT_DATABASE_DSN=postgres://postgres:postgres@postgres:5432/gochat_dev?sslmode=disable
- GOCHAT_REDIS_DSN=redis://redis:6379
volumes:
- ../../backend:/app:delegated