Commit bd018536 authored by Evan Read's avatar Evan Read Committed by Nick Gaskill

Add process for moving repos

parent 04c210b0
...@@ -379,7 +379,7 @@ application server, or a Gitaly node. ...@@ -379,7 +379,7 @@ application server, or a Gitaly node.
CAUTION: **Caution:** CAUTION: **Caution:**
If you have data on an already existing storage called If you have data on an already existing storage called
`default`, you should configure the virtual storage with another name and `default`, you should configure the virtual storage with another name and
[migrate the data to the Praefect storage](#migrating-existing-repositories-to-praefect) [migrate the data to the Gitaly Cluster storage](#migrate-existing-repositories-to-gitaly-cluster)
afterwards. 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
...@@ -802,7 +802,8 @@ Particular attention should be shown to: ...@@ -802,7 +802,8 @@ Particular attention should be shown to:
CAUTION: **Caution:** CAUTION: **Caution:**
If you have existing data stored on the default Gitaly storage, 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). you should [migrate the data your Gitaly Cluster storage](#migrate-existing-repositories-to-gitaly-cluster)
first.
```ruby ```ruby
gitaly['enable'] = false gitaly['enable'] = false
...@@ -1230,17 +1231,30 @@ The command will return a list of repositories that were found to be ...@@ -1230,17 +1231,30 @@ The command will return a list of repositories that were found to be
inconsistent against the current primary. Each of these inconsistencies will inconsistent against the current primary. Each of these inconsistencies will
also be logged with an accompanying replication job ID. also be logged with an accompanying replication job ID.
## Migrating existing repositories to Praefect ## Migrate existing repositories to Gitaly Cluster
If your GitLab instance already has repositories, these won't be migrated If your GitLab instance already has repositories on single Gitaly nodes, these aren't migrated to
automatically. Gitaly Cluster automatically.
Repositories may be moved from one storage location using the [Project repository storage moves API](../../api/project_repository_storage_moves.md): Repositories may be moved from one storage location using the [Project repository storage moves API](../../api/project_repository_storage_moves.md):
```shell To move repositories to Gitaly Cluster:
curl --request POST --header "Private-Token: <your_access_token>" --header "Content-Type: application/json" \
--data '{"destination_storage_name":"praefect"}' "https://gitlab.example.com/api/v4/projects/123/repository_storage_moves" 1. [Schedule a move](../../api/project_repository_storage_moves.md#schedule-a-repository-storage-move-for-a-project)
``` for the first repository using the API. For example:
```shell
curl --request POST --header "Private-Token: <your_access_token>" --header "Content-Type: application/json" \
--data '{"destination_storage_name":"praefect"}' "https://gitlab.example.com/api/v4/projects/123/repository_storage_moves"
```
1. Using the ID that is returned, [query the repository move](../../api/project_repository_storage_moves.md#get-a-single-repository-storage-move-for-a-project)
using the API. The query indicates either:
- The move has completed successfully. The `state` field is `finished`.
- The move is in progress. Re-query the repository move until it completes successfully.
- The move has failed. Most failures are temporary and are solved by rescheduling the move.
1. Once the move is successful, repeat these steps for all repositories for your projects.
## Debugging Praefect ## Debugging Praefect
......
...@@ -9,8 +9,22 @@ type: reference ...@@ -9,8 +9,22 @@ type: reference
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31285) in GitLab 13.0. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31285) in GitLab 13.0.
Project repository storage can be moved. To retrieve project repository storage moves using the API, Project repositories can be moved between storages. This can be useful when
you must [authenticate yourself](README.md#authentication) as an administrator. [migrating to Gitaly Cluster](../administration/gitaly/praefect.md#migrate-existing-repositories-to-gitaly-cluster),
for example.
As project repository storage moves are processed, they transition through different states. Values
of `state` are:
- `initial`
- `scheduled`
- `started`
- `finished`
- `failed`
- `replicated`
- `cleanup_failed`
This API requires you to [authenticate yourself](README.md#authentication) as an administrator.
## Retrieve all project repository storage moves ## Retrieve all project repository storage moves
......
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