Skip to content

GitLab

GitLab でプロジェクトインポート機能を有効化する

GitLab では「他の Git サーバ」や「別の GitLab」からデータをインポートすることが出来ます。 Import and migrate groups and projects には以下の記載があります。 SaaS 版の GitLab ではインポート機能がデフォルトで有効化されているようですが、Self-Managed 版の場合は「デフォルトで無効」と書かれています。

The import sources that are available to you by default depend on which GitLab you use:

  • GitLab.com: all available import sources are enabled by default.
  • GitLab Self-Managed: no import sources are enabled by default and must be enabled.

GitLab can import projects from these supported import sources.

Import source Description
Bitbucket Cloud Using Bitbucket.org as an OmniAuth provider, import Bitbucket repositories.
Bitbucket Server Import repositories from Bitbucket Server (also known as Stash).
FogBugz Import FogBugz projects.
Gitea Import Gitea projects.
GitHub Import from either GitHub.com or GitHub Enterprise.
GitLab export Migrate projects one by one by using a GitLab export file.
Manifest file Upload a manifest file.
Repository by URL Provide a Git repository URL to create a new project from.

今回は Self-Managed 版で「インポート機能を有効化する」手順をメモします。

Amazon Linux 2023 + GitLab で TCP/22 を GitLab 用に設定する

先日、Amazon Linux 2023 へ GitLab をインストールする というメモを書きました。 公式サイトの gitlab-sshd によると Omnibus 版 GitLab の場合、GitLab で SCP 機能を有効化する場合は以下の設定をしろ、という記載があります。

/etc/gitlab/gitlab.rb
gitlab_sshd['enable'] = true
gitlab_sshd['listen_address'] = '[::]:2222' # Adjust the port accordingly

ですが、OS 標準の sshd を TCP/22 以外へ設定し、その代わりに GitLab に TCP/22 を利用させようとしても「GitLab がポートを Listen しない」という事象が起こりました。 この問題を解決するには以下のように capset 実行します。

sudo setcap 'cap_net_bind_service=+ep' /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-sshd

その上で GitLab の設定ファイルである /etc/gitlab/gitlab.rb へ以下のように設定します。

/etc/gitlab/gitlab.rb
gitlab_sshd['enable'] = true
gitlab_sshd['listen_address'] = '0.0.0.0:22'

あとは GitLab を再起動します。

sudo gitlab-ctl reconfigure

これで GitLab が TCP/22 を Listen するようになりました。

Amazon Linux 2023 へ GitLab をインストールする

以前に以下のメモを書きました。

インストール手順は公式サイトの GitLab Self-Managedのインストール に記載されています。 今回は Amazon Linux 2023 へ GitLab をインストールする手順をメモしておきます。

コンテナで動作している GitLab をバージョンアップする

以前に Docker Compose で GitLab を起動する というメモを書きました。 この手順でコンテナとして起動している GitLab へログインしたところ、以下の警告が表示されました。

file

その為、今回はコンテナを差し替えてバージョンアップしたのですが、その手順をメモしておきます。 場合によってはアップグレードパスを経由する必要がありますが、今回は直接、アップグレード出来たので「起動するコンテナイメージを変更するだけ」と手順は簡単です。

Docker Compose で GitLab を起動する

GitLab には Enterprise Edition と Community Edition のふたつがあります。 Enterprise Edition であっても「無料版」があるので、「どちらを利用するか?」は選択が必要です。 Edition の違いについては Which GitLab edition is right for you? に記載されています。

今回は GitLab Community Edition を Docker Compose で起動する手順をメモしておきます。 尚、今回は CI/CD を想定しておらず、Runner は用意しません。 尚、GitLab の Docker コンテナイメージは gitlab/gitlab-ce で公開されています。