• Kirill Smelkov's avatar
    gitlab: Organize per-instance gitlab work tree · 2ddc5b0c
    Kirill Smelkov authored
    Organize per-instance place for gitlab configuration and work directory.
    
    Unfortunately as GitLab is Ruby-on-Rails application, it is not possible
    to keep its code in one place and have multiple separate configuration
    sets in different places and start that code for a configuration set -
    GitLab and Rails insist to get configuration from relative to source
    code tree.
    
    GitLab omnibus "solves" this by having only one configuration set and
    having symlinks from code to that only configiration set. In slapos we
    can potentially have several instances for one software and thus we
    cannot do that.
    
    With such limitations a proper solution would be to bind-mount software
    code into instance filesystem namespace close to configuration - that
    way the code will be only one and will find proper per-instance config.
    Currently we do not have namespaces available on slapos unfortunately,
    thus something else is needed.
    
    The workaround I decided to do is this: to clone cloned gitlab
    repository from software/ space to instance/ space and adjust it in
    instance space. This has the following drawbacks:
    
        - code is duplicated
        - code becomes read-write, instead of being read-only
    
    but imho it is the most practical thing to do. Another solution could be
    to patch GitLab / Rails to remove "config lives in code" assumption, but
    the number of places where this needs to be done is really many.
    
    NOTE gems which gitlab uses and which were installed during software
        compilation are not duplicated - they are reused via bundler - via
        pointing BUNDLE_GEMFILE to original location in software.
    
    NOTE2 For instance tasks and also for maintanace convenience we establish
        <instance>/bin/gitlab-* programs, e.g. gitlab-rake, which e.g. for
        gitlab-rake will run rake with correctly loaded gitlab environment -
        like in gitlab-omnibus.
    
    /cc @kazuhiko, @jerome, @jp
    2ddc5b0c
instance-gitlab.cfg.in 11.2 KB