git 勉強
「地獄からの情報マネージャ
ビールにおけるフリー
gitのマスターリポジトリ http://git.kernel.org/git/git.git.
2015/12/05 GitLab 8.2がリリースされた。
→ Git LFSに対応。リリースを保存できる?。ビルド結果を保管できる。
GITLABは3つある
■ gitlab CE
説明 種類
OSS/on-premise GitHub Like
無料
バージョン8.0からGitLab CIと統合
→ 別途 CI Runnerを用意する必要あり
容量制限:設定次第 LFS:設定次第 CI:内臓 サービス:まあまあ
■ gitlab EE
説明 種類
有償版/on-premise GitHub Like
GitLab EE(BASIC) $390(年額)
GitLab EE(Standard) $4,900(年額)
GitLab EE(PLUS) $14,900(年額)
バージョン8.0からGitLab CIと統合
→ 別途 CI Runnerを用意する必要あり
■ gitlab.com(クラウドサービス)
説明 種類
GitLab EE/Cloud GitHub Like
GitLab.com(Public)
GitLab.com(Private)
→ FREE
CI Runnerが提供→すぐにビルドできる。
容量制限:10GB/repo*3 LFS:10GB/repo*3 CI:内臓 サービス:まあまあ
*3 リポジトリとあわせて10GB→ 意味がわからない
■ GitLab CI
説明 種類
OSS/on-premise CI Server
Travis CI, CircleCIに近く、Jenkinsのような細かいことはできない。
プロジェクト専用 CI Runnerが作れる。
http://doc.gitlab.com/ce/ci/yaml/README.html
■ GitLab Mattermost
説明 種類
OSS/on-premise Slack Like
http://doc.gitlab.com/omnibus/gitlab-mattermost/README.html
■ Bitbucket
説明 種類
Cloud GitHub Like
Private/5 users 無料
Private/10 users $10
LFS対応→Bitbucket
■ GitBucket
OSS/on-premise GitHub Like
無料
容量制限:設定次第 LFS:なし?確認する→ CI:外部 サービス:少なめ
■ GitHub Enterprise
$5000(年額)
■ GitHubとGitLabの違い
UIが違う
用語が違う
・ リポジトリ→ プロジェクト
・ Organization→Group
・ Pull Request→Merge Request
このドキュメントはGitHub用語で統一している。
・外部サービス連携の違いがある。外部連携できるサービスがそんなに多くない。
でも必要なのはまあまあそろってそう。
・GitHubにある、フォロー・フォロワーなどのSNS機能がありません。
・TEAMがない。GitHubではひとつのOrganizationで、複数のTeamをもてるけど、GitLabにはそれがない
・GitHub Pagesがない。(このスライドとか・・)サードパーティで、GitLab Pagesというのがあるみたい?
■ ほかのGitHubクローン
・ SourceForge
・ BitBucket
・ GitOrious
・ Google Code
・ CodePlex
・ Visual Studio team Services
・ Universions
・ GitBucket→日本人が開発。オンプレミス版→ ほぼ一人で開発
■ GitHub
public : 無料
private (Micro/Personal) $7 (5repos)
private (Bronze/Organization) $25 (10repos)
容量制限:1GB/repo*1 LFS : 1GB/repo*2 CI:外部 サービス:豊富
Travis CIなどとの連携が難しいはずなので、無償でここまでできるのはすごい
*1 100MB/file
*2 1GB以上は有料
☆ 考え方
サーバの管理をしたくない人はGitLab.com
社内にサーバーがないと不安jな人はGitLab CE/EE
■ GIT LFSについて
大きなサイズのファイルを扱う Git LFSに対応
ストレージ機能を内蔵しているので、別途Git LFS Serverを立てる必要なし
リポジトリとLFSあわせて、10GBまで使える。
・使い方について
http://doc.gitlab.com/ce/workflow/lfs/manage_large_binaries_with_git_lfs.html
http://masakura.github.io/gitlab-slide/#/3
機能
・Gitリポジトリ
・Issue Tracking System
・Pull Request
・Organization
・Markdown
■ インストール手順
■ 依存関係のあるパッケージをインストール。必要な設定をしておく。
sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
→ ここでエラーがでる場合
yum install firewalld
systemctl start firewalld.service
sudo firewall-cmd --permanent --add-service=http
success
sudo systemctl reload firewalld
公式のページにはないが・・・・
systemctl enable gitlab-runsvdir
■ インストール
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
configure と GitLabサービスの開始
sudo gitlab-ctl reconfigure
sudo gitlab-ctl status
■ 設定
いろいろインストールするとメモリをくうので、swapを足しておく
dd if=/dev/zero of=/swapfile bs=1M count=2000
2000+0 records in
2000+0 records out
2097152000 bytes (2.1 GB) copied, 71.1382 s, 29.5 MB/s
mkswap /swapfile
Setting up swapspace version 1, size = 2047996 KiB
no label, UUID=d514e1fc-c431-4bd0-84f3-b618da0ea289
# vi /etc/fstab
以下を追記
/swapfile swap swap defaults 0 0 ←/swapfileをswap領域としてマウントさせる
■ 日本語化
yum install git patch
git clone https://github.com/ksoichiro/gitlab-i18n-patch.git
patch -p1 < /etc/gitlab/gitlab-i18n-patch/patches/v8.2.0/app_ja.patch
■ https化
※ ここでは、開発用として、おれおれ証明書を作成する。
openssl genrsa 2048 > server.key
openssl req -new -key server.key > server.csr
Country Name (2 letter code) [XX]: JP
State or Province Name (full name) []:<空エンター>
Locality Name (eg, city) [Default City]:<空エンター>
Organization Name (eg, company) [Default Company Ltd]:<空エンター>
Organizational Unit Name (eg, section) []:<空エンター>
Common Name (eg, your name or your server's hostname) []: localhost
Email Address []:<空エンター>
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:<空エンター>
An optional company name []:<空エンター>
SSLサーバ証明書の作成(有効期限10年)
openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt
秘密鍵とSSL証明書を、適切な場所に移動
mv -i server.key /etc/pki/tls/private/
mv -i server.crt /etc/pki/tls/certs/
パーミッションを変更
chmod 400 /etc/pki/tls/private/server.key
chmod 400 /etc/pki/tls/certs/server.crt
CSRを削除
rm server.csr
GitLab のHTTPS設定
vi /etc/gitlab/gitlab.rb
external_url 'http://localhost'
↓
external_url 'https://gitlab.example.com'
# nginx['ssl_certificate'] = "/etc/gitlab/ssl/#{node['fqdn']}.crt"
# nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/#{node['fqdn']}.key"
↓
nginx['ssl_certificate'] = "/etc/pki/tls/certs/server.crt"
nginx['ssl_certificate_key'] = "/etc/pki/tls/private/server.key"
HTTPS(443)ポートを空けておきます。
firewall-cmd --add-port=443/tcp --permanent
firewall-cmd --reload