geo_nodes.md 11.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# Geo Nodes API

In order to interact with Geo node endpoints, you need to authenticate yourself
as an admin.

## Retrieve configuration about all Geo nodes

```
GET /geo_nodes
```

```bash
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/geo_nodes
```

Example response:

```json
[
  {
    "id": 1,
    "url": "https://primary.example.com/",
    "primary": true,
    "enabled": true,
25
    "current": true,
26 27
    "files_max_capacity": 10,
    "repos_max_capacity": 25,
28
    "verification_max_capacity": 100,
29
    "clone_protocol": "http"
30 31 32 33 34 35
  },
  {
    "id": 2,
    "url": "https://secondary.example.com/",
    "primary": false,
    "enabled": true,
36
    "current": false,
37 38
    "files_max_capacity": 10,
    "repos_max_capacity": 25,
39
    "verification_max_capacity": 100,
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
    "clone_protocol": "http"
  }
]
```

## Retrieve configuration about a specific Geo node

```
GET /geo_nodes/:id
```

```bash
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/geo_nodes/1
```

Example response:

```json
{
  "id": 1,
  "url": "https://primary.example.com/",
  "primary": true,
  "enabled": true,
63
  "current": true,
64 65
  "files_max_capacity": 10,
  "repos_max_capacity": 25,
66
  "verification_max_capacity": 100,
67
  "clone_protocol": "http"
68 69 70
}
```

71 72 73 74
## Edit a Geo node

Updates an existing Geo secondary node. The primary node cannot be edited.

Brett Walker's avatar
Brett Walker committed
75 76
_This can only be run against a primary Geo node._

77 78 79 80
```
PUT /geo_nodes/:id
```

81 82 83 84 85 86 87 88
| Attribute            | Type    | Required  | Description                                                               |
|----------------------|---------|-----------|---------------------------------------------------------------------------|
| `id`                 | integer | yes       | The ID of the Geo node.                                                   |
| `enabled`            | boolean | no        | Flag indicating if the Geo node is enabled.                               |
| `url`                | string  | no        | The URL to connect to the Geo node.                                       |
| `files_max_capacity` | integer | no        | Control the maximum concurrency of LFS/attachment backfill for this secondary node. |
| `repos_max_capacity` | integer | no        | Control the maximum concurrency of repository backfill for this secondary node.     |
| `verification_max_capacity` | integer | no | Control the maximum concurrency of verification for this node. |
89 90 91 92 93 94 95 96 97 98 99 100

Example response:

```json
{
  "id": 1,
  "url": "https://primary.example.com/",
  "primary": true,
  "enabled": true,
  "current": true,
  "files_max_capacity": 10,
  "repos_max_capacity": 25,
101
  "verification_max_capacity": 100,
102 103 104 105
  "clone_protocol": "http"
}
```

Kushal Pandya's avatar
Kushal Pandya committed
106 107 108 109 110 111 112 113 114 115 116 117
## Delete a Geo node

Removes the Geo node.

```
DELETE /geo_nodes/:id
```

| Attribute | Type    | Required | Description             |
|-----------|---------|----------|-------------------------|
| `id`      | integer | yes      | The ID of the Geo node. |

118 119 120 121
## Repair a Geo node

To repair the OAuth authentication of a Geo node.

Brett Walker's avatar
Brett Walker committed
122 123
_This can only be run against a primary Geo node._

124
```
Kushal Pandya's avatar
Kushal Pandya committed
125
POST /geo_nodes/:id/repair
126 127 128 129 130 131 132 133 134 135 136 137 138
```

Example response:

```json
{
  "id": 1,
  "url": "https://primary.example.com/",
  "primary": true,
  "enabled": true,
  "current": true,
  "files_max_capacity": 10,
  "repos_max_capacity": 25,
139
  "verification_max_capacity": 100,
140 141 142 143
  "clone_protocol": "http"
}
```

Brett Walker's avatar
Brett Walker committed
144
## Retrieve status about all Geo nodes
145 146 147 148 149 150 151 152 153 154 155 156 157

```
GET /geo_nodes/status
```

```bash
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/geo_nodes/status
```

Example response:

