Update from 12.9.2 to 15.X

Hello,

I have a problem with updating from 12.9.2 to 15.X.

I follow the steps from Upgrading GitLab | GitLab but the result always is error on version 13.12.15, no meter how I do it.

Here are all the console commands that I have to make before each new update and the error at the end of 13.12.15.:

#update current to this version

apt install gitlab-ce=12.10.14-ce.0

gitlab-ctl restart

gitlab-ctl restart unicorn

#if you get timeout: run: unicorn: (pid 6860) 736s

kill -9 6860 #pid from parent result row

gitlab-ctl restart unicorn

#wait and test

#update to this version

apt install gitlab-ce=13.0.14-ce.0

gitlab-ctl restart unicorn

#if you get timeout: run: unicorn: (pid 6860) 736s

kill -9 6860 #pid from parent result row

gitlab-ctl restart unicorn

#wait and test

#update to this version

apt install gitlab-ce=13.1.11-ce.0

gitlab-ctl restart

#wait and test

#update to this version

apt install gitlab-ce=13.8.8-ce.0

gitlab-ctl restart

#wait and test

#update to this version

apt install gitlab-ce=13.9.2-ce.0

gitlab-ctl restart

#wait and test

#update to this version

apt install gitlab-ce=13.10.2-ce.0

gitlab-ctl restart postgresql

gitlab-ctl reconfigure

gitlab-rails dbconsole

ALTER TABLE terraform_states ADD CONSTRAINT fk_rails_558901b030 FOREIGN KEY (locked_by_user_id) REFERENCES users (id) ON DELETE CASCADE;

gitlab-ctl restart

#wait and test

#update to this version

apt install gitlab-ce=13.12.15-ce.0

gitlab-ctl reconfigure

There was an error running gitlab-ctl reconfigure:

rails_migration[gitlab-rails] (gitlab::database_migrations line 54) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’

---- Begin output of “bash” “/tmp/chef-script20220725-24312-7beuat” ----

STDOUT: rake aborted!

StandardError: An error has occurred, this and all later migrations canceled:

PG::InvalidColumnReference: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification

/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:1274:in `create_or_update_plan_limit’

/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20210423164702_insert_runner_registration_plan_limits.rb:7:in `up’

/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database.rb:371:in `block in transaction’

/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database.rb:370:in `transaction’

/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:61:in `block (3 levels) in <top (required)>’

/opt/gitlab/embedded/bin/bundle:23:in `load’

/opt/gitlab/embedded/bin/bundle:23:in `’

Tasks: TOP => db:migrate

(See full trace by running task with --trace)

== 20210423164702 InsertRunnerRegistrationPlanLimits: migrating ===============

– quote_column_name(“ci_registered_group_runners”)

→ 0.0000s

– quote(“free”)

→ 0.0000s

– quote(50)

→ 0.0000s

– execute(“INSERT INTO plan_limits (plan_id, "ci_registered_group_runners")\nSELECT id, ‘50’ FROM plans WHERE name = ‘free’ LIMIT 1\nON CONFLICT (plan_id) DO UPDATE SET "ci_registered_group_runners" = EXCLUDED."ci_registered_group_runners";\n”)

STDERR:

---- End output of “bash” “/tmp/chef-script20220725-24312-7beuat” ----

Ran “bash” “/tmp/chef-script20220725-24312-7beuat” returned 1

Running handlers complete

Chef Infra Client failed. 0 resources updated in 27 seconds

Please, can you help me – where I go wrong so I can`t update to version 15?

Thanks a lot!

Hi,

See this post: Upgrading from 13.12 to 14.0

Unicorn has been deprecated since 13.10 so this is why you have issues. Remove every reference to unicorn that has been configured manually in your /etc/gitlab/gitlab.rb and run:

gitlab-ctl reconfigure

if no entries for unicorn exist, then on your current version it will use unicorn. Then when you upgrade, since there are no references to unicorn it will automatically switch over and start using puma which replaced unicorn.

The second post on that link is by me, which explained what to do with the config files. Read through the thread and you should get past your problem.

1 Like

Hi,

Unicorn service is stopped and is not working since 13.10 version. I`ve updated up to 13.11.7 which is the last before 13.12.0. While updating from 13.11.7 up to 13.12.0 the same error occurred as the last time when I tried to update to 13.12.15 - ce.0. The Unicorn is not mentioned anywhere, I think most probably the problem is with the migration of the data base.

Compiled Resource:

  •  ------------------*
    
  •  # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb:16:in `block in class_from_file'*
    
  •  bash("migrate gitlab-rails database") do*
    
  •    action [:run]*
    
  •    default_guard_interpreter :default*
    
  •    command nil*
    
  •    backup 5*
    
  •    interpreter "bash"*
    
  •    declared_type :bash*
    
  •    cookbook_name "gitlab"*
    
  •    code "    set -e\n    log_file=\"/var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-$(date +%Y-%m-%d-%H-%M-%S).log\"\n    umask 077\n    /opt/gitlab/bin/gitlab-rake gitlab:db:configure 2>& 1 | tee ${log_file}\n    STATUS=${PIPESTATUS[0]}\n    chown git:git ${log_file}\n    echo $STATUS > /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-e1c4542b0f1\n    exit $STATUS\n"*
    
  •    domain nil*
    
  •    user nil*
    
  •    not_if { #code block }*
    
  •  end*
    
  •  System Info:*
    
  •  ------------*
    
  •  chef_version=15.14.0*
    
  •  platform=ubuntu*
    
  •  platform_version=18.04*
    
  •  ruby=ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]*
    
  •  program_name=/opt/gitlab/embedded/bin/chef-client*
    
  •  executable=/opt/gitlab/embedded/bin/chef-client*
    
  • ================================================================================*

  • Error executing action run on resource ‘rails_migration[gitlab-rails]’*

Caused by:
PG::InvalidColumnReference: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:1274:in create_or_update_plan_limit'* */opt/gitlab/embedded/service/gitlab-rails/db/migrate/20210423164702_insert_runner_registration_plan_limits.rb:7:in up’
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database.rb:371:in block in transaction'* */opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database.rb:370:in transaction’
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:61:in block (3 levels) in <top (required)>'* */opt/gitlab/embedded/bin/bundle:23:in load’
/opt/gitlab/embedded/bin/bundle:23:in `’
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== 20210423164702 InsertRunnerRegistrationPlanLimits: migrating ===============
– quote_column_name(“ci_registered_group_runners”)

  • → 0.0000s*
    – quote(“free”)
  • → 0.0000s*
    – quote(50)
  • → 0.0000s*
    – execute(“INSERT INTO plan_limits (plan_id, "ci_registered_group_runners")\nSELECT id, ‘50’ FROM plans WHERE name = ‘free’ LIMIT 1\nON CONFLICT (plan_id) DO UPDATE SET "ci_registered_group_runners" = EXCLUDED."ci_registered_group_runners";\n”)
    STDERR:
    ---- End output of “bash” “/tmp/chef-script20220726-19011-gcegcf” ----
    Ran “bash” “/tmp/chef-script20220726-19011-gcegcf” returned 1

Any suggestions ?

Hi,

And fix is:

gitlab-rails dbconsole
CREATE UNIQUE INDEX plan_id_idx on plan_limits (plan_id);
*gitlab-ctl reconfigure *
girlab-ctl restart

Missing unique index broke update to 13.12.X

Regards,
Jeff

1 Like