Unable to set up GitLab from docker container


I’m currently trying to set up a GitLab HA installation, but I’m facing lots errors.

The setup is supposed to consist of multiple VMs, with separate ones for postgres, redis, rails, praefect and gitaly.

Starting with rails, the first error I get is a NameError: uninitialized constant Gitlab::Redis::ALL_CLASSES. This can be circumvented by loading the redis initializer before the prometheus one (command: mv /opt/gitlab/embedded/service/gitlab-rails/config/initializers/{7,5}_redis.rb). I still expect this to be a configuration error, which is getting worked around here. Maybe someone knows.

With this error out of my way, for now, I want, of cause, to create a repository. GitLab doesn’t like to play this game though. Confronting me with a

ActionView::Template::Error (undefined method `first' for nil:NilClass):
    70:     %meta{ property: 'og:site_name', content: site_name }
    71:     %meta{ property: 'og:title', content: page_title }
    72:     %meta{ property: 'og:description', content: page_description }
    73:     %meta{ property: 'og:image', content: page_image }
    74:     %meta{ property: 'og:image:width', content: '64' }
    75:     %meta{ property: 'og:image:height', content: '64' }
    76:     %meta{ property: 'og:url', content: request.base_url + request.fullpath }

app/models/application_setting_implementation.rb:487:in `pick_repository_storage'
lib/gitlab/current_settings.rb:32:in `method_missing'
app/models/repository.rb:1215:in `pick_storage_shard'
app/models/project.rb:114:in `block in <class:Project>'
lib/gitlab/gl_repository.rb:12:in `block in <class:GlRepository>'
lib/gitlab/gl_repository/repo_type.rb:71:in `repository_for'
app/models/project.rb:1284:in `repository'
app/models/project.rb:1792:in `avatar_in_git'
app/models/project.rb:1796:in `avatar_url'
app/models/concerns/avatarable.rb:36:in `avatar_url'
app/helpers/page_layout_helper.rb:62:in `page_image'
[Some more lines]

This already breaks all the sense behind GitLab. But that is not enough, also administrating GitLab becomes a big problem when the general settings (/admin/application_settings/general) greet you with a 500 and the console spits the following at you.

ActionView::Template::Error (First argument in form cannot contain nil or be empty):
    1: = gitlab_ui_form_for @application_setting, url: general_admin_application_settings_path(anchor: 'js-visibility-settings'), html: { class: 'fieldset-form', id: 'visibility-settings' } do |f|
    2:   = form_errors(@application_setting)
    4:   %fieldset

app/helpers/application_helper.rb:463:in `gitlab_ui_form_for'
app/controllers/application_controller.rb:161:in `render'
app/controllers/application_controller.rb:520:in `set_current_admin'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:511:in `set_session_storage'
[Some more lines again]

I’m not sure what exactly I did wrong with my whole setup. But the only problem seems to come from gitlab-rails. All the other services seem to come up absolutely fine.

For reference I created an example. It is a minimal setup in docker, omitting the gitaly and praefect nodes in exchange for a local git_data_dirs location. The mentioned problems still apply to this setup though.

Hey there,

Not sure if this what you’re trying is possible. GitLab image comes as “all in one” package - with its own Postgres, Docker Registry and everything else packed inside. Not sure if it would even work with swarm.

If you want a HA (multi-node) solution, I believe you will have to go with K8s Helm Chart they provided.

Here’s the overview of installation methods.


thanks for your help.

I’m not trying to set up GitLab on a swarm. Kubernetes is also not an option. I just used docker here for prototyping because it’s much easier to show to other people. Throwing our whole puppet and VM infrastructure would already take up a couple topics I guess.

I’m setting everything up followintg the reference architecture documentation with the Linux omnibus package on VMs.
I think, that the docker setup however is a viable example to show my problems off, as the image internally uses the omnibus to set everything up. It also has the exact same problems as the VM setup.

Ah okay. In that case, I have no idea. We need better experts here :sweat_smile:

If you want a minimal working instance, I would suggest you this official config with docker compose - I run it as well in my company with docker compose, never had issues. Super easy to setup, maintain and update. However, we are quite small team (~ 40 users).

P.S. Maybe sharing your gitlab.rb would be useful. Sometimes there is a weird string or sth in the config which GitLab doesn’t like.

After a lot of building and destroying the docker containers I finally found my “fix”. It’s super unintuitive and makes me question the GitLab configuration. It also should definitely be mentioned in the documentation.

The solution is, to not change the name of the git_data_dirs storage. If it is not called “default”, the initialization fails and these symptoms occur.

1 Like