Geo sites API
DETAILS: Tier: Premium, Ultimate Offering: GitLab Self-Managed
- Introduced in GitLab 16.0.
Use the Geo sites API to manage Geo site endpoints.
Prerequisites:
- You must be an administrator.
Create a new Geo site
Creates a new Geo site.
POST /geo_sites
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
Attribute | Type | Required | Description |
---|---|---|---|
primary |
boolean | no | Specifying whether this site should be primary. Defaults to false. |
enabled |
boolean | no | Flag indicating if the Geo site is enabled. Defaults to true. |
name |
string | yes | The unique identifier for the Geo site. Must match geo_node_name if it is set in gitlab.rb , otherwise it must match external_url
|
url |
string | yes | The user-facing URL for the Geo site. |
internal_url |
string | no | The URL defined on the primary site that secondary sites should use to contact it. Returns url if not set. |
files_max_capacity |
integer | no | Control the maximum concurrency of LFS/attachment backfill for this secondary site. Defaults to 10. |
repos_max_capacity |
integer | no | Control the maximum concurrency of repository backfill for this secondary site. Defaults to 25. |
verification_max_capacity |
integer | no | Control the maximum concurrency of repository verification for this site. Defaults to 100. |
container_repositories_max_capacity |
integer | no | Control the maximum concurrency of container repository sync for this site. Defaults to 10. |
sync_object_storage |
boolean | no | Flag indicating if the secondary Geo site should replicate blobs in Object Storage. Defaults to false. |
selective_sync_type |
string | no | Limit syncing to only specific groups or shards. Valid values: "namespaces" , "shards" , or null . |
selective_sync_shards |
array | no | The repository storage for the projects synced if selective_sync_type == shards . |
selective_sync_namespace_ids |
array | no | The IDs of groups that should be synced, if selective_sync_type == namespaces . |
minimum_reverification_interval |
integer | no | The interval (in days) in which the repository verification is valid. Once expired, it is reverified. This has no effect when set on a secondary site. |
Example response:
{
"id": 3,
"name": "Test Site 1",
"url": "https://secondary.example.com/",
"internal_url": "https://secondary.example.com/",
"primary": false,
"enabled": true,
"current": false,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"verification_max_capacity": 100,
"container_repositories_max_capacity": 10,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"sync_object_storage": false,
"web_edit_url": "https://primary.example.com/admin/geo/sites/3/edit",
"web_geo_replication_details_url": "https://secondary.example.com/admin/geo/sites/3/replication/lfs_objects",
"_links": {
"self": "https://primary.example.com/api/v4/geo_sites/3",
"status": "https://primary.example.com/api/v4/geo_sites/3/status",
"repair": "https://primary.example.com/api/v4/geo_sites/3/repair"
}
}
Retrieve configuration about all Geo sites
GET /geo_sites
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites"
Example response:
[
{
"id": 1,
"name": "us-site",
"url": "https://primary.example.com/",
"internal_url": "https://internal.example.com/",
"primary": true,
"enabled": true,
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"verification_max_capacity": 100,
"container_repositories_max_capacity": 10,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"web_edit_url": "https://primary.example.com/admin/geo/sites/1/edit",
"_links": {
"self": "https://primary.example.com/api/v4/geo_sites/1",
"status":"https://primary.example.com/api/v4/geo_sites/1/status",
"repair":"https://primary.example.com/api/v4/geo_sites/1/repair"
}
},
{
"id": 2,
"name": "cn-site",
"url": "https://secondary.example.com/",
"internal_url": "https://secondary.example.com/",
"primary": false,
"enabled": true,
"current": false,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"verification_max_capacity": 100,
"container_repositories_max_capacity": 10,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"sync_object_storage": true,
"web_edit_url": "https://primary.example.com/admin/geo/sites/2/edit",
"web_geo_replication_details_url": "https://secondary.example.com/admin/geo/sites/2/replication/lfs_objects",
"_links": {
"self":"https://primary.example.com/api/v4/geo_sites/2",
"status":"https://primary.example.com/api/v4/geo_sites/2/status",
"repair":"https://primary.example.com/api/v4/geo_sites/2/repair"
}
}
]
Retrieve configuration about a specific Geo site
GET /geo_sites/:id
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites/1"
Example response:
{
"id": 1,
"name": "us-site",
"url": "https://primary.example.com/",
"internal_url": "https://primary.example.com/",
"primary": true,
"enabled": true,
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"verification_max_capacity": 100,
"container_repositories_max_capacity": 10,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"web_edit_url": "https://primary.example.com/admin/geo/sites/1/edit",
"_links": {
"self": "https://primary.example.com/api/v4/geo_sites/1",
"status":"https://primary.example.com/api/v4/geo_sites/1/status",
"repair":"https://primary.example.com/api/v4/geo_sites/1/repair"
}
}
Edit a Geo site
Updates settings of an existing Geo site.
PUT /geo_sites/:id
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer | yes | The ID of the Geo site. |
enabled |
boolean | no | Flag indicating if the Geo site is enabled. |
name |
string | no | The unique identifier for the Geo site. Must match geo_node_name if it is set in gitlab.rb , otherwise it must match external_url . |
url |
string | no | The user-facing URL of the Geo site. |
internal_url |
string | no | The URL defined on the primary site that secondary sites should use to contact it. Returns url if not set. |
files_max_capacity |
integer | no | Control the maximum concurrency of LFS/attachment backfill for this secondary site. |
repos_max_capacity |
integer | no | Control the maximum concurrency of repository backfill for this secondary site. |
verification_max_capacity |
integer | no | Control the maximum concurrency of verification for this site. |
container_repositories_max_capacity |
integer | no | Control the maximum concurrency of container repository sync for this site. |
selective_sync_type |
string | no | Limit syncing to only specific groups or shards. Valid values: "namespaces" , "shards" , or null . |
selective_sync_shards |
array | no | The repository storage for the projects synced if selective_sync_type == shards . |
selective_sync_namespace_ids |
array | no | The IDs of groups that should be synced, if selective_sync_type == namespaces . |
minimum_reverification_interval |
integer | no | The interval (in days) in which the repository verification is valid. Once expired, it is reverified. This has no effect when set on a secondary site. |
Example response:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```0
## Delete a Geo site
Removes the Geo site.
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```1
| Attribute | Type | Required | Description |
|-----------|---------|----------|-------------------------|
| `id` | integer | yes | The ID of the Geo site. |
## Repair a Geo site
Repairs the OAuth authentication of a Geo site in the event that there is an
OAuth synchronization problem between the primary or secondary Geo sites.
In that case, this message may be displayed:
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```2
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```3
Example response:
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```4
## Retrieve status about all Geo sites
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```5
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```6
Example response:
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```7
## Retrieve status about a specific Geo site
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```8
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
```9
Example response:
```json
{
"id": 3,
"name": "Test Site 1",
"url": "https://secondary.example.com/",
"internal_url": "https://secondary.example.com/",
"primary": false,
"enabled": true,
"current": false,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"verification_max_capacity": 100,
"container_repositories_max_capacity": 10,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"sync_object_storage": false,
"web_edit_url": "https://primary.example.com/admin/geo/sites/3/edit",
"web_geo_replication_details_url": "https://secondary.example.com/admin/geo/sites/3/replication/lfs_objects",
"_links": {
"self": "https://primary.example.com/api/v4/geo_sites/3",
"status": "https://primary.example.com/api/v4/geo_sites/3/status",
"repair": "https://primary.example.com/api/v4/geo_sites/3/repair"
}
}
```0
NOTE:
The `health_status` parameter can only be in an "Healthy" or "Unhealthy" state, while the `health` parameter can be empty, "Healthy", or contain the actual error message.