タグ: GitLab

  • GitLab CEでプロジェクト作成時にリポジトリ初期化がされるようになった。

    GitLab CE 13.1.3にしたら、プロジェクト作成時にリポジトリの初期化が自動されるようになった。

    前は、コマンドが表示されて、それを使って手動で作っていた。かなり便利になった。

  • GitLabをaptでアップグレードしたところエラーになった

    GitLab(バージョンは、GitLab Community Edition 12.10.5)をaptでアップグレードしたところエラーになった。apt upgradeで発生したエラーは下記。

    gitlab preinstall: It seems you are upgrading from major version 12 to major version 13.
    gitlab preinstall: It is required to upgrade to the latest 13.0.x version first before proceeding.
    gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations
    dpkg: アーカイブ /var/cache/apt/archives/gitlab-ce_13.1.3-ce.0_amd64.deb の処理中にエラーが発生しました (--unpack):
     new gitlab-ce package pre-installation script subprocess returned error exit status 1
    処理中にエラーが発生しました:
     /var/cache/apt/archives/gitlab-ce_13.1.3-ce.0_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    エラーの原因としては、メジャーバージョンアップがあり、段階的にバージョンアップをしないと、マイグレーションが行えないため、エラーになった。バージョンの12.10から13.1へのアップグレードには、間に13.0をはさんでから、アップグレードする必要があった。

    アップグレードパスの参考: 
    https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations
    パッケージのバージョン情報: 
    https://packages.gitlab.com/gitlab/gitlab-ce

    アップグレードパスを参考に、パッケージのバージョン情報をを調べて、upgradeのバージョンを指定する。そして、1段階ずつアップグレードしていく。

    実行したコマンド

    sudo apt update
    sudo apt upgrade gitlab-ce=13.0.9-ce.0
    sudo apt upgrade gitlab-ce=13.1.3-ce.0
    sudo gitlab-ctl restart
    
  • apt updateでGitLabの公開鍵がエラーになり更新できなかった

    Ubuntu Serverで、apt updateを行ったところ、GitLabの公開鍵がエラーになった。

    エラー:7 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu bionic InRelease
      公開鍵を利用できないため、以下の署名は検証できませんでした: NO_PUBKEY 3F01618A51312F3F
    

    “apt-key list” で公開鍵を確認してみると、「2020-04-15」で期限切れになっていた。

    zen@Lab:~$ apt-key list
    /etc/apt/trusted.gpg
    --------------------
    pub   dsa1024 2005-05-24 [SC]
          3B59 3C7B E6DB 6A89 FB7C  BFFD 058A 05E9 0C4E CFEC
    uid           [  不明  ] Ubuntu-ja Archive Automatic Signing Key 
    sub   elg2048 2005-05-24 [E]
    
    pub   rsa1024 2009-04-05 [SC]
          5967 6CBC F5DF D8C1 CEFE  375B 68B5 F60D CDC1 D865
    uid           [  不明  ] Launchpad PPA for Ubuntu Japanese Team
    
    pub   rsa4096 2015-04-17 [SC] [期限切れ: 2020-04-15]
          1A4C 919D B987 D435 9396  38B9 1421 9A96 E15E 78F4
    uid           [期限切れ] GitLab B.V. (package repository signing key) 
    
    /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-archive.gpg
    ------------------------------------------------------
    pub   rsa4096 2012-05-11 [SC]
          790B C727 7767 219C 42C8  6F93 3B4F E6AC C0B2 1F32
    uid           [  不明  ] Ubuntu Archive Automatic Signing Key (2012) 
    
    /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
    ------------------------------------------------------
    pub   rsa4096 2012-05-11 [SC]
          8439 38DF 228D 22F7 B374  2BC0 D94A A3F0 EFE2 1092
    uid           [  不明  ] Ubuntu CD Image Automatic Signing Key (2012) 
    
    /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
    ------------------------------------------------------
    pub   rsa4096 2018-09-17 [SC]
          F6EC B376 2474 EDA9 D21B  7022 8719 20D1 991B C93C
    uid           [  不明  ] Ubuntu Archive Automatic Signing Key (2018) 
    
    zen@Lab:~$
    

    GitLabのページをみたところ、公開鍵(GPG)の更新手順が乗っていたので、実行する。手順は、キーをダウンロードする。次に、GPGキーを追加する。

    curl https://packages.gitlab.com/gpg.key -o /tmp/omnibus_gitlab_gpg.key
    sudo apt-key add /tmp/omnibus_gitlab_gpg.key
    

    これで、完了。あとは、もう一度apt updateして、sudo apt upgradeを行う。GitLabも、ちゃんと更新された。

    実際に実行すると、下記のような感じ。

    zen@Lab:~$ curl https://packages.gitlab.com/gpg.key -o /tmp/omnibus_gitlab_gpg.key
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  3191  100  3191    0     0   6675      0 --:--:-- --:--:-- --:--:--  6689
    zen@Lab:~$
    zen@Lab:~$
    zen@Lab:~$ sudo apt-key add /tmp/omnibus_gitlab_gpg.key
    OK
    zen@Lab:~$
    

    ■参考 
    https://docs.gitlab.com/omnibus/update/package_signatures#package-repository-metadata-signing-keys

  • GitLabをインストールしてみた

    Gitの管理で楽をしたかったので、GitLabをインストールしてみた。(もっと楽をするならば、GitHubやBacklogを契約すればいいのだろうけど)

    インストール先は、Ubuntu 18.04 Desktop。Serverにしておけばよかった。

    最初にGitLabのインストールに必要なツールをインストールする。

    sudo apt install openssh-server
    sudo apt install curl
    sudo apt install postfix 
    

    次に、aptの参照先にgitlabのものを追加する。

    curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash 
    

    aptでgitlabをインストールする。

    sudo apt install gitlab-ce 
    

    gitlabの設定ファイルを編集する。エディタはインストールしている好きなものを指定する。

    sudo xemacs21 /etc/gitlab/gitlab.rb 
    

    最低限のアクセス用のURLとタイムゾーンを変更する。それ以外は、必要に応じてカスタマイズする。とりあえず動かすだけならば、この2つ。

    external_url 
    gitlab_rails['time_zone'] = 'Asia/Tokyo' 

    設定を反映させる。

    sudo gitlab-ctl reconfigure 
    

    実際にアクセスしてみて、Gitlabが表示されればOK。初回のアクセス時にrootユーザのパスワード設定があるので、忘れずに行う。

    ■インストールしたときのログ。

    zen@LAB:~$ curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
    Detected operating system as Ubuntu/bionic.
    Checking for curl...
    Detected curl...
    Checking for gpg...
    Detected gpg...
    Running apt-get update... done.
    Installing apt-transport-https... done.
    Installing /etc/apt/sources.list.d/gitlab_gitlab-ce.list...done.
    Importing packagecloud gpg key... done.
    Running apt-get update... done.
    
    The repository is setup! You can now install packages.
    zen@LAB:~$
    zen@LAB:~$
    zen@LAB:~$
    zen@LAB:~$
    zen@LAB:~$ sudo apt install gitlab-ce
    パッケージリストを読み込んでいます... 完了
    依存関係ツリーを作成しています
    状態情報を読み取っています... 完了
    以下のパッケージが新たにインストールされます:
      gitlab-ce
    アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 0 個。
    708 MB のアーカイブを取得する必要があります。
    この操作後に追加で 1,858 MB のディスク容量が消費されます。
    取得:1 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu bionic/main amd64 gitlab-ce amd64 12.3.2-ce.0 [708 MB]
    708 MB を 15秒 で取得しました (47.3 MB/s)
    以前に未選択のパッケージ gitlab-ce を選択しています。
    (データベースを読み込んでいます ... 現在 172865 個のファイルとディレクトリがインストールされています。)
    .../gitlab-ce_12.3.2-ce.0_amd64.deb を展開する準備をしています ...
    gitlab-ce (12.3.2-ce.0) を展開しています...
    gitlab-ce (12.3.2-ce.0) を設定しています ...
    It looks like GitLab has not been configured yet; skipping the upgrade script.
    
           *.                  *.
          ***                 ***
         *****               *****
        .******             *******
        ********            ********
       ,,,,,,,,,***********,,,,,,,,,
      ,,,,,,,,,,,*********,,,,,,,,,,,
      .,,,,,,,,,,,*******,,,,,,,,,,,,
          ,,,,,,,,,*****,,,,,,,,,.
             ,,,,,,,****,,,,,,
                .,,,***,,,,
                    ,*,.
    
    
    
         _______ __  __          __
        / ____(_) /_/ /   ____ _/ /_
       / / __/ / __/ /   / __ `/ __ \
      / /_/ / / /_/ /___/ /_/ / /_/ /
      \____/_/\__/_____/\__,_/_.___/
    
    
    Thank you for installing GitLab!
    GitLab was unable to detect a valid hostname for your instance.
    Please configure a URL for your GitLab instance by setting `external_url`
    configuration in /etc/gitlab/gitlab.rb file.
    Then, you can start your GitLab instance by running the following command:
      sudo gitlab-ctl reconfigure
    
    For a comprehensive list of configuration options please see the Omnibus GitLab readme
    https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
    
    zen@LAB:~$
    
  • Ubuntu19.04にGitlabをインストールしようとするとエラーになる

    Ubuntu19.04にGitlabをインストールしようとすると「E: パッケージ gitlab-ce が見つかりません」とエラーになる。

    ~$ sudo EXTERNAL_URL="http://localhost" apt install gitl
    ab-ce
    パッケージリストを読み込んでいます... 完了
    依存関係ツリーを作成しています
    状態情報を読み取っています... 完了
    E: パッケージ gitlab-ce が見つかりません
    

    状況を調べたところ、インストール時に下記のコマンドを実行したが、apt(apt-get)先に登録されていなかった。

    curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash 
    

    gitlabの対応OSが、Ubuntu16.04とUbuntu18.04で、Ubuntu19.04が入っていないので、ここではじかれているものと思われる。色気を出さずに、Ubuntu18.04で同じことを試したところ、あっさりとgitlabのインストールができた。そのため、対応OSのバージョン不一致が原因。

  • GitLab Community Edition 12.3.3のデータの場所

    Ubuntu 18.04にインストールしたときのGitLab Community Edition 12.3.3 のデータの保存先など。

    データベースやgitのリポジトリのデータなど。

    /var/opt/gitlab
    

    アプリケーションのインストール先。

    /opt/gitlab