Only use MAJOR.MINOR for postgresql subdirectory
Change postgresl software configuration to install to /opt/gitlab/embedded/postgresql/X.Y
instead of /opt/gitlab/embedded/postgresql/X.Y.Z
When we upgrade to 10, this will become /opt/gitlab/embedded/postgresl/X
This will prevent us from needing a restart when upgrading minor versions.
See the PostgreSQL versioning policy for more details.
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash" "/tmp/chef-script20180314-16935-1oqsk9k" ----
STDOUT: rake aborted!
ActiveRecord::StatementInvalid: PG::InvalidParameterValue: ERROR: invalid value for parameter "TimeZone": "UTC"
: SET time zone 'UTC'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/geo/database_tasks.rb:12:in `public_send'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/geo/database_tasks.rb:12:in `block in method_missing'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/geo/database_tasks.rb:169:in `with_geo_db'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/geo/database_tasks.rb:11:in `method_missing'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/tasks/geo.rake:27:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Caused by:
PG::InvalidParameterValue: ERROR: invalid value for parameter "TimeZone": "UTC"
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/geo/database_tasks.rb:12:in `public_send'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/geo/database_tasks.rb:12:in `block in method_missing'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/geo/database_tasks.rb:169:in `with_geo_db'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/gitlab/geo/database_tasks.rb:11:in `method_missing'
/opt/gitlab/embedded/service/gitlab-rails/ee/lib/tasks/geo.rake:27:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => geo:db:migrate
(See full trace by running task with --trace)
STDERR:
---- End output of "bash" "/tmp/chef-script20180314-16935-1oqsk9k" ----
Ran "bash" "/tmp/chef-script20180314-16935-1oqsk9k" returned 1
Resource Declaration:
---------------------
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/recipes/geo_database_migrations.rb
25: bash 'migrate gitlab-geo tracking database' do
26: code <<-EOH
27: set -e
28: log_file="#{node['gitlab']['gitlab-rails']['log_directory']}/gitlab-geo-db-migrate-$(date +%Y-%m-%d-%H-%M-%S).log"
29: umask 077
30: /opt/gitlab/bin/gitlab-rake geo:db:migrate 2>& 1 | tee ${log_file}
31: STATUS=${PIPESTATUS[0]}
32: echo $STATUS > #{gitlab_geo_helper.db_migrate_status_file}
33: exit $STATUS
34: EOH
35:
36: notifies :run, 'execute[start geo-postgresql]', :before if omnibus_helper.should_notify?('geo-postgresql')
37: dependent_services.each do |svc|
38: notifies :restart, svc, :immediately
39: end
40: not_if { gitlab_geo_helper.migrated? }
41: only_if { node['gitlab']['geo-secondary']['auto_migrate'] && node['gitlab']['geo-postgresql']['enable'] }
42: end
Compiled Resource:
------------------
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab-ee/recipes/geo_database_migrations.rb:25:in `from_file'
ActiveRecord::StatementInvalid: PG::InvalidParameterValue: ERROR: invalid value for parameter "TimeZone": "UTC"
: SET time zone 'UTC'
This doesn't seem to be related to omnibus, but here: https://gitlab.slack.com/archives/C32LCGC1H/p1509384126000057?thread_ts=1509384087.000529&cid=C32LCGC1H @stanhu sent a link about this same issue:
https://mikewilliamson.wordpress.com/2017/08/29/invalid-value-for-parameter-timezone/
Doing a gitlab-ctl restart fixed (as said already in that same discussion in slack).
Perhaps we need to document this.
I think I know what could have happened: I did an apt update && apt dist-upgrade
in that same machine before upgrading GitLab. Perhaps our database reads tzinfo and after it gets updated, it looses some refference it had previously pre-loaded. If we were using postgresql from the system package, that would probably trigger a restart.