Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
コンテンツにスキップ
メインメニュー
メインメニュー
サイドバーに移動
非表示
案内
メインページ
目次
コミュニティに貢献
最近の出来事
おまかせ表示
特別ページ
交流
ヘルプ
貢献
最近の更新
最近の議論
新しいページ
統計
リクエスト
ArchWiki
検索
検索
表示
アカウント作成
ログイン
個人用ツール
アカウント作成
ログイン
GitLabのソースを表示
ページ
議論
日本語
閲覧
ソースを閲覧
履歴を表示
ツール
ツール
サイドバーに移動
非表示
操作
閲覧
ソースを閲覧
履歴を表示
全般
リンク元
関連ページの更新状況
ページ情報
表示
サイドバーに移動
非表示
←
GitLab
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:Git ウェブインターフェイス]] [[Category:ウェブアプリケーション]] [[en:GitLab]] {{Related articles start}} {{Related|Gitolite}} {{Related|Ruby on Rails}} {{Related articles end}} [https://about.gitlab.com/ GitLab のホームページ] より: :''GitLab は git リポジトリの管理、コードレビュー、イシュートラッキング、アクティビティフィード、wiki を提供します。エンタープライズは自社運用な GitLab をインストールして LDAP や Active Directory サーバーと接続してセキュアな認証を行います。単一の GitLab サーバーだけで 25,000 以上のユーザーを管理することができますが、サーバーを複数用意すれば更に多数のユーザーを使えるようにすることが可能です。'' 実際に動作するサンプル版が [https://gitlab.com/ GitLab.com] に存在します。 == インストール == {{Note| * RVM を使いたい場合はインストールする前に [[#rvm で GitLab を実行]] を参照してください。 * この記事ではまず HTTPS を使わないで GitLab をインストール・設定する方法を説明します。HTTPS が必要な場合は [[#高度な設定]] を参照して SSL をセットアップしてください。}} GitLab は [[Redis]] とデータベースバックエンドを必要します。同一のマシン上でデータベースを実行する場合、先に [[MySQL]] か [[PostgreSQL]] をインストールしてください。 {{Pkg|gitlab}} パッケージを[[インストール]]してください。 メール通知を受け取るには、メールサーバーをインストール・設定する必要があります。詳しくは次のカテゴリを参照: [[:カテゴリ:メールサーバー]]。 == 設定 == === 設定ファイル === {{Pkg|gitlab}} パッケージは GitLab のファイルを Linux の標準的な慣習にそって以下のようにインストールします: {| class="wikitable" ! 説明 ! [https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md GitLab 公式] ! {{Pkg|gitlab}} |---------------------------------------------------------- | GitShell の設定ファイル | {{ic|/home/git/gitlab-shell/config.yml}} | {{ic|/etc/webapps/gitlab-shell/config.yml}} |---------------------------------------------------------- | GitLab の設定ファイル | {{ic|/home/git/gitlab/config/gitlab.yml}} | {{ic|/etc/webapps/gitlab/gitlab.yml}} |---------------------------------------------------------- | ユーザー (ホームディレクトリ) | {{ic|git}} ({{ic|/home/git}}) | {{ic|gitlab}} ({{ic|/var/lib/gitlab}}) |} {{tip|[[Arch Build System]] が使用できるのであれば、PKGBUILD や関連するファイルを編集することで gitlab のホームディレクトリを好きな場所に変更できます。}} ===基本設定=== ====GitLab==== {{ic|/etc/webapps/gitlab/gitlab.yml}} を編集して以下のパラメータを設定してください: {{Tip|ホストネームとポートは {{ic|git clone http://hostname:port}} などとして使われます。}} '''ホストネーム:''' {{ic|gitlab:}} セクションで {{ic|host:}} を設定 - {{ic|localhost}} を {{ic|yourdomain.com}} に置き換えます ('''ノート:''' 'http://' や末尾のスラッシュは付けません) - 完全修飾ドメイン名を使ってください。 '''ポート:''' {{ic|port:}} は紛らわしいかもしれません。gitlab サーバー (unicorn) が動作するポートではありません。ユーザーがブラウザを使って最初にアクセスするときのポートです。ブラウザから 'yourdomain.com' にアクセスするようにしたい場合、ドメイン名にポート番号は基本的に付けないので、{{ic|port:}} は {{ic|80}} のままにしておきます。ブラウザに 'yourdomain.com:3425' などと入力させるときのみ、{{ic|port:}} を {{ic|3425}} と設定します。また、ウェブサーバーの設定も変更して、設定したポートを使うようにしてください。 '''タイムゾーン (任意):''' {{ic|time_zone:}} パラメータは任意ですが、GitLab アプリケーションのゾーンを強制することができます。 最後に ''uploads'' ディレクトリに適切なパーミッションを設定: # chmod 700 /var/lib/gitlab/uploads ====GitLab Shell==== {{Note|同一のホスト上で GitLab をホストする場合 {{ic|gitlab_url}} はデフォルト値のままで問題ありません。}} {{ic|/etc/webapps/gitlab-shell/config.yml}} を編集して {{ic|gitlab_url:}} で適当な url とポートを設定してください: {{hc|/etc/webapps/gitlab-shell/config.yml|2= # GitLab user. git by default user: gitlab # Url to gitlab instance. Used for api calls. Should end with a slash. # Default: http://localhost:8080/ # You only have to change the default if you have configured Unicorn # to listen on a custom port, or if you have configured Unicorn to # only listen on a Unix domain socket. gitlab_url: "http://localhost:8080/" http_settings: # user: someone # password: somepass ... }} ポートやホストネームがデフォルト値と違う場合は {{ic|/etc/webapps/gitlab/unicorn.rb}} の設定を更新してください: {{hc|/etc/webapps/gitlab/unicorn.rb|2= listen "/run/gitlab/gitlab.socket", :backlog => 1024 listen "'''127.0.0.1:8080'''", :tcp_nopush => true }} ====Redis==== デフォルトとは異なる構成で [[Redis]] を使用するときは (アドレスやポート、Unix ソケットなどが異なる場合)、''REDIS_URL'' 環境変数を正しく設定する必要があります。systemd サービスファイルを拡張することで設定できます。{{ic|/etc/systemd/system/gitlab-unicorn.service.d/redis.conf}} ファイルを作成して ''REDIS_URL'' 環境変数を挿入してください: {{hc|/etc/systemd/system/gitlab-unicorn.service.d/redis.conf|<nowiki> [Service] Environment=REDIS_URL=unix:///run/gitlab/redis.sock</nowiki>}} =====Redis で Unix ソケットを使う===== [[Redis#ソケットを使う]]の手順にしたがって、デフォルト設定を調整してください [https://github.com/gitlabhq/gitlabhq/issues/6100]。 * {{ic|git}} と {{ic|gitlab}} ユーザーを {{ic|redis}} [[グループ]]に追加。 * 設定ファイルを更新: {{hc|/etc/webapps/gitlab/resque.yml|2= development: unix:/run/redis/redis.sock test: unix:/run/redis/redis.sock production: unix:/run/redis/redis.sock }} {{hc|/etc/webapps/gitlab-shell/config.yml|2= # Redis settings used for pushing commit notices to gitlab redis: bin: /usr/bin/redis-cli host: 127.0.0.1 port: 6379 # pass: redispass # Allows you to specify the password for Redis database: 5 # Use different database, default up to 16 socket: /run/redis/redis.sock # '''uncomment''' this line namespace: resque:gitlab }} === 詳細設定 === ==== データベースバックエンド ==== Gitlab を実行する前にデータベースバックエンドが必要になります。現在 GitLab は [[MariaDB]] と [[PostgreSQL]] をサポートしています。デフォルトでは、GitLab は MySQL を使うことになっています。PostgreSQL を使用する場合、特別な設定が必要です。 ==== MariaDB ==== MySQL (MariaDB) をセットアップする場合、{{ic|gitlabhq_production}} という名前のデータベースと、そのデータベースの全ての権限を持ったユーザーを作成してください (デフォルト: {{ic|gitlab}}): {{hc|$ mysql -u root -p|2= mysql> CREATE DATABASE `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'password'; mysql> GRANT ALL ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; mysql> \q }} 新しいユーザーで新しいデータベースへの接続を試行: $ mysql -u '''gitlab''' -p -D gitlabhq_production MySQL テンプレートファイルをコピー: # cp /usr/share/doc/gitlab/database.yml.mysql /etc/webapps/gitlab/database.yml 次に {{ic|/etc/webapps/gitlab/database.yml}} を開いて {{ic|gitlabhq_production}} の {{ic|username:}} と {{ic|password:}} を設定してください: {{hc|/etc/webapps/gitlab/database.yml| # # PRODUCTION # production: adapter: mysql2 encoding: utf8 reconnect: false collation: utf8_general_ci database: gitlabhq_production pool: 10 username: '''username''' password: '''"password"''' # host: localhost # socket: /run/mysqld/mysqld.sock # If running MariaDB as socket ... }} ファイルは誰からでも読み込めるようにするべきではありません。{{ic|gitlab}} ユーザーのプロセスだけが読み書きできるようにします: # chmod 600 /etc/webapps/gitlab/database.yml # chown gitlab:gitlab /etc/webapps/gitlab/database.yml MySQL データベースの作成・管理に関する詳しい情報は [https://mariadb.org/docs/ MariaDB のドキュメント] や [https://github.com/gitlabhq/gitlabhq/blob/6-5-stable/doc/install/installation.md GitLab 公式の (汎用) インストールガイド] を見てください。 ==== PostgreSQL ==== PostgreSQL にログインして {{ic|gitlabhq_production}} データベースとユーザーを作成してください。{{ic|your_username_here}} と {{ic|your_password_here}} は実際の値に置き換えてください: # psql -d template1 {{bc|1= template1=# CREATE USER your_username_here WITH PASSWORD 'your_password_here'; template1=# ALTER USER your_username_here SUPERUSER; template1=# CREATE DATABASE gitlabhq_production OWNER your_username_here; template1=# \q }} {{Note|ユーザーをスーパーユーザーとして作成することで GitLab は「スマート」になり拡張をインストールします。[[PostgreSQL]] ではスーパーユーザーだけが拡張のインストールを許可されています。}} 新しいユーザーで新しいデータベースに接続してデータベースが使えることを確認: # psql -d gitlabhq_production 続行する前に PostgreSQL テンプレートファイルをコピーしてください (デフォルトの MySQL 設定ファイルを上書きします): # cp /usr/share/doc/gitlab/database.yml.postgresql /etc/webapps/gitlab/database.yml 新しい {{ic|/etc/webapps/gitlab/database.yml}} を開いて {{ic|username:}} と {{ic|password:}} の値を設定します。例: {{hc|/etc/webapps/gitlab/database.yml| # # PRODUCTION # production: adapter: postgresql encoding: unicode database: gitlabhq_production pool: 10 username: your_username_here password: "your_password_here" # host: localhost # port: 5432 # socket: /tmp/postgresql.sock ... }} {{ic|/etc/webapps/gitlab/database.yml}} に記載されている他のデータベースの設定について心配する必要はありません。GitLab を使うにはプロダクションデータベースだけをセットアップすれば十分です。 ==== ファイアウォール ==== [[iptables]] ファイアウォールを通り抜けて Gitlab に直接アクセスできるようにしたい場合、ポートとネットワークアドレスを調整してください: # iptables -A tcp_inbound -p TCP -s '''192.168.1.0/24''' --destination-port '''80''' -j ACCEPT API のアクセスを有効にするには: # iptables -A tcp_inbound -p TCP -s '''192.168.1.0/24''' --destination-port '''8080''' -j ACCEPT ルーターを使っている場合、WAN からアクセスできるようにしたいとき、GitLab サーバーを実行しているホストにポートを転送するようにしてください。 ==== Gitlab データベースの初期化 ==== データベースを作成する前に [[Redis]] サーバーを起動してください。 データベースを初期化して高度な機能を有効化: # su - gitlab -s /bin/sh -c "cd '/usr/share/webapps/gitlab'; bundle-2.3 exec rake gitlab:setup RAILS_ENV=production" 最後に以下のコマンドを実行して環境チェックを実行: # su - gitlab -s /bin/sh -c "cd '/usr/share/webapps/gitlab'; bundle-2.3 exec rake gitlab:env:info RAILS_ENV=production" # su - gitlab -s /bin/sh -c "cd '/usr/share/webapps/gitlab'; bundle-2.3 exec rake gitlab:check RAILS_ENV=production" {{note| *''gitlab:env:info'' と ''gitlab:check'' コマンドは git に関するエラーを表示しますが問題ありません。 *''gitlab:check'' が ''Check GitLab API access: FAILED. code: 401'' というエラーで失敗する場合、トラブルシューティングセクションの [[#API アクセス時に 401 Unauthorized]] や [[#/etc/webapps/gitlab/secret が空]]を参照して解決してください。 *''gitlab:check'' は initscripts が存在しないとエラーを吐きます。[[systemd]] サービスファイルを使用するため問題ありません (GitLab から認識されないだけです)。 }} ==== Git ユーザーの設定 ==== # cd /usr/share/webapps/gitlab # sudo -u gitlab -H git config --global user.name "GitLab" # sudo -u gitlab -H git config --global user.email "example@example.com" # sudo -u gitlab -H git config --global core.autocrlf "input" ==== 修飾ビットの調整 ==== ユーザーとグループが正しく設定されていないと gitlab check が通過しません: # chmod -R ug+rwX,o-rwx /var/lib/gitlab/repositories/ # chmod -R ug-s /var/lib/gitlab/repositories # find /var/lib/gitlab/repositories/ -type d -print0 | xargs -0 chmod g+s == GitLab の起動とテスト == {{note|何か問題が発生する場合は [[#トラブルシューティング]] や {{ic|/usr/share/webapps/gitlab/log}} ディレクトリのログファイルを見てください。}} [[MySQL]] または [[PostgreSQL]] と [[Redis]] が適切にセットアップ・実行されていることを確認してください。 データベースバックエンドの起動後、{{ic|gitlab-sidekiq}} と {{ic|gitlab-unicorn}} ユニットを両方とも[[起動]]することで GitLab を独自のウェブサーバー (Unicorn) で起動できます。 システムの起動時に GitLab を自動的に実行したいときは {{ic|gitlab.target}}, {{ic|gitlab-sidekiq}}, {{ic|gitlab-unicorn}} サービスを有効化してください。 そして http://localhost:8080 や http://yourdomain.com をブラウザで開いて GitLab インスタンスをテストしてください。パスワードの作成が要求されます: {{bc| username: root password: You'll be prompted to create one on your first visit. }} == アップデート時のデータベースアップグレード == {{Pkg|gitlab}} パッケージをアップデートした後、データベースをアップグレードする必要があります: # su - gitlab -s /bin/sh -c "cd '/usr/share/webapps/gitlab'; bundle-2.3 exec rake db:migrate RAILS_ENV=production" アップグレード後、gitlab 関連のサービスを再起動してください: # systemctl daemon-reload # systemctl restart gitlab-sidekiq gitlab-unicorn gitlab-workhorse gitlab-gitaly == 高度な設定 == === SSH 接続のカスタマイズ === SSH を標準以外のポートで実行している場合、GitLab ユーザーの SSH 設定を変更する必要があります: {{hc|/var/lib/gitlab/.ssh/config|2= host localhost # Give your setup a name (here: override localhost) user gitlab # Your remote git user port 2222 # Your port number hostname 127.0.0.1; # Your server name or IP }} {{ic|/etc/webapps/gitlab/gitlab.yml}} ファイルのオプション (例: ssh_user, ssh_host, admin_uri) も変更してください。 === HTTPS/SSL === ==== GitLab 設定の変更 ==== {{ic|/etc/webapps/gitlab/shell.yml}} を修正して GitLab サイトを {{ic|https://}} から始まる URL に変えてください。{{ic|/etc/webapps/gitlab/gitlab.yml}} を修正して {{ic|https:}} を {{ic|true}} に設定してください。 ==== Let's Encrypt ==== URL を検証する際、Let's Encrypt は {{ic|<nowiki>https://gitlab.</nowiki>''YOUR_SERVER_FQDN''/.well-known/acme-challenge/''A_LONG_ID''}} のように gitlab サーバーにアクセスできるかどうか試行します。しかしながら、gitlab の設定によって、{{ic|gitlab.''YOUR_SERVER_FQDN''}} へのリクエストはプロキシ (gitlab-workhorse) に全て転送されるため、URL の確認が失敗します。 Let's Encrypt の webroot を使用することでこの問題を回避することが可能です。webroot を {{ic|/srv/http/letsencrypt/}} に設定してください。 さらに、Let's Encrypt の gitlab へのリクエストが全て webroot に転送されるように、以下の記述を追加します: {{hc|/etc/http/conf/extra/gitlab.conf| Alias "/.well-known" "/srv/http/letsencrypt/.well-known" RewriteCond %{REQUEST_URI} !/\.well-known/.* }} ===ウェブサーバーの設定=== Gitlab に組み込まれている http サーバー、Unicorn を使うかわりに別のウェブサーバーで Gitlab を使いたい場合、以下の手順に従ってください。 ===== Node.js ===== Node.js の http-master を使用することでポート 8080 で動作している GitLab アプリケーションにトラフィックを転送する http プロキシをポート 443 に設定することができます。ドメインの OpenSSL 鍵を作成して CA 証明書を取得 (もしくは自己署名) した後に、https://github.com/CodeCharmLtd/http-master を読んでください。HTTPS を使って GitLab にリクエストを転送する方法が載っています。http-master は [https://github.com/nodejitsu/node-http-proxy node-http-proxy] を元に作成されています。 ====Nginx と unicorn==== {{ic|/usr/share/doc/gitlab/nginx.conf.example}} または {{ic|/usr/share/doc/gitlab/nginx-ssl.conf.example}} を {{ic|/etc/nginx/servers-available/gitlab}} にコピーしてください。詳しくは [[Nginx#サーバーブロック]]を参照。 {{ic|/etc/nginx/servers-available/gitlab}} ファイルをアップデートして nginx のサービスを[[再起動]]してください。 認証できない場合、{{ic|/etc/nginx/servers-available/gitlab}} に以下のヘッダーを追加してください: proxy_set_header X-Forwarded-Ssl on; # Only when using SSL proxy_set_header X-Frame-Options SAMEORIGIN; ===== 別の設定例 ===== {{Note|{{ic|localhost:8080}} を gitlab のアドレスに {{ic|example.com}} をサーバーの名前に置き換える必要があります。}} {{Tip|SSL を有効にする前に [[Nginx#SSL]] を見てください。}} 以下の内容で {{ic|/etc/nginx/servers-available/gitlab}} ファイルを作成: {{hc|/etc/nginx/servers-available/gitlab|2= # Created by: Sameer Naik # Contributor: francoism90 # Source: https://gist.github.com/sameersbn/becd1c976c3dc4866ef8 upstream gitlab-workhorse { server unix:/run/gitlab/gitlab-workhorse.socket fail_timeout=0; } server { listen 80; #listen 443 ssl; # uncomment to enable ssl keepalive_timeout 70; server_name example.com server_tokens off; #ssl_certificate ssl/example.com.crt; #ssl_certificate_key ssl/example.com.key; charset utf-8; root /dev/null; # Increase this if you want to upload larger attachments client_max_body_size 20m; location / { proxy_read_timeout 300; proxy_connect_timeout 300; proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Ssl on; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Frame-Options SAMEORIGIN; proxy_pass http://gitlab-workhorse; } } }} ====Apache と unicorn==== [[公式リポジトリ]]から {{Pkg|apache}} を[[インストール]]してください。 =====Unicorn の設定===== 公式のインストールガイドに書かれているように、unicorn の設定ファイルをコピーしてください: # sudo -u git -H cp /usr/share/webapps/gitlab/config/unicorn.rb.example /usr/share/webapps/gitlab/config/unicorn.rb {{ic|config/unicorn.rb}} を編集し以下の行をアンコメントして listen ポートを追加します: listen "127.0.0.1:8080" {{Tip|カスタムポートを設定することもできます。Apache のバーチャルホストでも忘れずに設定してください。下を参照。}} =====Gitlab のバーチャルホストの作成===== Gitlab のバーチャルホストの設定ファイルを作成して以下の行を調整して挿入してください。ssl セクションについては [[LAMP#TLS/SSL]] を参照。SSL が必要ないときは、削除してください。SSL バーチャルホストは汎用の IP ではなく特定の IP を必要とします。Unicorn のカスタムポートを設定している場合、BalanceMember 行で忘れずに設定してください。 [https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/web-server/apache サンプル] を使って開始できます。 =====ホストの有効化と unicorn の起動===== Gitlab のバーチャルホストを有効化して [[Apache]] をリロード: {{hc|/etc/httpd/conf/httpd.conf| Include /etc/httpd/conf/extra/gitlab.conf}} Apache の {{ic|gitlab.conf}} ファイルをコピー: # cp /usr/share/doc/gitlab/apache.conf.example /etc/httpd/conf/extra/gitlab.conf 最後に {{ic|gitlab-unicorn.service}} を[[起動]]してください。 === Gitlab-workhorse === 8.0 から GitLab は Git の push/pull などの巨大な HTTP リクエスト用に特別な HTTP サーバー {{Pkg|gitlab-workhorse}} を使用しています。SSH の代わりに workhorse を使いたい場合、{{ic|gitlab-workhorse.service}} を有効化してウェブサーバーを設定してください。GitLab チームによれば {{ic|gitlab-unicorn}} よりも {{Pkg|gitlab-workhorse}} を使用することが推奨されています: https://gitlab.com/gitlab-org/gitlab-ce/issues/22528#note_16036216 。 {{Note|Unicorn が不要になるわけではないので {{ic|gitlab-unicorn.service}} を無効化・停止してはいけません。Unicorn が使用するポートを変更している場合、{{ic|gitlab-workhorse.service}} の {{ic|-authBackend}} 設定を適宜変更してください。}} デフォルトでは {{Pkg|gitlab-workhorse}} は {{ic|/run/gitlab/gitlab-workhorse.socket}} を listen します。{{ic|gitlab-workhorse.service}} を編集して {{ic|-listenAddr}} パラメータを変更することで指定したアドレスを listen するようになります (例: {{ic|-listenAddr 127.0.0.1:8181}})。アドレスを listen する場合、ネットワークタイプを {{ic|-listenNetwork tcp}} に設定する必要があります。 nginx を使用している場合、nginx の設定ファイルも忘れずに編集してください。gitlab-unicorn から gitlab-workhorse に切り替えるには以下の設定を編集します: {{hc|/etc/nginx/servers-available/gitlab|2= upstream gitlab { server unix:/run/gitlab/gitlab-workhorse.socket fail_timeout=0; } ... proxy_pass http://unix:/run/gitlab/gitlab-workhorse.socket; } } }} ==便利なヒント== ===Rake の警告の修正=== gitlab プロジェクトで rake タスクを実行すると、次のエラーが発生します: {{ic|fatal: Not a git repository (or any of the parent directories): .git}}。これは bundle のバグなので、無視してもかまいません。エラーを消したい場合は、以下を実行してください: {{bc|1= # cd /usr/share/webapps/gitlab # sudo -u gitlab git init # sudo -u gitlab git commit -m "initial commit" --allow-empty }} ===/var のフック=== {{bc|1= # mkdir -m700 /var/log/gitlab /var/tmp/gitlab # chown gitlab:gitlab /var/log/gitlab /var/tmp/gitlab # sudo -u gitlab -i # cd ~/gitlab # d=log; mv $d/* /var/$d/gitlab; rm -f $d/.gitkeep; rm -r $d && ln -s /var/$d/gitlab $d # d=tmp; mv $d/* /var/$d/gitlab; rm -f $d/.gitkeep; rm -r $d && ln -s /var/$d/gitlab $d }} ===隠しオプション=== Gitlab のホームディレクトリに移動して: # cd /usr/share/webapps/gitlab 次を実行: {{hc|<nowiki># rake -T | grep gitlab</nowiki>|<nowiki> rake gitlab:app:check # GITLAB | Check the configuration of the GitLab Rails app rake gitlab:backup:create # GITLAB | Create a backup of the GitLab system rake gitlab:backup:restore # GITLAB | Restore a previously created backup rake gitlab:check # GITLAB | Check the configuration of GitLab and its environment rake gitlab:cleanup:block_removed_ldap_users # GITLAB | Cleanup | Block users that have been removed in LDAP rake gitlab:cleanup:dirs # GITLAB | Cleanup | Clean namespaces rake gitlab:cleanup:repos # GITLAB | Cleanup | Clean repositories rake gitlab:env:check # GITLAB | Check the configuration of the environment rake gitlab:env:info # GITLAB | Show information about GitLab and its environment rake gitlab:generate_docs # GITLAB | Generate sdocs for project rake gitlab:gitlab_shell:check # GITLAB | Check the configuration of GitLab Shell rake gitlab:import:all_users_to_all_groups # GITLAB | Add all users to all groups (admin users are added as owners) rake gitlab:import:all_users_to_all_projects # GITLAB | Add all users to all projects (admin users are added as masters) rake gitlab:import:repos # GITLAB | Import bare repositories from gitlab_shell -> repos_path into GitLab project instance rake gitlab:import:user_to_groups[email] # GITLAB | Add a specific user to all groups (as a developer) rake gitlab:import:user_to_projects[email] # GITLAB | Add a specific user to all projects (as a developer) rake gitlab:satellites:create # GITLAB | Create satellite repos rake gitlab:setup # GITLAB | Setup production application rake gitlab:shell:build_missing_projects # GITLAB | Build missing projects rake gitlab:shell:install[tag,repo] # GITLAB | Install or upgrade gitlab-shell rake gitlab:shell:setup # GITLAB | Setup gitlab-shell rake gitlab:sidekiq:check # GITLAB | Check the configuration of Sidekiq rake gitlab:test # GITLAB | Run all tests rake gitlab:web_hook:add # GITLAB | Adds a web hook to the projects rake gitlab:web_hook:list # GITLAB | List web hooks rake gitlab:web_hook:rm # GITLAB | Remove a web hook from the projects rake setup # GITLAB | Setup gitlab db </nowiki>}} ===バックアップとリストア=== gitlab システムのバックアップを作成: # sudo -u gitlab -H rake RAILS_ENV=production gitlab:backup:create 先に作成したバックアップファイル {{ic|/home/gitlab/gitlab/tmp/backups/20130125_11h35_1359131740_gitlab_backup.tar}} をリストア: # sudo -u gitlab -H rake RAILS_ENV=production gitlab:backup:restore BACKUP=/home/gitlab/gitlab/tmp/backups/20130125_11h35_1359131740 {{Note|バックアップフォルダは {{ic|config/gitlab.yml}} に設定されています。GitLab のバックアップとリストアについては [https://github.com/gitlabhq/gitlabhq/blob/master/doc/raketasks/backup_restore.md こちら] に記載があります。}} ===sqlite から mysql への移行=== 最新のコードを取得してください。 データを保存: # cd /home/gitlab/gitlab # sudo -u gitlab bundle-2.3 exec rake db:data:dump RAILS_ENV=production [[#Mysql]] の手順に従ってデータベースをセットアップ: # sudo -u gitlab bundle-2.3 exec rake db:setup RAILS_ENV=production 最後にデータをリストア: # sudo -u gitlab bundle-2.3 exec rake db:data:load RAILS_ENV=production ===rvm で GitLab を実行=== rvm で gitlab を実行するにはまず rvm をセットアップしてください: curl -L https://get.rvm.io | bash -s stable --ruby=1.9.3 {{Note|互換問題を避けるためにバージョン 1.9.3 を使用することが現在推奨されています。}} 完全にインストールするためにユーザーを変更 (例: {{ic|git}}) して rvm を有効化してください: su - git source "$HOME/.rvm/scripts/rvm" それから上のインストール手順に従ってください。ただし、rvm 環境が有効にならないため systemd スクリプトが上手く動きません。{{ic|unicorn}} と {{ic|sidekiq}} のシェルスクリプトを作成して環境を有効にしてサービスを起動させることを推奨します: {{hc|gitlab.sh|<nowiki> #!/bin/sh source `/home/git/.rvm/bin/rvm 1.9.3 do rvm env --path` bundle-2.3 exec "unicorn_rails -c /usr/share/webapps/gitlab/config/unicorn.rb -E production"</nowiki> }} {{hc|sidekiq.sh|<nowiki> #!/bin/sh source `/home/git/.rvm/bin/rvm 1.9.3 do rvm env --path` case $1 in start) bundle-2.3 exec rake sidekiq:start RAILS_ENV=production ;; stop) bundle-2.3 exec rake sidekiq:stop RAILS_ENV=production ;; *) echo "Usage $0 {start|stop}" esac </nowiki>}} それから上記の systemd ファイルを編集してスクリプトが使われるようにしてください。以下の行を修正します: {{hc|gitlab.service|<nowiki> ExecStart=/home/git/bin/gitlab.sh </nowiki>}} {{hc|sidekiq.service|<nowiki> ExecStart=/home/git/bin/sidekiq.sh start ExecStop=/home/git/bin/sidekiq.sh stop </nowiki>}} ===SMTP を使って Gitlab からメールを送信=== gitlab サーバーから gmail (あるいは他のメールサービス) を使ってメールを送信することができます。これにより、gitlab サーバーにメールデーモンをインストールする手間が省けます。 メールサーバーの設定にあわせて {{ic|smtp_settings.rb}} を修正してください: {{hc|/usr/share/webapps/gitlab/config/initializers/smtp_settings.rb|<nowiki> if Rails.env.production? Gitlab::Application.config.action_mailer.delivery_method = :smtp Gitlab::Application.config.action_mailer.smtp_settings = { address: 'smtp.gmail.com', port: 587, domain: 'gmail.com', user_name: 'username@gmail.com', password: 'application password', authentication: 'plain', enable_starttls_auto: true } end</nowiki>}} Gmail はメールの受信を拒否します (拒否した旨のメールが届きます)。セキュア認証を無効化する必要があります (拒否メールのリンクに従ってください)。セキュアな方法としては username@gmail.com の2段階認証を有効にして設定ファイルにアプリケーションパスワードを設定する方法があります。 ==トラブルシューティング== ときどき GitLab が上手く動作しないことがあります。[https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide Trouble Shooting Guide] を確認してください。 === HTTPS が緑じゃない (gravatar が https を使わない) === Redis は gravatar の画像をキャッシュするため、http で GitLab にアクセスした後に https を有効にすると、gravatar がセキュアでない画像をロードしてしまいます。gitlab ユーザーで以下を実行することでキャッシュの消去が可能です: cd /usr/share/webapps/gitlab RAILS_ENV=production bundle-2.3 exec rake cache:clear === API アクセス時に 401 Unauthorized === {{ic|/etc/webapps/gitlab/secret}} と {{ic|/etc/webapps/gitlab-shell/secret}} のファイルに中身があるか確認してください。 === push 時に bad line length character: API というエラーが発生する === push しようとすると以下のエラーが表示される場合: fatal: protocol error: bad line length character: API {{ic|/etc/webapps/gitlab-shell/secret}} と {{ic|/usr/share/webapps/gitlab/.gitlab_shell_secret}} が一致していることを確認してください。 一致していない場合、以下のコマンドでファイルを再作成してください: # ln -s /etc/webapps/gitlab-shell/secret /usr/share/webapps/gitlab/.gitlab_shell_secret === アップデート後のエラー === AUR からパッケージを更新したとき、データベースの移行やアセットのアップデートに失敗することがあります。再起動で問題が解決しない場合、以下の方法を試してみてください。 まず、gitlab のインストールディレクトリに移動: # cd /usr/share/webapps/gitlab 全ての gitlab ページが500エラーを返す場合、データベースの移行やアセットが古くなっている可能性があります。そうでない場合、以下のコマンドはスキップしてください。 # su - gitlab -s /bin/sh -c "cd '/usr/share/webapps/gitlab'; bundle-2.3 exec rake db:migrate RAILS_ENV=production" gitlab のデプロイが永遠に完了しない場合、アセットが再コンパイルされていない可能性があります: # su - gitlab -s /bin/sh -c "cd '/usr/share/webapps/gitlab'; bundle-2.3 exec rake gitlab:assets:clean gitlab:assets:compile cache:clear RAILS_ENV=production" 最後に、gitlab サービスを再起動してサイトをテストしてください: # systemctl restart gitlab-unicorn gitlab-sidekiq gitlab-workhorse === /etc/webapps/gitlab/secret が空 === 通常は {{Pkg|gitlab-shell}} と {{Pkg|gitlab}} パッケージのインストール時に生成されますが、生成されなかった場合、手動で生成する必要があります: # hexdump -v -n 64 -e '1/1 "%02x"' /dev/urandom > /etc/webapps/gitlab-shell/secret # chown root:gitlab /etc/webapps/gitlab-shell/secret # chmod 640 /etc/webapps/gitlab-shell/secret # hexdump -v -n 64 -e '1/1 "%02x"' /dev/urandom > /etc/webapps/gitlab/secret # chown root:gitlab /etc/webapps/gitlab/secret # chmod 640 /etc/webapps/gitlab/secret ==参照== *[https://docs.gitlab.com/ce/install/installation.html 公式インストールドキュメント] *[https://gitlab.com/gitlab-org/gitlab-recipes GitLab recipes with further documentation on running it with several web servers] *[https://gitlab.com/gitlab-org/gitlab-ce GitLab ソースコード]
このページで使用されているテンプレート:
テンプレート:Bc
(
ソースを閲覧
)
テンプレート:Hc
(
ソースを閲覧
)
テンプレート:Ic
(
ソースを閲覧
)
テンプレート:META Related articles start
(
ソースを閲覧
)
テンプレート:Note
(
ソースを閲覧
)
テンプレート:Pkg
(
ソースを閲覧
)
テンプレート:Related
(
ソースを閲覧
)
テンプレート:Related articles end
(
ソースを閲覧
)
テンプレート:Related articles start
(
ソースを閲覧
)
テンプレート:Tip
(
ソースを閲覧
)
GitLab
に戻る。
検索
検索
GitLabのソースを表示
話題を追加