About configuration for repository caching
リポジトリ キャッシュと呼ばれる特殊な種類のレプリカを作成することで、リポジトリ キャッシュを構成できます。 Then, you can set data location policies that govern which repository networks are replicated to the repository cache.
Repository caching is not supported with clustering.
DNS for repository caches
The primary instance and repository cache should have different DNS names. For example, if your primary instance is at github.example.com
, you might decide to name a cache europe-ci.github.example.com
or github.asia.example.com
.
To have your CI machines fetch from the repository cache instead of the primary instance, you can use Git's url.<base>.insteadOf
configuration setting. For more information, see git-config
in the Git documentation.
For example, the global .gitconfig
for the CI machine would include these lines.
[url "https://europe-ci.github.example.com/"]
insteadOf = https://github.example.com/
Then, when told to fetch https://github.example.com/myorg/myrepo
, Git will instead fetch from https://europe-ci.github.example.com/myorg/myrepo
.
Configuring a repository cache
-
Set up a new GitHub Enterprise Server instance on your desired platform. This instance will be your repository cache. For more information, see "GitHub Enterprise Server インスタンスをセットアップする."
-
プライマリアプライアンス上のパスワードと一致する管理者パスワードを設定して続行します。
-
[レプリカとして構成] をクリックします。
-
"Add new SSH key(新しいSSH鍵の追加)"の下でSSH鍵を入力してください。
-
[キーの追加] をクリックします。
-
Connect to the repository cache's IP address using SSH.
ssh -p 122 admin@REPLICA-IP
-
レプリケーション用のキーの組を生成するには、プライマリ アプライアンスの IP アドレスを指定して
ghe-repl-setup
コマンドを使用し、それが返す公開キーをコピーします。ghe-repl-setup PRIMARY_IP
-
プライマリ アプライアンスの承認されたキーのリストに公開キーを追加するには、
https://PRIMARY-HOSTNAME/setup/settings
を参照して、レプリカからコピーしたキーをリストに追加します。 -
To verify the connection to the primary and enable replica mode for the repository cache, run
ghe-repl-setup
again.-
If the repository cache is your only additional node, no arguments are required.
ghe-repl-setup PRIMARY-IP
-
If you're configuring a repository cache in addition to one or more existing replicas, use the
-a
or--add
argument.ghe-repl-setup -a PRIMARY-IP
-
-
To configure the repository cache, use the
ghe-repl-node
command and include the necessary parameters.-
Set a
cache-location
for the repository cache, replacing CACHE-LOCATION with an alphanumeric identifier, such as the region where the cache is deployed. The CACHE-LOCATION value must not be any of the subdomains reserved for use with subdomain isolation, such asassets
ormedia
. For a list of reserved names, see "Subdomain Isolationの有効化." -
Set a
cache-domain
for the repository cache, replacing EXTERNAL-CACHE-DOMAIN with the hostname Git clients will use to access the repository cache. If you do not specify acache-domain
, GitHub Enterprise Server will prepend the CACHE-LOCATION value as a subdomain to the hostname configured for your instance. For more information, see "ホスト名の設定." -
If you haven't already, set the datacenter name on the primary and any replica appliances, replacing DC-NAME with a datacenter name.
ghe-repl-node --datacenter DC-NAME
-
New caches will attempt to seed from another cache in the same datacenter. Set a
datacenter
for the repository cache, replacing REPLICA-DC-NAME with the name of the datacenter where you're deploying the node.
ghe-repl-node --cache CACHE-LOCATION --cache-domain EXTERNAL-CACHE-DOMAIN --datacenter REPLICA-DC-NAME
-
-
データ ストアのレプリケーションを開始するには、
ghe-repl-start
コマンドを使います。ghe-repl-start
警告:
ghe-repl-start
を実行すると、プライマリ サーバーを短時間使えなくなり、その間、ユーザーには内部サーバー エラーが表示されることがあります。 もっとわかりやすいメッセージを表示するには、ghe-repl-start
をレプリカ ノードで実行する前にプライマリ ノード上でghe-maintenance -s
を実行し、アプライアンスをメンテナンス モードにします。 レプリケーションを開始したら、ghe-maintenance -u
を使ってメンテナンス モードを無効にします。 プライマリ ノードがメンテナンス モードの間、Git レプリケーションは進行しません。 -
各データストアのレプリケーション チャネルの状態を確認するには、
ghe-repl-status
コマンドを使用します。ghe-repl-status
-
To enable replication of repository networks to the repository cache, set a data location policy. For more information, see "Data location policies."
Data location policies
You can control data locality by configuring data location policies for your repositories with the spokesctl cache-policy
command. Data location policies determine which repository networks are replicated on which repository caches. By default, no repository networks will be replicated on any repository caches until a data location policy is configured.
Data location policies affect only Git content. Content in the database, such as issues and pull request comments, will be replicated to all nodes regardless of policy.
Note: Data location policies are not the same as access control. You must use repository roles to control which users may access a repository. For more information about repository roles, see "Organizationのリポジトリロール."
You can configure a policy to replicate all networks with the --default
flag. For example, this command will create a policy to replicate a single copy of every repository network to the set of repository caches whose cache_location
is "kansas".
ghe-spokesctl cache-policy set --default 1 kansas
To configure replication for a repository network, specify the repository that is the root of the network. A repository network includes a repository and all of the repository's forks. You cannot replicate part of a network without replicating the whole network.
ghe-spokesctl cache-policy set <owner/repository> 1 kansas
You can override a policy that replicates all networks and exclude specific networks by specifying a replica count of zero for the network. For example, this command specifies that any repository cache in location "kansas" cannot contain any copies of that network.
ghe-spokesctl cache-policy set <owner/repository> 0 kansas
Replica counts greater than one in a given cache location are not supported.