```json
[
Brett Walker's avatar
Brett Walker committed
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
  {
    "geo_node_id": 1,
    "healthy": true,
    "health": "Healthy",
    "health_status": "Healthy",
    "missing_oauth_application": false,
    "attachments_count": 1,
    "attachments_synced_count": nil,
    "attachments_failed_count": nil,
    "attachments_synced_missing_on_primary_count": 0,
    "attachments_synced_in_percentage": "0.00%",
    "db_replication_lag_seconds": nil,
    "lfs_objects_count": 0,
    "lfs_objects_synced_count": nil,
    "lfs_objects_failed_count": nil,
    "lfs_objects_synced_missing_on_primary_count": 0,
    "lfs_objects_synced_in_percentage": "0.00%",
    "job_artifacts_count": 2,
    "job_artifacts_synced_count": nil,
    "job_artifacts_failed_count": nil,
    "job_artifacts_synced_missing_on_primary_count": 0,
    "job_artifacts_synced_in_percentage": "0.00%",
    "repositories_count": 41,
    "repositories_failed_count": nil,
    "repositories_synced_count": nil,
    "repositories_synced_in_percentage": "0.00%",
    "wikis_count": 41,
    "wikis_failed_count": nil,
    "wikis_synced_count": nil,
    "wikis_synced_in_percentage": "0.00%",
    "replication_slots_count": 1,
    "replication_slots_used_count": 1,
    "replication_slots_used_in_percentage": "100.00%",
    "replication_slots_max_retained_wal_bytes": 0,
192 193 194
    "repositories_checked_count": 20,
    "repositories_checked_failed_count": 20,
    "repositories_checked_in_percentage": "100.00%",
Brett Walker's avatar
Brett Walker committed
195 196 197 198 199 200 201 202 203 204 205 206 207 208
    "repositories_checksummed_count": 20,
    "repositories_checksum_failed_count": 5,
    "repositories_checksummed_in_percentage": "48.78%",
    "wikis_checksummed_count": 10,
    "wikis_checksum_failed_count": 3,
    "wikis_checksummed_in_percentage": "24.39%",
    "repositories_verified_count": 20,
    "repositories_verification_failed_count": 5,
    "repositories_verified_in_percentage": "48.78%",
    "repositories_checksum_mismatch_count": 3,
    "wikis_verified_count": 10,
    "wikis_verification_failed_count": 3,
    "wikis_verified_in_percentage": "24.39%",
    "wikis_checksum_mismatch_count": 1,
209 210 211
    "repositories_checked_count": 7,
    "repositories_checked_failed_count": 2,
    "repositories_checked_in_percentage": "17.07%",
Brett Walker's avatar
Brett Walker committed
212 213 214 215 216 217 218 219
    "last_event_id": 23,
    "last_event_timestamp": 1509681166,
    "cursor_last_event_id": nil,
    "cursor_last_event_timestamp": 0,
    "last_successful_status_check_timestamp": 1510125024,
    "version": "10.3.0",
    "revision": "33d33a096a",
  },
220 221 222 223
  {
    "geo_node_id": 2,
    "healthy": true,
    "health": "Healthy",
224 225
    "health_status": "Healthy",
    "missing_oauth_application": false,
226 227 228
    "attachments_count": 1,
    "attachments_synced_count": 1,
    "attachments_failed_count": 0,
229
    "attachments_synced_missing_on_primary_count": 0,
230 231 232 233 234
    "attachments_synced_in_percentage": "100.00%",
    "db_replication_lag_seconds": 0,
    "lfs_objects_count": 0,
    "lfs_objects_synced_count": 0,
    "lfs_objects_failed_count": 0,
235
    "lfs_objects_synced_missing_on_primary_count": 0,
236
    "lfs_objects_synced_in_percentage": "0.00%",
237 238 239
    "job_artifacts_count": 2,
    "job_artifacts_synced_count": 1,
    "job_artifacts_failed_count": 1,
240
    "job_artifacts_synced_missing_on_primary_count": 0,
241
    "job_artifacts_synced_in_percentage": "50.00%",
242 243 244 245
    "repositories_count": 41,
    "repositories_failed_count": 1,
    "repositories_synced_count": 40,
    "repositories_synced_in_percentage": "97.56%",
246 247 248 249
    "wikis_count": 41,
    "wikis_failed_count": 0,
    "wikis_synced_count": 41,
    "wikis_synced_in_percentage": "100.00%",
Brett Walker's avatar
Brett Walker committed
250 251 252 253
    "replication_slots_count": nil,
    "replication_slots_used_count": nil,
    "replication_slots_used_in_percentage": "0.00%",
    "replication_slots_max_retained_wal_bytes": nil,
254 255 256 257 258 259 260 261 262 263 264 265 266 267
    "repositories_checksummed_count": 20,
    "repositories_checksum_failed_count": 5,
    "repositories_checksummed_in_percentage": "48.78%",
    "wikis_checksummed_count": 10,
    "wikis_checksum_failed_count": 3,
    "wikis_checksummed_in_percentage": "24.39%",
    "repositories_verified_count": 20,
    "repositories_verification_failed_count": 5,
    "repositories_verified_in_percentage": "48.78%",
    "repositories_checksum_mismatch_count": 3,
    "wikis_verified_count": 10,
    "wikis_verification_failed_count": 3,
    "wikis_verified_in_percentage": "24.39%",
    "wikis_checksum_mismatch_count": 1,
268 269 270
    "repositories_checked_count": 5,
    "repositories_checked_failed_count": 1,
    "repositories_checked_in_percentage": "12.20%",
271 272 273 274
    "last_event_id": 23,
    "last_event_timestamp": 1509681166,
    "cursor_last_event_id": 23,
    "cursor_last_event_timestamp": 1509681166,
275
    "last_successful_status_check_timestamp": 1510125024,
276 277
    "version": "10.3.0",
    "revision": "33d33a096a"
278 279 280 281
  }
]
```

