Skip to content

Enabling postgres exporter with postgres disabled results in failure due to missing user gitlab-psql

Expected behaviour: User gitlab-psql is created and used by postgres exporter.
Actual behaviour: Recipe fails due to missing user gitlab-psql.

Version: gitlab-ee 9.2.2-ee.0
Example:

postgresql['enable'] = false
postgres_exporter['enable'] = true

gitlab_rails['db_adater'] = "postgresql"
gitlab_rails['db_host'] = "pgsql-gitlab.domain.tld"
[...]
$ gitlab-ctl reconfigure
[...]
Recipe: gitlab::postgres-exporter
  * directory[/var/log/gitlab/postgres-exporter] action create
    * cannot determine user id for 'gitlab-psql', does the user exist on this system?
    ================================================================================
    Error executing action `create` on resource 'directory[/var/log/gitlab/postgres-exporter]'
    ================================================================================

    Chef::Exceptions::UserIDNotFound
    --------------------------------
    cannot determine user id for 'gitlab-psql', does the user exist on this system?

    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/postgres-exporter.rb

     23: directory postgres_exporter_log_dir do
     24:   owner postgresql_user
     25:   mode '0700'
     26:   recursive true
     27: end
     28:

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/postgres-exporter.rb:23:in `from_file'

    directory("/var/log/gitlab/postgres-exporter") do
      action [:create]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      path "/var/log/gitlab/postgres-exporter"
      recursive true
      declared_type :directory
      cookbook_name "gitlab"
      recipe_name "postgres-exporter"
      owner "gitlab-psql"
      mode "0700"
    end

    Platform:
    ---------
    x86_64-linux

Running handlers:
Running handlers complete
Chef Client failed. [...]
Edited by Nelo-Thara Wallus