|
| 1 | +# Helm Values 自定义配置指南 |
| 2 | + |
| 3 | +本文档介绍如何通过 `HELM_OPTIONS` 环境变量传递 Helm `--set` 参数来自定义 Desktop Frontend 的所有配置项。 |
| 4 | + |
| 5 | +## 配置方式 |
| 6 | + |
| 7 | +### 方式 1: 通过 `HELM_OPTIONS` 使用 `--set` 参数 |
| 8 | + |
| 9 | +```bash |
| 10 | +sealos run desktop-frontend:latest \ |
| 11 | + -e HELM_OPTIONS="--set desktopConfig.cloudDomain=cloud.example.com --set desktopConfig.layoutTitle=\"My Cloud Platform\"" |
| 12 | +``` |
| 13 | + |
| 14 | +### 方式 2: 使用 `--set-string` 参数(用于确保值被当作字符串处理) |
| 15 | + |
| 16 | +```bash |
| 17 | +sealos run desktop-frontend:latest \ |
| 18 | + -e HELM_OPTIONS="--set-string desktopConfig.realNameReward=0" |
| 19 | +``` |
| 20 | + |
| 21 | +### 方式 3: 结合环境变量使用 |
| 22 | + |
| 23 | +环境变量优先级高于 `HELM_OPTIONS` 中的 `--set` 参数: |
| 24 | + |
| 25 | +```bash |
| 26 | +# 环境变量会覆盖 HELM_OPTIONS 中的值 |
| 27 | +sealos run desktop-frontend:latest \ |
| 28 | + -e HELM_OPTIONS="--set desktopConfig.cloudDomain=from-helm.com" \ |
| 29 | + -e CLOUD_DOMAIN=from-env.com # 这个值会生效 |
| 30 | +``` |
| 31 | + |
| 32 | +## 配置项分类 |
| 33 | + |
| 34 | +### 1. 基础云配置 |
| 35 | + |
| 36 | +```yaml |
| 37 | +desktopConfig: |
| 38 | + cloudDomain: "cloud.example.com" # 云域名 |
| 39 | + cloudPort: "" # 云端口(默认 443) |
| 40 | + regionUID: "region-123" # 区域 UID |
| 41 | + certSecretName: "wildcard-cert" # TLS 证书 Secret 名称 |
| 42 | +``` |
| 43 | +
|
| 44 | +### 2. 数据库配置 |
| 45 | +
|
| 46 | +```yaml |
| 47 | +desktopConfig: |
| 48 | + databaseMongodbURI: "mongodb://user:pass@mongodb:27017" |
| 49 | + databaseGlobalCockroachdbURI: "postgres://user:pass@cockroachdb:26257" |
| 50 | + databaseLocalCockroachdbURI: "postgres://user:pass@cockroachdb-local:26257" |
| 51 | +``` |
| 52 | +
|
| 53 | +### 3. 认证配置 |
| 54 | +
|
| 55 | +```yaml |
| 56 | +desktopConfig: |
| 57 | + passwordSalt: "your-random-salt" # 密码哈希盐 |
| 58 | + jwtInternal: "your-jwt-internal-key" # 内部 JWT 密钥 |
| 59 | + jwtRegional: "your-jwt-regional-key" # 区域 JWT 密钥 |
| 60 | + jwtGlobal: "your-jwt-global-key" # 全局 JWT 密钥 |
| 61 | +``` |
| 62 | +
|
| 63 | +### 4. 计费配置 |
| 64 | +
|
| 65 | +```yaml |
| 66 | +desktopConfig: |
| 67 | + billingUrl: "http://account-service.account-system.svc:2333" |
| 68 | + billingToken: "your-billing-token" |
| 69 | +``` |
| 70 | +
|
| 71 | +### 5. 货币和语言配置 |
| 72 | +
|
| 73 | +```yaml |
| 74 | +desktopConfig: |
| 75 | + version: "en" # UI 版本: "cn" 或 "en" |
| 76 | + # forcedLanguage 和 currencySymbol 会根据 version 自动配置: |
| 77 | + # - version: "cn" → forcedLanguage: "zh", currencySymbol: "shellCoin" |
| 78 | + # - version: "en" → forcedLanguage: "en", currencySymbol: "usd" |
| 79 | +``` |
| 80 | + |
| 81 | +### 6. Google Tag Manager |
| 82 | + |
| 83 | +```yaml |
| 84 | +desktopConfig: |
| 85 | + gtmId: "GTM-XXXXXXXX" # GTM ID |
| 86 | +``` |
| 87 | +
|
| 88 | +### 7. Discord 配置 |
| 89 | +
|
| 90 | +```yaml |
| 91 | +desktopConfig: |
| 92 | + discordInviteLink: "https://discord.gg/sealos" |
| 93 | +``` |
| 94 | +
|
| 95 | +### 8. 功能开关 |
| 96 | +
|
| 97 | +```yaml |
| 98 | +desktopConfig: |
| 99 | + guideEnabled: false # 启用用户引导 |
| 100 | + apiEnabled: false # 启用 API 访问 |
| 101 | + rechargeEnabled: false # 启用充值功能 |
| 102 | + enterpriseRealNameAuthEnabled: false # 启用企业实名认证 |
| 103 | + trackingEnabled: false # 启用追踪/统计 |
| 104 | + realNameAuthEnabled: false # 启用实名认证 |
| 105 | + licenseCheckEnabled: false # 启用 License 检查 |
| 106 | +``` |
| 107 | +
|
| 108 | +### 9. Common URLs 配置 |
| 109 | +
|
| 110 | +```yaml |
| 111 | +desktopConfig: |
| 112 | + realNameReward: 0 |
| 113 | + realNameCallbackUrl: "https://cloud.example.org/api/account/callback" |
| 114 | + templateUrl: "https://template.example.org" |
| 115 | + applaunchpadUrl: "https://applaunchpad.example.org" |
| 116 | + dbproviderUrl: "https://dbprovider.example.org" |
| 117 | + objectstorageUrl: "https://objectstorage.example.org" |
| 118 | + cfSiteKey: "" |
| 119 | +``` |
| 120 | +
|
| 121 | +### 10. 桌面布局配置 |
| 122 | +
|
| 123 | +```yaml |
| 124 | +desktopConfig: |
| 125 | + layoutTitle: "Sealos Cloud" # 平台标题 |
| 126 | + layoutLogo: "/logo.svg" # Logo 路径 |
| 127 | + layoutBackgroundImage: "/images/bg-light.svg" # 背景图片 |
| 128 | + customerServiceURL: "" # 客服 URL |
| 129 | + layoutDocsUrl: "https://sealos.run/docs/Intro/" # 文档 URL |
| 130 | +``` |
| 131 | +
|
| 132 | +### 11. Meta 标签配置 |
| 133 | +
|
| 134 | +```yaml |
| 135 | +desktopConfig: |
| 136 | + metaTitle: "Sealos Cloud" |
| 137 | + metaDescription: "Sealos Cloud" |
| 138 | + metaKeywords: "Sealos Cloud" |
| 139 | +``` |
| 140 | +
|
| 141 | +### 12. GitHub OAuth 配置 |
| 142 | +
|
| 143 | +```yaml |
| 144 | +desktopConfig: |
| 145 | + githubEnabled: true |
| 146 | + githubClientId: "your-github-client-id" |
| 147 | + githubClientSecret: "your-github-client-secret" |
| 148 | + githubProxyAddress: "" # 代理地址(可选) |
| 149 | +``` |
| 150 | +
|
| 151 | +### 13. 微信 OAuth 配置 |
| 152 | +
|
| 153 | +```yaml |
| 154 | +desktopConfig: |
| 155 | + wechatEnabled: true |
| 156 | + wechatClientId: "your-wechat-app-id" |
| 157 | + wechatClientSecret: "your-wechat-app-secret" |
| 158 | + wechatProxyAddress: "" # 代理地址(可选) |
| 159 | +``` |
| 160 | +
|
| 161 | +### 14. Google OAuth 配置 |
| 162 | +
|
| 163 | +```yaml |
| 164 | +desktopConfig: |
| 165 | + googleEnabled: true |
| 166 | + googleClientId: "your-google-client-id.apps.googleusercontent.com" |
| 167 | + googleClientSecret: "your-google-client-secret" |
| 168 | + googleProxyAddress: "" # 代理地址(可选) |
| 169 | +``` |
| 170 | +
|
| 171 | +### 15. 通用 OAuth2 配置 |
| 172 | +
|
| 173 | +```yaml |
| 174 | +desktopConfig: |
| 175 | + oauth2Enabled: true |
| 176 | + oauth2CallbackUrl: "https://cloud.example.com/callback" |
| 177 | + oauth2ClientId: "your-oauth2-client-id" |
| 178 | + oauth2ClientSecret: "your-oauth2-client-secret" |
| 179 | + oauth2AuthUrl: "https://oauth2.example.com/oauth2/auth" |
| 180 | + oauth2TokenUrl: "https://oauth2.example.com/oauth2/token" |
| 181 | + oauth2UserInfoUrl: "https://oauth2.example.com/oauth2/userinfo" |
| 182 | + oauth2ProxyAddress: "" # 代理地址(可选) |
| 183 | +``` |
| 184 | +
|
| 185 | +### 16. 验证码配置(Cloudflare Turnstile) |
| 186 | +
|
| 187 | +```yaml |
| 188 | +desktopConfig: |
| 189 | + turnstileEnabled: true |
| 190 | + turnstileSiteKey: "your-turnstile-site-key" |
| 191 | + turnstileSecretKey: "your-turnstile-secret-key" |
| 192 | +``` |
| 193 | +
|
| 194 | +### 17. 阿里云验证码配置 |
| 195 | +
|
| 196 | +```yaml |
| 197 | +desktopConfig: |
| 198 | + aliCaptchaEnabled: true |
| 199 | + aliCaptchaEndpoint: "https://captcha.aliyuncs.com" |
| 200 | + aliCaptchaSceneId: "your-scene-id" |
| 201 | + aliCaptchaPrefix: "your-prefix" |
| 202 | + aliCaptchaAccessKeyID: "your-access-key-id" |
| 203 | + aliCaptchaAccessKeySecret: "your-access-key-secret" |
| 204 | +``` |
| 205 | +
|
| 206 | +### 18. 短信配置(阿里云) |
| 207 | +
|
| 208 | +```yaml |
| 209 | +desktopConfig: |
| 210 | + smsEnabled: true |
| 211 | + smsAliEnabled: true |
| 212 | + smsAliEndpoint: "https://dysmsapi.aliyuncs.com" |
| 213 | + smsAliTemplateCode: "SMS_123456789" |
| 214 | + smsAliSignName: "YourSignName" |
| 215 | + smsAliAccessKeyID: "your-access-key-id" |
| 216 | + smsAliAccessKeySecret: "your-access-key-secret" |
| 217 | +``` |
| 218 | +
|
| 219 | +### 19. 邮件配置 |
| 220 | +
|
| 221 | +```yaml |
| 222 | +desktopConfig: |
| 223 | + emailEnabled: true |
| 224 | + emailHost: "smtp.example.com" |
| 225 | + emailPort: 587 |
| 226 | + emailUser: "noreply@example.com" |
| 227 | + emailPassword: "your-email-password" |
| 228 | + emailLanguage: "en" |
| 229 | +``` |
| 230 | +
|
| 231 | +### 20. 追踪配置(Umami) |
| 232 | +
|
| 233 | +```yaml |
| 234 | +desktopConfig: |
| 235 | + trackingWebsiteId: "your-website-id" |
| 236 | + trackingHostUrl: "https://umami.example.com" |
| 237 | + trackingScriptUrl: "https://umami.example.com/script.js" |
| 238 | +``` |
| 239 | +
|
| 240 | +### 21. 实名认证 OSS 配置 |
| 241 | +
|
| 242 | +```yaml |
| 243 | +desktopConfig: |
| 244 | + realNameOSSAccessKey: "your-oss-access-key" |
| 245 | + realNameOSSAccessKeySecret: "your-oss-secret-key" |
| 246 | + realNameOSSEndpoint: "oss-cn-hangzhou.aliyuncs.com" |
| 247 | + realNameOSSSSL: true |
| 248 | + realNameOSSPort: 443 |
| 249 | + realNameOSSRealNameBucket: "realname-bucket" |
| 250 | + realNameOSSEnterpriseRealNameBucket: "enterprise-realname-bucket" |
| 251 | +``` |
| 252 | +
|
| 253 | +### 22. 工作订单和云虚拟机配置 |
| 254 | +
|
| 255 | +```yaml |
| 256 | +desktopConfig: |
| 257 | + workorderUrl: "https://workorder.example.com" |
| 258 | + cloudVirtualMachineUrl: "https://cloudvirtualmachine.example.com" |
| 259 | +``` |
| 260 | +
|
| 261 | +### 23. 团队管理配置 |
| 262 | +
|
| 263 | +```yaml |
| 264 | +desktopConfig: |
| 265 | + maxTeamCount: 10 # 最大团队数 |
| 266 | + maxTeamMemberCount: 100 # 每个团队最大成员数 |
| 267 | +``` |
| 268 | +
|
| 269 | +## 使用示例 |
| 270 | +
|
| 271 | +### 示例 1: 自定义域名和标题 |
| 272 | +
|
| 273 | +```bash |
| 274 | +sealos run desktop-frontend:latest \ |
| 275 | + -e HELM_OPTIONS="--set desktopConfig.cloudDomain=mycloud.com --set desktopConfig.layoutTitle=\"My Cloud Platform\" --set desktopConfig.metaTitle=\"My Cloud Platform\" --set desktopConfig.metaDescription=\"Welcome to My Cloud Platform\"" |
| 276 | +``` |
| 277 | + |
| 278 | +### 示例 2: 启用 GitHub 和 Google 登录 |
| 279 | + |
| 280 | +```bash |
| 281 | +sealos run desktop-frontend:latest \ |
| 282 | + -e HELM_OPTIONS="--set desktopConfig.githubEnabled=true --set desktopConfig.githubClientId=your-github-id --set desktopConfig.githubClientSecret=your-github-secret --set desktopConfig.googleEnabled=true --set desktopConfig.googleClientId=your-google-id --set desktopConfig.googleClientSecret=your-google-secret" |
| 283 | +``` |
| 284 | + |
| 285 | +### 示例 3: 配置短信和邮件 |
| 286 | + |
| 287 | +```bash |
| 288 | +sealos run desktop-frontend:latest \ |
| 289 | + -e HELM_OPTIONS="--set desktopConfig.smsEnabled=true --set desktopConfig.smsAliEnabled=true --set desktopConfig.smsAliEndpoint=https://dysmsapi.aliyuncs.com --set desktopConfig.smsAliAccessKeyID=your-key-id --set desktopConfig.smsAliAccessKeySecret=your-key-secret --set desktopConfig.emailEnabled=true --set desktopConfig.emailHost=smtp.example.com --set desktopConfig.emailPort=587 --set desktopConfig.emailUser=noreply@example.com --set desktopConfig.emailPassword=your-password" |
| 290 | +``` |
| 291 | + |
| 292 | +### 示例 4: 完整生产环境配置 |
| 293 | + |
| 294 | +对于生产环境的多个配置,直接通过 `HELM_OPTIONS` 传递所有 Helm values: |
| 295 | + |
| 296 | +```bash |
| 297 | +sealos run desktop-frontend:latest \ |
| 298 | + -e HELM_OPTIONS=" |
| 299 | + --set desktopConfig.cloudDomain=production.example.com |
| 300 | + --set desktopConfig.regionUID=prod-region-001 |
| 301 | + --set desktopConfig.version=cn |
| 302 | + --set desktopConfig.githubEnabled=true |
| 303 | + --set desktopConfig.githubClientId=prod-github-id |
| 304 | + --set desktopConfig.githubClientSecret=prod-github-secret |
| 305 | + --set desktopConfig.smsEnabled=true |
| 306 | + --set desktopConfig.smsAliEnabled=true |
| 307 | + --set desktopConfig.smsAliAccessKeyID=prod-sms-key-id |
| 308 | + --set desktopConfig.smsAliAccessKeySecret=prod-sms-key-secret |
| 309 | + --set desktopConfig.emailEnabled=true |
| 310 | + --set desktopConfig.emailHost=smtp.production.example.com |
| 311 | + --set desktopConfig.emailPort=587 |
| 312 | + --set desktopConfig.emailUser=noreply@production.example.com |
| 313 | + --set desktopConfig.emailPassword=prod-email-password |
| 314 | + --set desktopConfig.trackingEnabled=true |
| 315 | + --set desktopConfig.trackingWebsiteId=prod-website-id |
| 316 | + " |
| 317 | +``` |
| 318 | + |
| 319 | +**提示**: |
| 320 | +- 所有配置统一通过 `HELM_OPTIONS` 传递 |
| 321 | +- 对于超长配置,建议创建部署脚本 |
| 322 | + |
| 323 | +## 注意事项 |
| 324 | + |
| 325 | +1. **敏感信息**: 建议将敏感配置(如密钥、密码)通过环境变量传递,或存储在 Kubernetes Secret 中 |
| 326 | +2. **类型注意**: 布尔值使用 `true`/`false`,数字不需要引号,字符串建议使用引号 |
| 327 | +3. **嵌套配置**: 使用 `.` 分隔嵌套层级,如 `desktopConfig.githubClientId` |
| 328 | +4. **数组索引**: 对于数组配置,使用 `[]` 索引,如 `ingress.hosts[0].host` |
| 329 | +5. **字符串包含特殊字符**: 使用 `--set-string` 或反斜杠转义引号(如 `\"`) |
| 330 | +6. **引号转义**: 在 `HELM_OPTIONS` 中,字符串包含引号时需要转义(如 `--set desktopConfig.layoutTitle=\"My Cloud\"`) |
| 331 | +7. **配置管理**: 对于复杂部署,建议使用脚本或配置管理工具来管理参数 |
| 332 | + |
| 333 | +## 验证配置 |
| 334 | + |
| 335 | +部署后可以查看生成的 ConfigMap 验证配置: |
| 336 | + |
| 337 | +```bash |
| 338 | +kubectl get configmap sealos-desktop-config -n sealos -o yaml |
| 339 | +``` |
| 340 | + |
| 341 | +或在 Pod 中查看实际配置: |
| 342 | + |
| 343 | +```bash |
| 344 | +kubectl exec -n sealos deployment/sealos-desktop -- cat /app/data/config.yaml |
| 345 | +``` |
0 commit comments