145 Commits

Author SHA1 Message Date
Steven Achilles
c0f13725ff Update download URL for golang source code 2025-10-17 19:58:49 +02:00
Kazunori Kimura
7cd573737f Remove bundle install for gitlab-shell 2025-07-11 00:53:21 +09:00
Steven Achilles
e93b77ff47
Merge pull request #3123 from kkimurak/remove-HSTS-patch
Remove patch to remove HSTS setting from app/controller/application_controller.rb
2025-06-19 19:53:38 +02:00
Kazunori Kimura
e910e3024c Stop recompiling assets to enable relative url
As a result, an Internet connection is no longer required
to use relative URLs.

To enable relative url, we execute `gitlab:assets:compile`.
This have been removed in official documentation in v10.0.0
(first committed to gitlab-foss, then ported to gitlab(-ee))
- EE: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/1139/
- CE: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8831

An internet connection was required when enabling relative urls
to install the node modules required for compilation.
I reviewed the rake task `gitlab:assets:compile` and investigated
whether it was necessary to compile all assets
just because the relative url changed,
and found that this rake task is internally a separate rake task
`gitlab:assets :fix_urls` which rewrite the reference URL in the css.

I removed rake task `gitlab:assets:compile` at runtime
and confirmed that the gitlab application worked normally as before.
I have confirmed that at least the following functions work properly.
- Administrator password reset at first login
- Create empty project
- Edit/add and commit files using web IDE
- Create merge request/issue
- Attach files to comments
- Create empty group
- Move existing project to group

In addition, we no longer need to do following things
- persist node_modules, recompiled assets and caches
- apply patches to gitlab itself to avoid removing (symlink to) node_modules/

This change also reduces startup time in certain cases
when the relative URL feature is enabled
(when assets are compiled; for example,
when performing a version upgrade or changing the relative URL)
(on my environment, `gitlab:assets:fix_urls` took about 20 seconds)
2025-06-17 19:01:09 +09:00
Kazunori Kimura
de75177e22 Remove patch to remove HSTS setting from app/controller/application_controller.rb
Merged into upstream so no longer required
- gitlab-foss: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/9341
  - commit df376bad3c8586eccc0ee2da1590d14a66bdff10
  - merge commit (squashed) : 9ec03807fd1ad2e0f04721abb7e29a044d5d0e75
- gitlab: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/1360
  - commit 76e96878aad0a281f8c32ef98a276b499e2581ad

First contained tag:
- gitlab-foss: v9.0.0
- gitlab: v9.0.0-ee
2025-06-13 10:58:30 +09:00
Steven Achilles
8408f1e064 Add disabled password option for adduser as replacement for disabled login option 2025-05-19 10:49:06 +02:00
Steven Achilles
576243c649 Remove disable login option for adduser in order to allow user 'git' to login 2025-05-19 07:17:57 +02:00
Steven Achilles
c9ec90d853 Remove user 'ubuntu' and set uid and gid for user 'git' explicitly 2025-05-18 14:20:11 +02:00
Steven Achilles
cde9b4e320 Increase memory to avoid heap limit allocation failure 2025-05-15 22:28:17 +02:00
Steven Achilles
b3247e4d03 Remove package 'paxctl' 2025-05-15 20:34:10 +02:00
Kazunori Kimura
d7c3997285 remove libyaml-dev from BUILD_DEPENDENCIES
Because this is required on runtime
and BUILD_DEPENDENCIES will be removed at the end of installation
Installation of `libyaml-dev` is written in Dockerfile
so additional installation is not reeded

if not, following error reported on runtime

> LoadError: libyaml-0.so.2: cannot open shared object file: No such or directory - /usr/local/lib/ruby/3.2.0/x86_64-linux/psych.so

This is because Ruby 3.2.0 (psych 5.0.0) or later
does not contain libyaml any more
https://github.com/ruby/psych/pull/541
2025-01-20 19:20:04 +01:00
Kazunori Kimura
3cde3caf98 update patch 0003-fix_preinstall.mjs-to-avoid-removing-node_modules-dir.patch
File updated
No changes to the scripts we want to modify

- Simplify fileURLToPath usage in scripts
  https://gitlab.com/gitlab-org/gitlab/-/merge_requests/173402
  especially in commit 462273d2ba
  first contained in : v17.7.0-ee
2025-01-19 10:18:58 +01:00
Kazunori Kimura
3c0be758cb Add ENV RUBYGEMS_VERSION and set to latest 3.5.x
that is GitLab v17.0 recommendation

MR that updates docs/install/installation.md:
- "Bump version of rubygems in installation instructions"
  https://gitlab.com/gitlab-org/gitlab/-/merge_requests/149976

There is no entry in .tools-version
2024-06-21 23:30:34 +09:00
Kazunori Kimura
9f5961939d Allow patching Ruby, add patch for lib/securernadom.rb
Backport: fix behavior of `SecureRandom.gen_random_openssl(n)`
commit:
64e503eb62

This has been merged into the Ruby 3.3 release, but Ruby (at least) 3.0 and later are affected by the issues fixed by this commit.
2024-02-13 04:27:50 +09:00
Kazunori Kimura
e636b969a9 Revise build patch structure
to allow patching each middleware or library

