Bug 280273

Summary: www/gitlab-ce service start error on 17.1+
Product: Ports & Packages Reporter: garrett <freebsd>
Component: Individual Port(s)Assignee: Matthias Fechner <mfechner>
Status: Closed FIXED    
Severity: Affects Some People CC: majo-bugs.freebsd.org
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description garrett 2024-07-14 11:53:18 UTC
Starting gitlab with "service start gitlab" for poudriere-built or pkg version of gitlab-ce beginning with version 17.1, results in error. It is due to read-only systems not being able to accommodate the creation of a new folder which represents what appears to be a relative path from the built process.

As discussed in https://forums.freebsd.org/threads/service-start-error-on-poudriere-built-gitlab.94051/#post-662465

There is a .bundle directory which is appearing in the new versions that is prompting this path. Earlier versions are reported to not have this directory. On systems that are not read-only, a new directory is created on the root path with bundles that appear to duplicate existing bundles in the project's bin directory.

Error:
Don't run Bundler as root. Installing your bundle as root will break this application for all non-root
users on this machine.
Bundler::GenericSystemCallError: There was an error accessing
`/wrkdirs/usr/ports/www/gitlab/work-ce/gitlab-foss-v17.1.1/.bin`.
The underlying system error is Errno::EROFS: Read-only file system @ dir_s_mkdir - /wrkdirs
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/shared_helpers.rb:119:in `rescue in
filesystem_access'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/shared_helpers.rb:104:in
`filesystem_access'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler.rb:511:in `mkdir_p'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler.rb:122:in `bin_path'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer.rb:116:in
`generate_bundler_executable_stubs'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer/gem_installer.rb:79:in
`generate_executable_stubs'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer/gem_installer.rb:18:in
`install_from_spec'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer/parallel_installer.rb:132:in
`do_install'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer/parallel_installer.rb:86:in
`call'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer/parallel_installer.rb:66:in
`call'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer.rb:244:in
`install_in_parallel'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer.rb:201:in `install'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer.rb:89:in `block in run'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/process_lock.rb:12:in `block in lock'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/process_lock.rb:9:in `open'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/process_lock.rb:9:in `lock'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer.rb:71:in `run'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/installer.rb:23:in `install'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/cli/install.rb:63:in `run'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/cli.rb:247:in `block in install'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/settings.rb:158:in `temporary'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/cli.rb:246:in `install'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/vendor/thor/lib/thor/command.rb:28:in
`run'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in
`invoke_command'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/vendor/thor/lib/thor.rb:527:in
`dispatch'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/cli.rb:35:in `dispatch'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/vendor/thor/lib/thor/base.rb:584:in
`start'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/cli.rb:29:in `start'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/exe/bundle:28:in `block in <top (required)>'
/s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/lib/bundler/friendly_errors.rb:117:in
`with_friendly_errors'
  /s/usr-local/lib/ruby/gems/3.2/gems/bundler-2.5.13/exe/bundle:20:in `<top (required)>'
  /usr/local/bin/bundle:25:in `load'
  /usr/local/bin/bundle:25:in `<main>'

An error occurred while installing rake (13.2.1), and Bundler cannot continue.

In Gemfile:
  cssbundling-rails was resolved to 1.4.0, which depends on
    railties was resolved to 7.0.8.4, which depends on
      rake
Could not create Gemfile.lock for gitlab, please report this using FreeBSD Bugtracker, https://bugs.freebsd.org/
Comment 1 Matthias Fechner freebsd_committer freebsd_triage 2024-07-15 06:49:35 UTC
Can you please test with 17.1.2?
Comment 2 garrett 2024-07-15 12:41:39 UTC
(In reply to Matthias Fechner from comment #1)
Yes, has been tested and behaves the same.

In order for the 17.1.1 install to proceed, I modified the /usr/local/www/gitlab/.bundle/config contents and removed the BUNDLE_BIN setting.

On installation of 17.1.2 the .bundle/config changes were overwritten, resulting in the BUNDLE_BIN path set again in the config file.

I then subsequently removed the .bundle directory to resolve the error. In the forum a user has reported this .bundle directory in the project root did not exist in 17.0.
Comment 3 Matthias Fechner freebsd_committer freebsd_triage 2024-07-18 06:37:47 UTC
Do you want to test the following patch:
https://gitlab.fechner.net/mfechner/Gitlab/-/commit/c80b3b3641c688297e7304c29a0662520fff8d15

I think it should fix the problem.
Comment 4 garrett 2024-07-18 14:43:48 UTC
(In reply to Matthias Fechner from comment #3)
Looks good - there were no build errors and update procedures were clean, no issues. I would say the matter is resolved with the patch.
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-07-19 05:14:46 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=42492dff41c468055aa39ca0644c530a99c009e1

commit 42492dff41c468055aa39ca0644c530a99c009e1
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2024-07-18 06:36:02 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2024-07-19 05:13:34 +0000

    www/gitlab: install local bundle binaries to .bin/ directory

    PR:             280273

 www/gitlab/Makefile                                           |  9 +++++----
 www/gitlab/files/gitlab.in                                    |  2 +-
 ...atch-vendor_gems_bundler-checksum_bundler-checksum.gemspec |  9 +++++----
 .../patch-vendor_gems_sidekiq-7.1.6_sidekiq.gemspec (gone)    | 11 -----------
 4 files changed, 11 insertions(+), 20 deletions(-)
Comment 6 Matthias Fechner freebsd_committer freebsd_triage 2024-07-19 05:16:08 UTC
Thanks a lot for your report your testing and for the forum post, that was very helpful to understand the problem and helped to provide a solution for this problem.

Have fun with the fix.
Comment 7 garrett 2024-07-19 11:05:50 UTC
(In reply to Matthias Fechner from comment #6)
Thank you Matthias for all of your work on this port.
Comment 8 Marián Černý 2024-07-20 06:38:34 UTC
I had the same problem with gitlab-ce-17.1.1 from quarterly branch (I am using jails with readonly / and /usr).

Wouldn't be it wise to merge this fix together with update to 17.1.2 to the 2024Q3 quarterly branch?

Also because of the following warning in admin area:
> You are currently on version 17.1.1! We strongly recommend upgrading your GitLab installation to one of the following versions immediately: 17.2.0, 17.1.2.
Comment 9 commit-hook freebsd_committer freebsd_triage 2024-07-21 06:57:49 UTC
A commit in branch 2024Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8920178a1b5227aecadd1b6b54abc86930247128

commit 8920178a1b5227aecadd1b6b54abc86930247128
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2024-07-18 06:36:02 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2024-07-21 05:42:40 +0000

    www/gitlab: install local bundle binaries to .bin/ directory

    PR:             280273
    (cherry picked from commit 42492dff41c468055aa39ca0644c530a99c009e1)

 www/gitlab/Makefile                                           |  8 +++++---
 www/gitlab/files/gitlab.in                                    |  2 +-
 ...atch-vendor_gems_bundler-checksum_bundler-checksum.gemspec |  9 +++++----
 .../patch-vendor_gems_sidekiq-7.1.6_sidekiq.gemspec (gone)    | 11 -----------
 4 files changed, 11 insertions(+), 19 deletions(-)