Skip to content
GitLab
项目 群组 主题 代码片段
  • /
  • 帮助
    • 帮助
    • 支持
    • 社区论坛
    • 提交反馈
  • 登录
  • L large
  • 项目信息
    • 项目信息
    • 动态
    • 标记
    • 成员
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者统计
    • 分支图
    • 比较修订版本
  • 议题 21
    • 议题 21
    • 列表
    • 看板
    • 服务台
    • 里程碑
  • 合并请求 12
    • 合并请求 12
  • CI/CD
    • CI/CD
    • 流水线
    • 作业
    • 产物
    • 计划
  • 部署
    • 部署
    • 环境
    • 发布
  • 软件包与镜像库
    • 软件包与镜像库
    • 软件包库
    • 容器镜像库
    • Terraform 模块
    • 模型实验
  • 监控
    • 监控
    • 事件
  • 分析
    • 分析
    • 价值流
    • CI/CD
    • 仓库
  • Wiki
    • Wiki
  • 代码片段
    • 代码片段
  • 动态
  • 分支图
  • 创建新议题
  • 作业
  • 提交
  • 议题看板
收起侧边栏
  • 王权利
  • large
  • 议题
  • #8013

Make GitLab and GitLab Shell configurable via Environment Variables by default

Created by: amtrack

Most apps today use environment variables for configuration. Background: http://12factor.net/config

Making GitLab and GitLab Shell configurable via environment variables would be a benefit for several use cases:

  • Developing GitLab and GitLab Shell (see bkeepers/dotenv)
  • Building debian packages (see crohr/pkgr)
  • Building docker images (see sameersbn/docker-gitlab)
  • PaaS Deployment (see amtrack/buildpack-gitlab)

@crohr, @sameersbn: Currently we're all using sed or patch for patching the config files, right? :-)

  • https://github.com/gitlabhq/gitlabhq/blob/master/bin/pkgr_before_precompile.sh#L10-L14
  • https://github.com/sameersbn/docker-gitlab/blob/master/assets/init#L340-L342
  • https://github.com/amtrack/buildpack-gitlab/blob/master/bin/compile#L66-L67

Let's unite our forces here on GitLab upstream to benefit all!

For backwards compatibility i suggest still supporting config files, but values from environment variables should override values from config files.

For the first, i think the following environment variable would be a good start:

  • DATABASE_URL (already implemented in rails > 4.1.0)
  • REDIS_URL (right now only if config/resque.yml doesn't exist?)
  • GITLAB_URL (should be shared with GitLab Shell)
  • GIT_USER (should be shared with GitLab Shell)
  • REPOS_PATH (should be shared with GitLab Shell)
  • SMTP_URL
  • What else?

A simple solution would be to read all config files through ERB, but

  • you would still have to copy the example config files to the right location.
  • it might be confusing for people who don't use environment variables

A better solution imho would be to implement it in the code directly (maybe here: https://github.com/gitlabhq/gitlabhq/blob/master/config/initializers/1_settings.rb and https://github.com/gitlabhq/gitlab-shell/blob/master/lib/gitlab_config.rb) This would make the overriding of the configuration more streamlined.

Which approach would you prefer? What else has to be done?

指派人
分配到
工时统计