Installation on CentOS 7 fails due to encoding mismatch

Summary

Installation on CentOS 7 fails due to encoding mismatch.

Steps to reproduce

Install gitlab gitlab-ce-10.7.3-ce.0.el7.x86_64.rpm Run gitlab-ctl reconfigure

What is the current bug behavior?

The install fails and gitlab isn't running.

What is the expected correct behavior?

The install succeeds and gitlab runs.

Relevant logs

sudo localectl status System Locale: LANG=en_CA.UTF-8 VC Keymap: us X11 Layout: us

Relevant logs
 * execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] action run
    [execute] The files belonging to this database system will be owned by user "gitlab-psql".
              This user must also own the server process.
          The database cluster will be initialized with locale "en_CA.iso88591".
          initdb: encoding mismatch
          The encoding you selected (UTF8) and the encoding that the
          selected locale uses (LATIN1) do not match.  This would lead to
          misbehavior in various character string processing functions.
          Rerun initdb and either do not specify an encoding explicitly,
          or choose a matching combination.

================================================================================
Error executing action `run` on resource 'execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
This user must also own the server process.

The database cluster will be initialized with locale "en_CA.iso88591".
STDERR: initdb: encoding mismatch
The encoding you selected (UTF8) and the encoding that the
selected locale uses (LATIN1) do not match.  This would lead to
misbehavior in various character string processing functions.
Rerun initdb and either do not specify an encoding explicitly,
or choose a matching combination.
---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1

Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb

 80: execute "/opt/gitlab/embedded/bin/initdb -D #{postgresql_data_dir} -E UTF8" do
 81:   user postgresql_username
 82:   not_if { pg_helper.bootstrapped? }
 83: end
 84: 

Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/postgresql/recipes/enable.rb:80:in `from_file'

execute("/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8") do
  action [:run]
  default_guard_interpreter :execute
  command "/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8"
  backup 5
  returns 0
  user "gitlab-psql"
  declared_type :execute
  cookbook_name "postgresql"
  recipe_name "enable"
  domain nil
  not_if { #code block }
end

System Info:
------------
chef_version=13.6.4
platform=centos
platform_version=7.2.1511
ruby=ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-linux]
program_name=/opt/gitlab/embedded/bin/chef-client
executable=/opt/gitlab/embedded/bin/chef-client

Details of package version

Provide the package version installation details

sudo rpm -qa | grep 'gitlab' gitlab-ce-10.7.3-ce.0.el7.x86_64

Environment details

  • Operating System: Cent OS 7
  • Installation Target, remove incorrect values:
    • Bare Metal Machine
  • Installation Type, remove incorrect values:
    • New Installation
  • Is there any other software running on the machine: Postgres, MySQL
  • Is this a single or multiple node installation?
  • Resources
    • CPU: Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz
    • Memory total: 16GB

Configuration details

Provide the relevant sections of `/etc/gitlab/gitlab.rb`
external_url 'http://10.60.78.56'
Edited by Brodey Dover