Tambourine作業メモ

主にスキル習得のためにやった作業のメモ。他人には基本的に無用のものです。

GitLabのインストールをやってみる

ちょっと事情があって、ローカルのマシンにGitLabを入れる必要が出来た。練習にAWSのEC2にインストールしてみることにする。

まだ、OSに何を使うかは決まってないんだけども、とりあえずGitLabのインストールページの一番上にubuntuがあるので、これでやってみることにする。

ここを見ながらやる

Download and install GitLab | GitLab

EC2にt2.mediumのマシンを作って、

sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl

を実行する。その後のpostfixのインストールはスキップする。

次に

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

を実行する。

インストーラーを起動するが、そこに外部からみたURLを与える必要があるらしい。お試しなので全然考えてないが、とりあえず、httpで、かつホスト名だけでアクセスしてみたい。どうせ今はSSH越しにしかアクセスしないだろうし。

とりあえず、ホスト名は変えておこう

sudo vi /etc/hosts
sudo hostnamectl set-hostname gitlabstudy

再起動して、インストーラーを起動してみる。ここで気付く。あれ?これってEnterprise Editionじゃん。Community Editionでいいんだけど・・・。ところが、別にお金を払いたくないという理由でCEを選ぶのなら、EEを入れてお金を払わないで使っていればいいらしい。「オレのマシンにプロプライエタリなコードは一切入って欲しくない!」という人は、CEを入れる事もできるらしい。なるほどね。

Community EditionとEnterprise Editionの違い | GitLab.JP

https://www.gitlab.jp/install/ce-or-ee/

sudo EXTERNAL_URL="http://gitlabstudy" apt-get install gitlab-ee

しかし、これはここを最後に固まってしまう

  * ruby_block[authorize Grafana with GitLab] action run

ググってみるとこんなのがみつかる

Ruby_block[authorize Grafana with GitLab] action run timeouts - Observability - GitLab Forum

最後のコメントに「メモリが足りないとなるんだよね」と書かれている。にわかに信じがたい。試しに、t2.large(メモリ8GB)で試してみると上手くいった。なんと・・・

Notes:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.

NOTE: Because these credentials might be present in your log files in plain text, it is highly recommended to reset the password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

gitlab Reconfigured!

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

Thank you for installing GitLab!
GitLab should be available at http://gitlabstudy

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=14-9

パスワード書いたファイルは24時間で消えると書かれてる。怖い

ubuntu@gitlabstudy:/etc/gitlab$ sudo cat initial_root_password 
# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: 8f70FrnDhG1OOIjmHNjmrZ+anZGCAed7ExhD3Hfvfo8=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

自分の/private/etc/hostsにgitlabstudyの行を作って

ssh -L 8080:localhost:80 gitlabstudy

した上で、http://localhsot:8080/にアクセスするとGitLabの画面にアクセス出来る。