Brett Walker's avatar
Brett Walker committed
282
## Retrieve status about a specific Geo node
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298

```
GET /geo_nodes/:id/status
```

```bash
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/geo_nodes/2/status
```

Example response:

```json
{
  "geo_node_id": 2,
  "healthy": true,
  "health": "Healthy",
299 300
  "health_status": "Healthy",
  "missing_oauth_application": false,
301 302 303
  "attachments_count": 1,
  "attachments_synced_count": 1,
  "attachments_failed_count": 0,
304
  "attachments_synced_missing_on_primary_count": 0,
305 306 307 308 309
  "attachments_synced_in_percentage": "100.00%",
  "db_replication_lag_seconds": 0,
  "lfs_objects_count": 0,
  "lfs_objects_synced_count": 0,
  "lfs_objects_failed_count": 0,
310
  "lfs_objects_synced_missing_on_primary_count": 0,
311
  "lfs_objects_synced_in_percentage": "0.00%",
312 313 314
  "job_artifacts_count": 2,
  "job_artifacts_synced_count": 1,
  "job_artifacts_failed_count": 1,
315
  "job_artifacts_synced_missing_on_primary_count": 0,
316
  "job_artifacts_synced_in_percentage": "50.00%",
317 318 319 320
  "repositories_count": 41,
  "repositories_failed_count": 1,
  "repositories_synced_count": 40,
  "repositories_synced_in_percentage": "97.56%",
Brett Walker's avatar
Brett Walker committed
321 322 323 324 325 326 327 328
  "wikis_count": 41,
  "wikis_failed_count": 0,
  "wikis_synced_count": 41,
  "wikis_synced_in_percentage": "100.00%",
  "replication_slots_count": nil,
  "replication_slots_used_count": nil,
  "replication_slots_used_in_percentage": "0.00%",
  "replication_slots_max_retained_wal_bytes": nil,
329 330 331 332
  "last_event_id": 23,
  "last_event_timestamp": 1509681166,
  "cursor_last_event_id": 23,
  "cursor_last_event_timestamp": 1509681166,
333
  "last_successful_status_check_timestamp": 1510125268,
334 335
  "version": "10.3.0",
  "revision": "33d33a096a"
336 337
}
```
James Lopez's avatar
James Lopez committed
338

339 340
Please note that 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.

341
## Retrieve project sync or verification failures that occurred on the current node
James Lopez's avatar
James Lopez committed
342

343
This only works on a secondary node.
James Lopez's avatar
James Lopez committed
344 345

```
346
GET /geo_nodes/current/failures
James Lopez's avatar
James Lopez committed
347 348 349 350
```

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
351 352
| `type`         | string  | no | Type of failed objects (`repository`/`wiki`) |
| `failure_type` | string | no | Type of failures (`sync`/`checksum_mismatch`/`verification`) |
James Lopez's avatar
James Lopez committed
353

354
This endpoint uses [Pagination](README.md#pagination).
James Lopez's avatar
James Lopez committed
355 356

```bash
357
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/geo_nodes/current/failures
James Lopez's avatar
James Lopez committed
358 359 360 361 362
```

Example response:

```json
James Lopez's avatar
James Lopez committed
363 364
[
  {
James Lopez's avatar
James Lopez committed
365 366 367 368 369 370 371 372
    "project_id": 3,
    "last_repository_synced_at": "2017-10-31 14:25:55 UTC",
    "last_repository_successful_sync_at": "2017-10-31 14:26:04 UTC",
    "last_wiki_synced_at": "2017-10-31 14:26:04 UTC",
    "last_wiki_successful_sync_at": "2017-10-31 14:26:11 UTC",
    "repository_retry_count": null,
    "wiki_retry_count": 1,
    "last_repository_sync_failure": null,
373 374 375 376 377 378 379
    "last_wiki_sync_failure": "Error syncing Wiki repository",
    "last_repository_verification_failure": "",
    "last_wiki_verification_failure": "",
    "repository_verification_checksum_sha": "da39a3ee5e6b4b0d32e5bfef9a601890afd80709",
    "wiki_verification_checksum_sha": "da39a3ee5e6b4b0d3255bfef9ef0189aafd80709",
    "repository_checksum_mismatch": false,
    "wiki_checksum_mismatch": false
James Lopez's avatar
James Lopez committed
380 381
  }
]
James Lopez's avatar
James Lopez committed
382
```