About load balancers
ロードバランサの設計では、ネットワークデバイスを使ってGit及びHTTPのトラフィックを個々のGitHub Enterprise Serverアプライアンスに向かわせます。 ロードバランサを使って、セキュリティのためにアプライアンスへの直接のトラフィックを制限したり、必要に応じてDNSのレコードを変更することなくトラフィックをリダイレクトしたりできます。 PROXYプロトコルをサポートするTCPベースのロードバランサを使うことを強くおすすめします。
GitHub Enterprise Serverのホスト名に対するDNSルックアップは、ロードバランサに解決されなければなりません。 Subdomain Isolationを有効化することをおすすめします。 Subdomain Isolationが有効化されている場合、追加のワイルドカードレコード(*.HOSTNAME
)もロードバランサに解決されなければなりません。 詳しい情報については"Subdomain Isolationの有効化"を参照してください。
クライアントの接続情報の処理
GitHub Enterprise Server へのクライアント接続はロードバランサから来ることになるため、クライアントの IP アドレスは失われることがあります。
使用しているロードバランサがサポートできるなら、PROXYプロトコルの利用を強くおすすめします。 PROXYサポートが利用できない場合でも、X-Forwarded-For
ヘッダを使ってHTTP及びHTTPSポートをロードバランスできます。
セキュリティの警告: PROXY サポートあるいは HTTP フォワーディングが有効化されている場合、外部のトラフィックが直接 GitHub Enterprise Server アプライアンスに到達できないことが重要です。 外部トラフィックが適切にブロックされていない場合、ソース IP アドレスが偽造されるかもしれません。
警告: HTTPS 接続をロードバランサでターミネートしている場合、ロードバランサからの GitHub Enterprise Server へのリクエストも HTTPS を使わなければなりません。 接続の HTTP へのダウングレードはサポートされません。
GitHub Enterprise ServerインスタンスでのPROXYプロトコルサポートの有効化
We strongly recommend enabling PROXY protocol support for both your instance and the load balancer. ロードバランサでPROXYプロトコルを有効化する方法については、ベンダーが提供する指示に従ってください。 詳しい情報についてはPROXY プロトコルのドキュメンテーションを参照してください。
Note: GitHub Enterprise Server supports PROXY Protocol V1, which is incompatible with AWS Network Load Balancers. If you use AWS Network Load Balancers with GitHub Enterprise Server, do not enable PROXY support.
-
From an administrative account on GitHub Enterprise Server, in the upper-right corner of any page, click .
-
If you're not already on the "Site admin" page, in the upper-left corner, click Site admin.
-
左のサイドバーでManagement Consoleをクリックしてください。
-
左のサイドバーでPrivacy(プライバシー)をクリックしてください。
-
External load balancers(外部ロードバランサ)の下でEnable support for PROXY protocol(PROXYプロトコルサポートの有効化)を選択してください。
-
左のサイドバーの下でSave settings(設定の保存)をクリックしてください。
Note: Saving settings in the Management Console restarts system services, which could result in user-visible downtime.
-
設定が完了するのを待ってください。
PROXYプロトコルのTCPポートマッピング
送信元ポート | 宛先ポート | サービスの説明 |
---|---|---|
22 | 23 | Git over SSH |
80 | 81 | HTTP |
443 | 444 | HTTPS |
8080 | 8081 | Management Console HTTP |
8443 | 8444 | Management Console HTTPS |
9418 | 9419 | Git |
GitHub Enterprise ServerインスタンスでのX-Forwarded-Forサポートの有効化
PROXYプロトコルが利用できないときにかぎりX-Forwarded-Forプロトコルを利用してください。 X-Forwarded-For
は、HTTP及びHTTPSでのみ動作します。 SSH経由のGit接続で示されるIPアドレスは、ロードバランサのIPを示します。
Warning: If you configure X-Forwarded-For
support on GitHub Enterprise Serverインスタンス and load balancer, you may not be able to connect to the Management Console. For more information, see "Error: "Your session has expired" for connections to the Management Console."
-
From an administrative account on GitHub Enterprise Server, in the upper-right corner of any page, click .
-
If you're not already on the "Site admin" page, in the upper-left corner, click Site admin.
-
左のサイドバーでManagement Consoleをクリックしてください。
-
左のサイドバーでPrivacy(プライバシー)をクリックしてください。
-
External load balancers(外部ロードバランサ)の下でAllow HTTP X-Forwarded-For header(HTTP X-Forwarded-Forヘッダの許可)を選択してください。
-
左のサイドバーの下でSave settings(設定の保存)をクリックしてください。
Note: Saving settings in the Management Console restarts system services, which could result in user-visible downtime.
-
設定が完了するのを待ってください。
PROXYサポートなしで使うプロトコルのTCPポートマッピング
送信元ポート | 宛先ポート | サービスの説明 |
---|---|---|
22 | 22 | Git over SSH |
25 | 25 | SMTP |
80 | 80 | HTTP |
443 | 443 | HTTPS |
8080 | 8080 | Management Console HTTP |
8443 | 8443 | Management Console HTTPS |
健全性チェックの設定
ロードバランサは健全性チェックによって、事前に設定されたチェックが失敗するようになったノードがあれば、反応しなくなったノードへのトラフィックの送信を止めます。 If the instance is offline due to maintenance or unexpected failure, the load balancer can display a status page. High Availability(HA)設定では、ロードバランサはフェイルオーバーの戦略の一部として利用できます。 ただし、HAペアの自動フェイルオーバーはサポートされていません。 You must manually promote the replica instance before it will begin serving requests. 詳細は「High Availability 用に GitHub Enterprise Server を設定する」を参照してください。
以下のURLのいずれかをチェックするようにロードバランサを設定してください。
https://HOSTNAME/status
HTTPSが有効な場合(デフォルト)http://HOSTNAME/status
HTTPSが無効な場合
ノードが健全でエンドユーザーからのリクエストに応えられる場合、このチェックにはステータスコード200
(OK)が返されます。
ノート: アプライアンスがメンテナンスモードの場合、https://HOSTNAME/status
のURLはステータスコード503
(Service Unavailable)を返します。 詳しい情報については"メンテナンスモードの有効化とスケジューリング"を参照してください。
Troubleshooting connectivity through a load balancer
If you cannot connect to services on GitHub Enterprise Serverインスタンス through a load balancer, you can review the following information to troubleshoot the problem.
Note: Always test changes to your network infrastructure and instance configuration in a staging environment. 詳しい情報については "ステージングインスタンスのセットアップ"を参照してください。
Error: "Your session has expired" for connections to the Management Console
If you enable support for the X-Forwarded-For
header on your instance and load balancer, you may not be able to access your instance's Management Console. For more information about the Management Console and ports required for connections, see "Accessing the management console" and "Network ports."
If GitHub Enterprise Serverインスタンス indicates that your session has expired when you connect to the Management Console through a load balancer, try one of the following configurations on your load balancer.
- Disable
X-Forwarded-For
headers for connections to your instance on ports 8080 and 8443. - Configure your load balancer to operate on Layer 4, and use the PROXY protocol instead of
X-Forwarded-For
for passthrough of client IP addresses. For more information, see "Enabling PROXY protocol support on GitHub Enterprise Serverインスタンス ."
For more information, refer to the documentation for your load balancer.