Gitlab-ce docker on apple m1 stuck on Recipe: gitlab::database_migrations

I also tried gitlab on docker on M1 mac, and investigated a bit. (but still not solved…)
I think this is not DB problem, but ruby rake problem.

The message below was also be seen in successfully built gitlab instance on intel mac,

2021-05-26_12:23:24.67016 LOG:  no match in usermap "gitlab" for user "gitlab" authenticated as "root"
2021-05-26_12:23:24.67056 FATAL:  Peer authentication failed for user "gitlab"
2021-05-26_12:23:24.67057 DETAIL:  Connection matched pg_hba.conf line 71: "local   all         all                               peer map=gitlab"

and you can connect to DB with following command on M1 mac gitlab container.
(DB is working well and authentication is also OK.)

# su - git
$ /opt/gitlab/embedded/bin/psql  -h /var/opt/gitlab/postgresql/ -U gitlab gitlabhq_production

And after the instance hanged up at migrate gitlab-rails database action,
when I killed (with kill -s SIGKILL) the rake process (rake gitlab:db:configure),
then the configuring process next hangs at rake cache:clear action.
(cache:clear is an action for redis, not for db.)

As far as I tried, the hang of rake can be prevented (but causes another error, of course…)
by editing config/application.rb like following.
This stops eager loading of files under lib folder.

root@ea6e329023b0:/opt/gitlab/embedded/service/gitlab-rails# diff -ru config/application.rb{bak,}
--- config/application.rbbak	2021-12-10 17:28:58.040909012 +0000
+++ config/application.rb	2021-12-10 17:29:22.756588010 +0000
@@ -89,8 +89,7 @@
     # https://github.com/rails/rails/blob/v4.2.6/railties/lib/rails/engine.rb#L687
     # This is a nice reference article on autoloading/eager loading:
     # http://blog.arkency.com/2014/11/dont-forget-about-eager-load-when-extending-autoload
-    config.eager_load_paths.push(*%W[#{config.root}/lib
-                                     #{config.root}/app/models/badges
+    config.eager_load_paths.push(*%W[#{config.root}/app/models/badges
                                      #{config.root}/app/models/hooks
                                      #{config.root}/app/models/members
                                      #{config.root}/app/models/project_services

I think lib is loaded just before the rake task is run, at the :environment on following line.

I’m guessing, the library or it’s dependency includes some files built for x86_64,
and it causes the hang up, but I couldn’t find exact reason as I’m not ruby specialist.

Do you have any advises or suggestions?

2 Likes