Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Ruby to 3.2.3 #2893

Merged
merged 3 commits into from
Feb 12, 2024
Merged

Update Ruby to 3.2.3 #2893

merged 3 commits into from
Feb 12, 2024

Conversation

kkimurak
Copy link
Contributor

@kkimurak kkimurak commented Jan 26, 2024

The version of ruby that used in development have been bumped to 3.2.2 (gitlab.com/gitlab-org/gitlab!140815) on GitLab v16.8.0 release, then bumped to 3.2.3 (gitlab.com/gitlab-org/gitlab!142295) on master (may not be included in any release, but will be in v16.8.2 I think).
There's no particular reason to choose 3.2.3 - it's the latest release, and the latest gitlab used it. If someone doesn't want to skip 3.2.2 or 3.2.1, I'll accept that suggestion.

(2024-02-08 edit)
Now this PR is based on #2895.

This PR contains following changes:

  • Update Ruby to v3.2.3

@kkimurak
Copy link
Contributor Author

kkimurak commented Jan 26, 2024

Note that there was a request for a backport to version 16.7.x (#2872, #2886). I have made sure that it works on latest versions of both stable branch - 16.7.4 and 16.8.1 (cross tested with / without relative url in use on each version), but still not sure it solves these issues as the root cause is old kernel version (according to #2872 (comment) they uses Synology NAS based on linux kernel 3.10.108).

Anyway, I can say these changes did not break current (my) installation.

GitLab 16.7.4 + Ruby 3.2.3 successfully launch, at least admin page shown

GitLab 16.8.1 + Ruby 3.2.3 successfully launch, at least admin page shown

@mihelm
Copy link

mihelm commented Jan 26, 2024

I'll have a crack a testing it on my Synology. I've already migrated my GitLab server to a barebones PC, so there's no danger to my data.

@CDann3r
Copy link

CDann3r commented Jan 26, 2024

Great work!
Because of the same reason, I created this Issue #2886 some days ago.
I did the same to just upgrade but run into the Dir:exists Issue because I have never worked with Ruby in the past.
I will also test it over the weekend on my Synology.

@mihelm
Copy link

mihelm commented Jan 26, 2024

Unfortunately, my test wasn't successful. The container got a lot farther than with Ruby 3.1, but in the end, it still failed.

The container got through initialisation and database migrations, but then crashed in a different place, again with a failed to get urandom error:

gitlab             | Migrating database...
gitlab             | 2024-01-26 19:49:53,823 INFO Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing
gitlab             | 2024-01-26 19:49:53,823 INFO Included extra file "/etc/supervisor/conf.d/gitaly.conf" during parsing
gitlab             | 2024-01-26 19:49:53,823 INFO Included extra file "/etc/supervisor/conf.d/gitlab-workhorse.conf" during parsing
gitlab             | 2024-01-26 19:49:53,823 INFO Included extra file "/etc/supervisor/conf.d/groups.conf" during parsing
gitlab             | 2024-01-26 19:49:53,823 INFO Included extra file "/etc/supervisor/conf.d/mail_room.conf" during parsing
gitlab             | 2024-01-26 19:49:53,823 INFO Included extra file "/etc/supervisor/conf.d/nginx.conf" during parsing
gitlab             | 2024-01-26 19:49:53,823 INFO Included extra file "/etc/supervisor/conf.d/puma.conf" during parsing
gitlab             | 2024-01-26 19:49:53,824 INFO Included extra file "/etc/supervisor/conf.d/sidekiq.conf" during parsing
gitlab             | 2024-01-26 19:49:53,824 INFO Included extra file "/etc/supervisor/conf.d/sshd.conf" during parsing
gitlab             | 2024-01-26 19:49:53,824 INFO Set uid to user 0 succeeded
gitlab             | 2024-01-26 19:49:53,832 INFO RPC interface 'supervisor' initialized
gitlab             | 2024-01-26 19:49:53,833 INFO supervisord started with pid 779
gitlab             | 2024-01-26 19:49:54,836 INFO spawned: 'gitaly' with pid 792
gitlab             | 2024-01-26 19:49:54,840 INFO spawned: 'puma' with pid 793
gitlab             | 2024-01-26 19:49:54,843 INFO spawned: 'gitlab-workhorse' with pid 794
gitlab             | 2024-01-26 19:49:54,846 INFO spawned: 'sidekiq' with pid 795
gitlab             | 2024-01-26 19:49:54,849 INFO spawned: 'sshd' with pid 796
gitlab             | 2024-01-26 19:49:54,852 INFO spawned: 'nginx' with pid 797
gitlab             | 2024-01-26 19:49:54,868 INFO spawned: 'cron' with pid 804
gitlab             | 2024-01-26 19:49:55,845 INFO success: gitaly entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab             | 2024-01-26 19:49:55,846 INFO success: puma entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab             | 2024-01-26 19:49:55,847 INFO success: gitlab-workhorse entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab             | 2024-01-26 19:49:55,847 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab             | 2024-01-26 19:49:55,848 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab             | 2024-01-26 19:49:55,859 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab             | 2024-01-26 19:49:55,859 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
gitlab             | rake aborted!
gitlab             | Bundler::GemRequireError: There was an error while trying to load the gem 'invisible_captcha'.
gitlab             | Gem Load Error is: failed to get urandom
gitlab             | Backtrace for gem load error is:
gitlab             | /usr/local/lib/ruby/3.2.0/securerandom.rb:55:in `urandom'
gitlab             | /usr/local/lib/ruby/3.2.0/securerandom.rb:55:in `gen_random_openssl'
gitlab             | /usr/local/lib/ruby/3.2.0/random/formatter.rb:74:in `random_bytes'
gitlab             | /usr/local/lib/ruby/3.2.0/random/formatter.rb:94:in `hex'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/invisible_captcha-2.1.0/lib/invisible_captcha.rb:46:in `init!'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/invisible_captcha-2.1.0/lib/invisible_captcha.rb:93:in `<top (required)>'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/runtime.rb:60:in `require'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/runtime.rb:55:in `each'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/runtime.rb:55:in `block in require'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/runtime.rb:44:in `each'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/runtime.rb:44:in `require'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler.rb:187:in `require'
gitlab             | /home/git/gitlab/config/application.rb:17:in `<top (required)>'
gitlab             | <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
gitlab             | <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
gitlab             | /home/git/gitlab/Rakefile:9:in `<top (required)>'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_module.rb:29:in `load_rakefile'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:710:in `raw_load_rakefile'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:104:in `block in load_rakefile'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:103:in `load_rakefile'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:82:in `block in run'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/bin/rake:25:in `load'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/bin/rake:25:in `<top (required)>'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in `load'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:58:in `kernel_load'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli/exec.rb:23:in `run'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli.rb:492:in `exec'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli.rb:34:in `dispatch'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/cli.rb:28:in `start'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/exe/bundle:37:in `block in <top (required)>'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
gitlab             | /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.22/exe/bundle:29:in `<top (required)>'
gitlab             | /usr/local/bin/bundle:25:in `load'
gitlab             | /usr/local/bin/bundle:25:in `<main>'
gitlab             | Bundler Error Backtrace:
gitlab             | /home/git/gitlab/config/application.rb:17:in `<top (required)>'
gitlab             | <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
gitlab             | <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
gitlab             | /home/git/gitlab/Rakefile:9:in `<top (required)>'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
gitlab             | /usr/local/bin/bundle:25:in `load'
gitlab             | /usr/local/bin/bundle:25:in `<main>'
gitlab             | 
gitlab             | Caused by:
gitlab             | failed to get urandom
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/invisible_captcha-2.1.0/lib/invisible_captcha.rb:46:in `init!'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/invisible_captcha-2.1.0/lib/invisible_captcha.rb:93:in `<top (required)>'
gitlab             | /home/git/gitlab/config/application.rb:17:in `<top (required)>'
gitlab             | <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
gitlab             | <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
gitlab             | /home/git/gitlab/Rakefile:9:in `<top (required)>'
gitlab             | /home/git/gitlab/vendor/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
gitlab             | /usr/local/bin/bundle:25:in `load'
gitlab             | /usr/local/bin/bundle:25:in `<main>'
gitlab             | (See full trace by running task with --trace)
gitlab exited with code 1

Thanks @kkimurak for giving this a try!

@mihelm
Copy link

mihelm commented Jan 26, 2024

@CDann3r If you test this on your Syno, beware that the container got through database migrations in my test. Now, I don't know if there actually were any migrations in 16.7 — but if there are, you may not be able to start 16.6 again.

`Dir.exists?(file_name) -> bool` have been deprecated since Ruby 2.1
and removed on Ruby 3.2.
See https://bugs.ruby-lang.org/issues/17391

Replacement is `Dir.exist?(file_name) -> bool`.
to suppress warning on build like below:

    Applying patch /etc/docker-gitlab/build/patches/0004-fix-raketask-gitlab-assets-compile.patch for gitlab-foss...
    <stdin>:15: trailing whitespace.
           removal_targets += Dir.children(Tasks::Gitlab::Assets::PUBLIC_ASSETS_DIR).map {|child| File.join(Tasks::Gitlab::Assets::PUBLIC_ASSETS_DIR, child)}
    warning: 1 line adds whitespace errors.
@kkimurak
Copy link
Contributor Author

Changed the commit order because the commit that updates Ruby to 3.2.3 depends on the commit that fixes the patch in assets:compile. Since the two commits that fix the patch are also applicable to the currently used Ruby (3.1.4), I think it would be better to create a separate pull request.

@mihelm
Copy link

mihelm commented Feb 7, 2024

@kkimurak Since I demonstrated in #2872 that these changes plus your backport of 64e503e in ruby3.2.x-backport16.7.x-plus fixes the Synology issue, could you submit PRs of that branch and its 16.8-twin?

GitLab came out with security patches today, and since releases are going to roll out soonish anyway, it might be an opportunity to kill two birds with one stone...

@kkimurak
Copy link
Contributor Author

kkimurak commented Feb 8, 2024

Submitted PR #2895 and #2897. Also submit backport PRs #2896, #2898 and #2899 .
It's a little complicated because it includes backports. If you have any questions, please ping me and I will explain as much as possible.

@asoluter
Copy link

Does this change also mean that the base Docker image can be upgraded from focal to jammy LTS?

@kkimurak
Copy link
Contributor Author

@asoluter Not sure. It is said that GitLab requires OpenSSL version 1.1 and jammy provides only OpenSSL 3.0 (currently 3.0.2-0ubuntu1.14). Some article describes that this can be solved by adding focal-security to apt source (I have never tested yet).
Are there any reason we must upgrade to jammy?

@sachilles
Copy link
Collaborator

Hi,

thanks for the PR.

Regarding the question of upgrading from focal to a current release of the baseimage, we have to think about upgrading in the near feature since this release will be eol in april 2025 (see https://wiki.ubuntu.com/Releases).

@sachilles sachilles merged commit 3926da3 into sameersbn:master Feb 12, 2024
3 checks passed
@kkimurak kkimurak deleted the ruby3.2.x branch February 12, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants