Commit c732561d authored by Nick Gaskill's avatar Nick Gaskill

Merge branch 'eread/add-process-for-moving-repos' into 'master'

Add process for moving repos

See merge request gitlab-org/gitlab!40060
parents 0a0922a8 bd018536
......@@ -379,7 +379,7 @@ application server, or a Gitaly node.
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)
[migrate the data to the Gitaly Cluster storage](#migrate-existing-repositories-to-gitaly-cluster)
afterwards.
Replace `PRAEFECT_INTERNAL_TOKEN` with a strong secret, which will be used by
......@@ -802,7 +802,8 @@ Particular attention should be shown to:
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).
you should [migrate the data your Gitaly Cluster storage](#migrate-existing-repositories-to-gitaly-cluster)
first.
```ruby
gitaly['enable'] = false
......@@ -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
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
automatically.
If your GitLab instance already has repositories on single Gitaly nodes, these aren't migrated to
Gitaly Cluster automatically.
Repositories may be moved from one storage location using the [Project repository storage moves API](../../api/project_repository_storage_moves.md):
```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"
```
To move repositories to Gitaly Cluster:
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
......
......@@ -9,8 +9,22 @@ type: reference
> [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,
you must [authenticate yourself](README.md#authentication) as an administrator.
Project repositories can be moved between storages. This can be useful when
[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
......
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