Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #8013

Closed
Open
Created Oct 11, 2014 by Administrator@rootOwner

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?

Assignee
Assign to
Time tracking