Commit 8480bfcc authored by Evan Read's avatar Evan Read

Merge branch 'smh-remove-default-gitaly' into 'master'

Configure Praefect as the default storage in docs

See merge request gitlab-org/gitlab!35964
parents 926eb53d 7d98bbca
...@@ -103,7 +103,7 @@ GitLab](https://about.gitlab.com/install/). ...@@ -103,7 +103,7 @@ GitLab](https://about.gitlab.com/install/).
You will need the IP/host address for each node. You will need the IP/host address for each node.
1. `LOAD_BALANCER_SERVER_ADDRESS`: the IP/hots address of the load balancer 1. `LOAD_BALANCER_SERVER_ADDRESS`: the IP/host address of the load balancer
1. `POSTGRESQL_SERVER_ADDRESS`: the IP/host address of the PostgreSQL server 1. `POSTGRESQL_SERVER_ADDRESS`: the IP/host address of the PostgreSQL server
1. `PRAEFECT_HOST`: the IP/host address of the Praefect server 1. `PRAEFECT_HOST`: the IP/host address of the Praefect server
1. `GITALY_HOST`: the IP/host address of each Gitaly server 1. `GITALY_HOST`: the IP/host address of each Gitaly server
...@@ -281,9 +281,15 @@ application server, or a Gitaly node. ...@@ -281,9 +281,15 @@ application server, or a Gitaly node.
1. Configure the **Praefect** cluster to connect to each Gitaly node in the 1. Configure the **Praefect** cluster to connect to each Gitaly node in the
cluster by editing `/etc/gitlab/gitlab.rb`. cluster by editing `/etc/gitlab/gitlab.rb`.
In the example below we have configured one virtual storage (or shard) named The virtual storage's name must match the configured storage name in GitLab
`storage-1`. This cluster has three Gitaly nodes `gitaly-1`, `gitaly-2`, and configuration. In a later step, we configure the storage name as `default`
`gitaly-3`, which will be replicas of each other. so we use `default` here as well. This cluster has three Gitaly nodes `gitaly-1`,
`gitaly-2`, and `gitaly-3`, which will be replicas of each other.
CAUTION: **CAUTION:** If you have data on an already existing storage called
`default`, you should configure the virtual storage with another name and
[migrate the data to the Praefect storage](#migrating-existing-repositories-to-praefect)
afterwards.
Replace `PRAEFECT_INTERNAL_TOKEN` with a strong secret, which will be used by Replace `PRAEFECT_INTERNAL_TOKEN` with a strong secret, which will be used by
Praefect when communicating with Gitaly nodes in the cluster. This token is Praefect when communicating with Gitaly nodes in the cluster. This token is
...@@ -302,7 +308,7 @@ application server, or a Gitaly node. ...@@ -302,7 +308,7 @@ application server, or a Gitaly node.
# Name of storage hash must match storage name in git_data_dirs on GitLab # Name of storage hash must match storage name in git_data_dirs on GitLab
# server ('praefect') and in git_data_dirs on Gitaly nodes ('gitaly-1') # server ('praefect') and in git_data_dirs on Gitaly nodes ('gitaly-1')
praefect['virtual_storages'] = { praefect['virtual_storages'] = {
'storage-1' => { 'default' => {
'gitaly-1' => { 'gitaly-1' => {
'address' => 'tcp://GITALY_HOST:8075', 'address' => 'tcp://GITALY_HOST:8075',
'token' => 'PRAEFECT_INTERNAL_TOKEN', 'token' => 'PRAEFECT_INTERNAL_TOKEN',
...@@ -555,6 +561,16 @@ Particular attention should be shown to: ...@@ -555,6 +561,16 @@ Particular attention should be shown to:
external_url 'GITLAB_SERVER_URL' external_url 'GITLAB_SERVER_URL'
``` ```
1. Disable the default Gitaly service running on the GitLab host. It won't be needed
as GitLab will connect to the configured cluster.
CAUTION: **CAUTION** If you have existing data stored on the default Gitaly storage,
you should [migrate the data your Praefect storage first](#migrating-existing-repositories-to-praefect).
```ruby
gitaly['enable'] = false
```
1. Add the Praefect cluster as a storage location by editing 1. Add the Praefect cluster as a storage location by editing
`/etc/gitlab/gitlab.rb`. `/etc/gitlab/gitlab.rb`.
...@@ -562,28 +578,17 @@ Particular attention should be shown to: ...@@ -562,28 +578,17 @@ Particular attention should be shown to:
- `LOAD_BALANCER_SERVER_ADDRESS` with the IP address or hostname of the load - `LOAD_BALANCER_SERVER_ADDRESS` with the IP address or hostname of the load
balancer. balancer.
- `GITLAB_HOST` with the IP address or hostname of the GitLab server
- `PRAEFECT_EXTERNAL_TOKEN` with the real secret - `PRAEFECT_EXTERNAL_TOKEN` with the real secret
```ruby ```ruby
git_data_dirs({ git_data_dirs({
"default" => { "default" => {
"gitaly_address" => "tcp://GITLAB_HOST:8075"
},
"storage-1" => {
"gitaly_address" => "tcp://LOAD_BALANCER_SERVER_ADDRESS:2305", "gitaly_address" => "tcp://LOAD_BALANCER_SERVER_ADDRESS:2305",
"gitaly_token" => 'PRAEFECT_EXTERNAL_TOKEN' "gitaly_token" => 'PRAEFECT_EXTERNAL_TOKEN'
} }
}) })
``` ```
1. Allow Gitaly to listen on a TCP port by editing
`/etc/gitlab/gitlab.rb`
```ruby
gitaly['listen_addr'] = '0.0.0.0:8075'
```
1. Configure the `gitlab_shell['secret_token']` so that callbacks from Gitaly 1. Configure the `gitlab_shell['secret_token']` so that callbacks from Gitaly
nodes during a `git push` are properly authenticated by editing nodes during a `git push` are properly authenticated by editing
`/etc/gitlab/gitlab.rb`: `/etc/gitlab/gitlab.rb`:
...@@ -632,14 +637,6 @@ Particular attention should be shown to: ...@@ -632,14 +637,6 @@ Particular attention should be shown to:
gitlab-ctl reconfigure gitlab-ctl reconfigure
``` ```
1. To ensure that Gitaly [has updated its Prometheus listen
address](https://gitlab.com/gitlab-org/gitaly/-/issues/2734), [restart
Gitaly](../restart_gitlab.md#omnibus-gitlab-restart):
```shell
gitlab-ctl restart gitaly
```
1. Verify each `gitlab-shell` on each Gitaly instance can reach GitLab. On each Gitaly instance run: 1. Verify each `gitlab-shell` on each Gitaly instance can reach GitLab. On each Gitaly instance run:
```shell ```shell
...@@ -652,16 +649,11 @@ Particular attention should be shown to: ...@@ -652,16 +649,11 @@ Particular attention should be shown to:
gitlab-rake gitlab:gitaly:check gitlab-rake gitlab:gitaly:check
``` ```
1. Update the **Repository storage** settings from **Admin Area > Settings > 1. Check in **Admin Area > Settings > Repository > Repository storage** that the Praefect storage
Repository > Repository storage** to make the newly configured Praefect is configured to store new repositories. Following this guide, the `default` storage should have
cluster the storage location for new Git repositories. weight 100 to store all new repositories.
- The default weight is 0.
- The Praefect weight is 100.
![Update repository storage](img/praefect_storage_v13_1.png)
1. Verify everything is still working by creating a new project. Check the 1. Verify everything is working by creating a new project. Check the
"Initialize repository with a README" box so that there is content in the "Initialize repository with a README" box so that there is content in the
repository that viewed. If the project is created, and you can see the repository that viewed. If the project is created, and you can see the
README file, it works! README file, it works!
...@@ -790,12 +782,15 @@ The Praefect `dataloss` sub-command helps identify lost writes by checking for u ...@@ -790,12 +782,15 @@ The Praefect `dataloss` sub-command helps identify lost writes by checking for u
```shell ```shell
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dataloss [-virtual-storage <virtual-storage>] sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dataloss [-virtual-storage <virtual-storage>]
```
If the virtual storage is not specified, every configured virtual storage is checked for data loss. If the virtual storage is not specified, every configured virtual storage is checked for data loss.
```shell ```shell
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dataloss sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dataloss
```
```shell
Virtual storage: default Virtual storage: default
Current read-only primary: gitaly-2 Current read-only primary: gitaly-2
Previous write-enabled primary: gitaly-1 Previous write-enabled primary: gitaly-1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment