Non-standard database name causes db initialization to fail
If the default database gitlabhq_production
is changed to something else the first reconfigure run fails on initialize database portion. See trace below. In this case the user set the value to gitlab_production
as opposed to gitlabhq_production
.
================================================================================
Error executing action `run` on resource 'execute[initialize gitlab-rails database]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/bin/gitlab-rake db:schema:load db:seed_fu ----
STDOUT: -- enable_extension("plpgsql")
STDERR: rake aborted!
ActiveRecord::NoDatabaseError: FATAL: database "gitlab_production" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
PG::Error: FATAL: database "gitlab_production" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
Tasks: TOP => db:schema:load
(See full trace by running task with --trace)
---- End output of /opt/gitlab/bin/gitlab-rake db:schema:load db:seed_fu ----
Ran /opt/gitlab/bin/gitlab-rake db:schema:load db:seed_fu returned 1
Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/gitlab/recipes/database_migrations.rb
20: execute "initialize gitlab-rails database" do
21: command "/opt/gitlab/bin/gitlab-rake db:schema:load db:seed_fu"
22: environment ({'GITLAB_ROOT_PASSWORD' => initial_root_password }) if initial_root_password
23: action :nothing
24: end
25:
Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/gitlab/recipes/database_migrations.rb:20:in `from_file'
execute("initialize gitlab-rails database") do
action [:nothing]
retries 0
retry_delay 2
guard_interpreter :default
command "/opt/gitlab/bin/gitlab-rake db:schema:load db:seed_fu"
backup 5
returns 0
cookbook_name :gitlab
recipe_name "database_migrations"
end
[2015-03-13T16:05:22+00:00] INFO: Running queued delayed notifications before re-raising exception
[2015-03-13T16:05:22+00:00] INFO: template[/var/opt/gitlab/gitlab-rails/etc/gitlab.yml] sending run action to execute[clear the gitlab-rails cache] (delayed)
[2015-03-13T16:05:29+00:00] INFO: execute[clear the gitlab-rails cache] ran successfully
[2015-03-13T16:05:29+00:00] INFO: remote_file[/var/opt/gitlab/gitlab-rails/VERSION] sending run action to bash[migrate gitlab-rails database] (delayed)
================================================================================
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20150313-3151-1t5z24e" ----
STDOUT: rake aborted!
ActiveRecord::NoDatabaseError: FATAL: database "gitlab_production" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
PG::Error: FATAL: database "gitlab_production" does not exist
Run `$ bin/rake db:create db:migrate` to create your database
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
STDERR:
---- End output of "bash" "/tmp/chef-script20150313-3151-1t5z24e" ----
Ran "bash" "/tmp/chef-script20150313-3151-1t5z24e" returned 1
Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/gitlab/definitions/migrate_database.rb
19: bash "migrate #{params[:name]} database" do
20: code <<-EOH
21: set -e
22: log_file="/tmp/#{params[:name]}-db-migrate-$(date +%s)-$$/output.log"
23: umask 077
24: mkdir $(dirname ${log_file})
25: #{params[:command]} 2>& 1 | tee ${log_file}
26: exit ${PIPESTATUS[0]}
27: EOH
28: action params[:action]
29: end
30: end
Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/gitlab/definitions/migrate_database.rb:19:in `block in from_file'
bash("migrate gitlab-rails database") do
params {:command=>"/opt/gitlab/bin/gitlab-rake db:migrate", :action=>:nothing, :name=>"gitlab-rails"}
action [:nothing]
retries 0
retry_delay 2
guard_interpreter :default
command "\"bash\" \"/tmp/chef-script20150313-3151-1t5z24e\""
backup 5
returns 0
code " set -e\n log_file=\"/tmp/gitlab-rails-db-migrate-$(date +%s)-$$/output.log\"\n umask 077\n mkdir $(dirname ${log_file})\n /opt/gitlab/bin/gitlab-rake db:migrate 2>& 1 | tee ${log_file}\n exit ${PIPESTATUS[0]}\n"
interpreter "bash"
cookbook_name :gitlab
recipe_name "database_migrations"
end
[2015-03-13T16:05:36+00:00] INFO: template[/var/log/gitlab/redis/config] sending create action to ruby_block[reload redis svlogd configuration] (delayed)
[2015-03-13T16:05:36+00:00] INFO: ruby_block[reload redis svlogd configuration] called
[2015-03-13T16:05:36+00:00] INFO: template[/var/log/gitlab/postgresql/config] sending create action to ruby_block[reload postgresql svlogd configuration] (delayed)
[2015-03-13T16:05:36+00:00] INFO: ruby_block[reload postgresql svlogd configuration] called
[2015-03-13T16:05:36+00:00] ERROR: Running exception handlers
[2015-03-13T16:05:36+00:00] ERROR: Exception handlers complete
[2015-03-13T16:05:36+00:00] FATAL: Stacktrace dumped to /opt/gitlab/embedded/cookbooks/cache/chef-stacktrace.out
[2015-03-13T16:05:36+00:00] ERROR: Chef::Exceptions::MultipleFailures
[2015-03-13T16:05:36+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
STDERR: the ffi-yajl and yajl-ruby gems have incompatible C libyajl libs and should not be loaded in the same Ruby VM
falling back to ffi which might work (or might not, no promises)
---- End output of /usr/bin/gitlab-ctl reconfigure ----
Ran /usr/bin/gitlab-ctl reconfigure returned 1
Running handlers:
[2015-03-13T16:06:29+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-03-13T16:06:29+00:00] ERROR: Exception handlers complete
[2015-03-13T16:06:29+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
Chef Client failed. 5 resources updated in 281.66594861 seconds
[2015-03-13T16:06:30+00:00] ERROR: Found 1 errors, they are stored in the backtrace
[2015-03-13T16:06:30+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <default-centos-66>.
>>>>>> Please see .kitchen/logs/default-centos-66.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c '
sudo -E /opt/chef/bin/chef-client --local-mode --config /tmp/kitchen/client.rb --log_level auto --force-formatter --no-color --chef-zero-port 8889 --json-attributes /tmp/kitchen/dna.json
']
>>>>>> ----------------------