使用外部极狐GitLab Pages 配置极狐GitLab chart
本文档旨在提供有关如何使用极狐GitLab Pages 实例配置此 Helm chart 的文档,该实例使用 Linux 软件包在集群外部配置。
要求
- 应使用 外部对象存储,如生产实例所推荐。
- 为了使 Pages 能够与极狐GitLab Pages 交互,需要一个 32 字节长的 API 密钥的 Base64 编码形式。
已知限制
- 不支持开箱即用的 极狐GitLab Pages 访问控制。
配置外部极狐GitLab Pages 实例
-
使用 Linux 软件包 安装极狐GitLab。
-
编辑 /etc/gitlab/gitlab.rb 文件,并将其内容替换为以下代码片段。更新以下值以匹配您的配置:
ruby1roles ['pages_role'] 2 3# Root domain where Pages will be served. 4pages_external_url '<Pages root domain>' # Example: 'http://pages.example.io' 5 6# Information regarding GitLab instance 7gitlab_pages['gitlab_server'] = '<GitLab URL>' # Example: 'https://gitlab.example.com' 8gitlab_pages['api_secret_key'] = '<Base64 encoded form of API secret key>' -
通过运行 sudo gitlab-ctl reconfigure 应用更改。
配置 chart
-
在对象存储中创建一个名为 gitlab-pages 的桶,用于存储 Pages 部署。
-
创建一个密钥 gitlab-pages-api-key,其值为 API 密钥的 Base64 编码形式。
shellkubectl create secret generic gitlab-pages-api-key --from-literal="shared_secret=<Base 64 encoded API Secret Key>" -
参考以下配置片段,并在您的 values 文件中添加必要的条目。
yaml1global: 2 pages: 3 path: '/srv/gitlab/shared/pages' 4 host: <Pages root domain> 5 port: '80' # Set to 443 if Pages is served over HTTPS 6 https: false # Set to true if Pages is served over HTTPS 7 artifactsServer: true 8 objectStore: 9 enabled: true 10 bucket: 'gitlab-pages' 11 apiSecret: 12 secret: gitlab-pages-api-key 13 key: shared_secret 14 extraEnv: 15 PAGES_UPDATE_LEGACY_STORAGE: true # Bypass automatic disabling of disk storage通过将 `PAGES_UPDATE_LEGACY_STORAGE` 环境变量设置为 true,启用功能标志 `pages_update_legacy_storage`,将 Pages 部署到本地磁盘。当您迁移到对象存储时,请记得删除此变量。