Just move patches to assets/build/patches/gitlabhq
Folder name are matched to assets/runtime/config
2024-02-13 04:27:50 +09:00
Kazunori Kimura
1c286f72d1 Remove trailing whitespace in patch for assets:compile
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.
2024-01-30 06:39:52 +00:00
Kazunori Kimura
9345235f27 Replace removed function in patch for assets::compile
`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`.
2024-01-30 06:39:52 +00:00
Steven Achilles
5b092729fa
Merge pull request #2884 from kkimurak/issue/2866-fix-assets_webpack_manifest.json-not-found
Add build patch to prevent rake task assets:compile to remove assets dir
2024-01-19 22:53:40 +01:00
Kazunori Kimura
3885a455d1 Add build patch to prevent rake task assets:compile to remove assets dir
GitLab does not launch after second run if relative url is used.
This is caused by following upstream change to remove assets directory on assets compile.
See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/103715

This is introduced on v15.6.0
````sh
$ git -C ../gitlab.git/ tag --contains e46d92c0 | sort --version-sort | head -n 1
v15.6.0-ee
````

1. `sameersbn/gitlab` create symbolic link /home/git/gitlab/public/assets/
  to point /home/git/data/tmp/assets if relative url is used.
  This is to store assets in the docker volume to avoid unnecessary recompilations.
  These assets are removed and recompiled only when the gitlab version or relative url root is changed.
2. By the change provided by gitlab.com/gitlab-org/gitlab!103715,
  rake task `gitlab:assets:compile` became to remove assets directory directly (by `FileUtils.rm_rf()`).
  It does not remove compiled assets itself, but remove symlink /home/git/gitlab/public/assets .
  Then it compiles assets as usual, but they will be stored in newly-created normal directory /home/git/gitlab/public/assets/
3. On container down, whole container statement (except volumes) will be reset.
  These compiled assets will be removed as well because they are not in docker volume.
4. As we store version info and relative url root path to /home/git/data/tmp/,
  we cannot recognize we have to recompile assets (that have been removed by mistake)

To avoid the issue, this commit add a build time patch to change the behavior of rake task `gitlab:assets:compile`
to empty assets instead of removing assets directory itself.
2024-01-18 18:10:26 +09:00
Kazunori Kimura
d16119b54b Remove ajv as an explicit dependency
There was an issue that `ajv` is not installed by mistake.
This issue have been fixed on upstream, a few years ago.

Now, we can revert the change.
This commit partially reverts 985d57afb9673b2f5acb1f12cbc13f230f6ec074
See sameersbn/gitlab#1358

It seems that fix MR on upstream is https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14543
but we cannot check diff because source / target branch removed by mistake

Anyway, no need to add ajv as an explicit dependency with (at least) gitlab v11 or later
2024-01-18 15:42:17 +09:00
Kazunori Kimura
da0d78bf5b Add build patch to avoid removing node_modules
note: Only affected if using the relative_url feature

`gitlab/script/frontent/preinstall.mjs` is introduced since v16.4.0.
This script is executed on container startup, if using the relative url.
This script removes `NODE_MODULES` (/home/git/gitlab/node_modules) when
"the folder seems to end up being a corrupted somehow"
See more detail:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/130938

On sameersbn/gitlab, the folder node_modules is declared as volume.
The volume is always busy so that cannot be removed in the container.
You can see following error reported on container startup
(sameersbn/gitlab:16.4.0 or later).

