外置资源配置指南
📘 概述
CSGHUB 在默认安装时会自动启用一组 内置基础服务(PostgreSQL、Redis、MinIO、Registry、Gitaly 等)。
在生产环境中,通常推荐改为使用 外部托管资源(外置数据库、缓存、对象存储等)以获得更高的可用性与性能。
⚙️ 内置资源禁用与优先级逻辑
✅ 禁用机制
-
通过设置:
global.<component>.enabled=false -
即可禁用对应的内置组件(例如
global.postgresql.enabled=false)。 -
当该字段为 false 时,Helm 会自动跳过该组件的内置部署(无需额外关闭 postgresql.enabled)。
🧩 默认命名规则
-
数据库名、存储桶(Bucket)名等 都有默认命名规则,默认格式为
csghub-{service}。 -
例如:
- csghub-server
- csghub-portal
- csghub-runner
-
这些名称不需要在 global 中显式配置。
-
如果需要修改,可以在各服务的局部配置中指定:
server:
objectStore:
bucket: "my-custom-bucket"
🔝 配置优先级
配置的生效顺序如下:
| 优先级 | 级别 | 示例 |
|---|---|---|
| 🥇 1 | 服务级 (local) | server.objectStore.bucket |
| 🥈 2 | 全局级 (global) | global.objectStore.external.endpoint |
服务级配置总是优先于全局配置。
🧠 配置示例
以下示例展示如何使用外部 PostgreSQL、Redis、MinIO、Registry 等资源。
1️⃣ PostgreSQL(数据库)
global:
postgresql:
enabled: false
external:
host: "postgres.example.com"
port: 5432
user: "csghub"
password: "StrongPassword"
timezone: "Asia/Shanghai"
sslmode: "prefer"
## 以下配置是各资源默认的数据库配置示例,可以通过修改`database`来指定新的数据库名字。
casdoor:
postgresql:
database: "new_casdoor_database"
temporal:
postgresql:
database: "new_temporal_database"
server:
postgresql:
database: "new_server_database"
portal:
postgresql:
database: "new_portal_database"
dataflow:
dataflow:
postgresql:
database: "new_dataflow_database"
labelStudio:
postgresql:
database: "new_label_studio_database"
csgship:
web:
postgresql:
database: "new_csgship_database"
2️⃣ Redis(缓存)
global:
redis:
enabled: false
external:
host: "redis.example.com"
port: 6379
password: "RedisStrongPassword"
3️⃣ MinIO / S3(对象存储)
global:
objectStore:
enabled: false
external:
endpoint: "https://s3.amazonaws.com"
accessKey: "AKIAxxxx"
secretKey: "xxxx"
region: "us-east-1"
secure: "true"
pathStyle: "false"
## 以下配置是各资源默认的存储桶配置示例,可以通过修改`bucket`来指定新的存储桶名字。
registry:
objectStore:
bucket: "new-registry-bucket"
server:
objectStore:
bucket: "new-server-bucket"
## 除此之外这里还需要另外一个存储桶 `{service}-public`, 根据 service 自动命名,暂不支持自定义
## 因为这个桶需要公开访问,因此定义了`-public`标识
portal:
objectStore:
bucket: "new-portal-bucket"
runner:
objectStore:
bucket: "new-runner-bucket"
csgship:
billing:
objectStore:
bucket: "new-billing-bucket"
4️⃣ Registry(镜像仓库)
global:
registry:
enabled: false
external:
registry: "registry.example.com"
repository: "csghub"
username: "user"
password: "pass"
insecure: "false"
5️⃣ Gitaly(Git 存储)
global:
gitaly:
enabled: false
external:
scheme: "tcp"
host: "gitaly.example.com"
port: 8075
token: "gitaly_token"
storage: "default"
6️⃣ Dataflow(数据流服务)
global:
dataflow:
enabled: false
external:
host: "dataflow.example.com"
port: 80
🧭 小结
| 项目 | 关闭方式 | 外部配置路径 | 命 名示例 |
|---|---|---|---|
| PostgreSQL | global.postgresql.enabled=false | global.postgresql.external | csghub_<service> |
| Redis | global.redis.enabled=false | global.redis.external | — |
| MinIO / S3 | global.objectStore.enabled=false | global.objectStore.external | csghub-<service> |
| Registry | global.registry.enabled=false | global.registry.external | — |
| Gitaly | global.gitaly.enabled=false | global.gitaly.external | — |
| Dataflow | global.dataflow.enabled=false | global.dataflow.external | — |