````
yarn install v1.22.19
$ node ./scripts/frontend/preinstall.mjs
[WARNING] package.json changed significantly. Removing node_modules to be sure there are no problems. node:internal/process/esm_loader:97
    internalBinding('errors').triggerUncaughtException(
                              ^

[Error: EBUSY: resource busy or locked, rmdir '/home/git/gitlab/node_modules'] {
  errno: -16,
  code: 'EBUSY',
  syscall: 'rmdir',
  path: '/home/git/gitlab/node_modules'
}

Node.js v18.17.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. -----
````

This PR add a build time patch to change the behavior of
script/frontend/preinstall.mjs to not to remove node_modules directly,
but empty it instead.
2023-10-21 01:24:39 +09:00
Steven Achilles
2fb3680976 Remove temporary patch for lfs object URL (see c51770292e) 2023-09-02 08:28:56 +02:00
Steven Achilles
c51770292e Add temporary patch for lfs object URL 2023-08-23 18:57:51 +02:00
Steven Achilles
230284ebcf Do not copy ruby by installing gitaly 2023-05-25 18:14:23 +02:00
Steven Achilles
5fc732eb3c Add new configuration options for database.yml 2023-05-25 06:44:20 +02:00
Kazunori Kimura
029186dc63 Avoid permission error on creating config file
`assets/build/config/database.yml.postgresql` is owned by root:root,
and permission is rwxrw----
so the user `git` (`${GILTAB_USER}`) doesn't have a permission to copy the file.
This raises an error while building.
2023-04-17 16:06:35 +09:00
Steven Achilles
5450187484
Merge pull request #2735 from zimmski/enable-git-protocol-2
Allow SSH clients to explicitly set the Git transfer protocol
2023-04-12 16:17:53 +02:00
Kazunori Kimura
95bc778ee0 Silence "CRIT unixServer" warning from supervisord
Silence the message like below:
  CRIT Server 'unix_http_server' running without any HTTP authentication checking

Reference:
  https://github.com/Supervisor/supervisor/issues/717#issuecomment-176860145
  https://github.com/sameersbn/docker-redmine/commit/0fb84b9
2023-03-31 03:01:19 +09:00
Markus Zimmermann
4bfc8974ba
Allow SSH clients to explicitly set the Git transfer protocol
This allows to the client to explicitly select protocol version 2, which is much more efficient. Without allowing that environment variable it seems that SSH connections are always stuck in version1.  See https://docs.gitlab.com/ee/administration/git_protocol.html on how to check if protocol 2 is used.
2023-03-24 11:55:42 +01:00
Kazunori Kimura
a1dcfe6eaf Update sidekiq supervisord config; sidekiq v6.0
Sidekiq is updated to v6.0 here (first contained tag: v14.4.0-ee)
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69655

In Sidekiq 6.0, these options have been marked as "deprecated":
-P (set pid file)
-L (set log file)
See https://github.com/sidekiq/sidekiq/commit/3f5b1c5

Now, we can see error message in {GITLAB_LOGS_DIR}/supervisor/sidekiq.log
like below:

----
ERROR: PID file creation was removed in Sidekiq 6.0, please use a proper process supervisor to start and manage your services
ERROR: Logfile redirection was removed in Sidekiq 6.0, Sidekiq will only log to STDOUT
----

Just stop using this option.
2023-02-22 20:42:51 +09:00
Kazunori Kimura
10a48c1541 Clarify user=root in supervisord.conf
to prevent "Supervisor running as root" warning
2023-02-22 20:42:51 +09:00
Antt1995
8db9ed8908
Upgrade Go & safe dir 2022-11-23 15:14:40 +00:00
Steven Achilles
5c9c5cad1b Temporary remove geo from config/database.yml 2022-07-02 15:49:54 +02:00
Kazunori Kimura
fbcdd290be fix condition to apply patch during build gitlab
rewrite patch applying with find | while read chain
`if [[ -f ]]` with globbing may not works
2022-06-21 08:46:32 +09:00
Steven Achilles
0badf7cdd7 Use git instead of git-core 2022-05-05 19:53:52 +02:00
Steven Achilles
64e6256012 transfer build packages from Dockerfile to install.sh 2022-05-03 19:36:22 +02:00
Steven Achilles
889d9c36bf collective deletion of packages 2022-05-03 19:14:50 +02:00
Steven Achilles
a02abdce2d Address inconsistencies when using git (packaged with gitaly). 2022-05-03 17:58:58 +02:00
Paolo Mainardi
21b459216b refs #2549: Install git from gitaly 2022-04-29 17:19:40 +02:00
Kazunori Kimura
464cd644d6 set bundler version based on gitlab's Gemfile.lock
bundler used in gitlab is upgraded from 2.1.4 to 2.3.6
See more detail on : https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79251
first contained tag : v14.8.0
2022-04-14 00:30:26 +09:00
Olivier Mueller
3ab737d218 Fix suggested by Kazunori Kimura 2022-03-23 13:02:14 +01:00
Kazunori Kimura
af9bfee78f add patch to change SSH_ALGORITHMS_PATH
To enable ssh host key info in help page
2022-01-26 00:23:40 +09:00
Steven Achilles
e83bb7e17a Rename/remove build patch for gitlab-foss
- Expand if condition so that non-existent gitlab patches are not a problem
2021-12-23 13:04:38 +01:00
Steven Achilles
6c0888b669 Add make target for gitlab-shell 2021-10-19 22:18:11 +02:00
Steven Achilles
3232a10fe4 Update base image, fix problems compiling gitlab-shell and complete changelog 2021-10-19 21:41:12 +02:00
Steven Achilles
1d6fa315f2
Merge pull request #2429 from kkimurak/install-ruby-from-source
Install ruby from source
2021-10-19 21:01:53 +02:00
Steven Achilles
c36fc17354
Add variable for the source url of ruby
I think that defining a variable for the source of the Ruby tarball makes sense.
2021-10-19 20:00:55 +02:00
Kazunori Kimura
47d17b6ffb remove duplicated installation of bundler
`bundler 2.1.4` is default gem of ruby >= 2.7.1 and installed during ruby installation
so we don't need to install it explicitly.
2021-10-10 23:51:57 +09:00
Kazunori Kimura
f8f2190826 supress build time warnings
- [git] set advice.detachHead=false
- [bundle] use `bundle config set --local` instead of
  - `--deployment`
  - `--with` / `--without`
  arguments for `bundle install`
2021-10-09 15:56:07 +09:00
Kazunori Kimura
173e5e25a3 Install ruby from source (v2.4.2) 2021-10-09 15:45:11 +09:00