지오 사이트 API

Tier: Premium, Ultimate Offering: Self-managed

Geo 사이트 API를 사용하여 Geo 사이트 엔드포인트를 관리합니다.

필수 사항:

  • 관리자여야 합니다.

새로운 Geo 사이트 생성

새로운 Geo 사이트를 생성합니다.

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/"
속성 유형 필수 여부 설명
primary 부울 아니오 이 사이트를 기본 사이트로 지정할지 여부를 지정합니다. 기본값은 거짓입니다.
enabled 부울 아니오 Geo 사이트가 활성화되었는지를 나타내는 플래그입니다. 기본값은 참입니다.
name 문자열 Geo 사이트의 고유 식별자입니다. gitlab.rb에 설정된 경우 geo_node_name과 일치해야 하며, 그렇지 않은 경우 external_url과 일치해야 합니다.
url 문자열 Geo 사이트의 사용자 대상 URL입니다.
internal_url 문자열 아니오 보조 사이트가 이를 사용하여 기본 사이트에 연락해야 하는 URL입니다. 설정되지 않으면 url을 반환합니다.
files_max_capacity 정수 아니오 이 보조 사이트의 LFS/첨부 파일 후킹 최대 동시성을 제어합니다. 기본값은 10입니다.
repos_max_capacity 정수 아니오 이 보조 사이트의 저장소 후킹 최대 동시성을 제어합니다. 기본값은 25입니다.
verification_max_capacity 정수 아니오 이 사이트의 저장소 검증 최대 동시성을 제어합니다. 기본값은 100입니다.
container_repositories_max_capacity 정수 아니오 이 사이트의 컨테이너 저장소 동기화 최대 동시성을 제어합니다. 기본값은 10입니다.
sync_object_storage 부울 아니오 보조 Geo 사이틀르 Object Storage에 블롭을 복제해야 하는지 여부를 나타내는 플래그입니다. 기본값은 거짓입니다.
selective_sync_type 문자열 아니오 특정 그룹 또는 샤드에 대해 동기화를 제한합니다. 유효한 값: "namespaces", "shards", 또는 null
selective_sync_shards 배열 아니오 selective_sync_type == shards인 경우 동기화되는 프로젝트의 저장소 저장소입니다.
selective_sync_namespace_ids 배열 아니오 selective_sync_type == namespaces인 경우 동기화되어야 하는 그룹의 ID입니다.
minimum_reverification_interval 정수 아니오 저장소 확인이 유효한 간격(일)입니다. 만료되면 재확인됩니다. 보조 사이트에서 설정할 경우 영향을 미치지 않습니다.

예시 응답:

{
  "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"
  }
}

모든 Geo 사이트에 대한 구성 내용 검색

GET /geo_sites
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites"

예시 응답:

[
  {
    "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"
    }
  }
]

특정 Geo 사이트에 대한 구성 검색

GET /geo_sites/:id
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites/1"

예시 응답:

{
  "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"
  }
}

Geo 사이트 수정

기존 Geo 사이트의 설정을 업데이트합니다.

PUT /geo_sites/:id
속성 유형 필수 설명
id 정수 Geo 사이트의 ID.
enabled 부울 아니요 Geo 사이트가 활성화되었는지를 나타내는 플래그.
name 문자열 아니요 Geo 사이트의 고유 식별자. gitlab.rb에 설정된 경우 geo_node_name과 일치해야 하며 그렇지 않은 경우 external_url과 일치해야 합니다.
url 문자열 아니요 Geo 사이트의 사용자 대상 URL.
internal_url 문자열 아니요 보조 사이트가 접촉해야 하는 기본 사이트에서 정의된 URL. 설정되지 않은 경우 url을 반환합니다.
files_max_capacity 정수 아니요 이 보조 사이트의 최대 동시성을 제어하는 LFS/첨부 파일 백필에 대한 최대 용량.
repos_max_capacity 정수 아니요 이 보조 사이트의 저장소 백필에 대한 최대 동시성을 제어합니다.
verification_max_capacity 정수 아니요 이 사이트의 검증에 대한 최대 동시성을 제어합니다.
container_repositories_max_capacity 정수 아니요 이 사이트의 컨테이너 저장소 동기화에 대한 최대 동시성을 제어합니다.
selective_sync_type 문자열 아니요 특정 그룹 또는 샤드에만 동기화를 제한합니다. 유효한 값: "namespaces", "shards", 또는 null.
selective_sync_shards 배열 아니요 selective_sync_type == shards일 때 프로젝트가 동기화될 저장소 저장소.
selective_sync_namespace_ids 배열 아니요 selective_sync_type == namespaces일 때 동기화해야 하는 그룹의 ID.
minimum_reverification_interval 정수 아니요 리포지토리 검증이 유효한 간격(일)입니다. 만료되면 다시 확인됩니다. 이는 보조 사이트에 설정된 경우 영향을 미치지 않습니다.

예시 응답:

{
  "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"
  }
}

Geo 사이트 삭제

Geo 사이트를 제거합니다.

DELETE /geo_sites/:id
속성 유형 필수 설명
id 정수 Geo 사이트의 ID.

Geo 사이트 수리

기본 또는 보조 Geo 사이트 간에 OAuth 동기화 문제가 있는 경우 Geo 사이트의 OAuth 인증을 수리합니다. 이 경우 다음과 같은 메시지가 표시될 수 있습니다:

이 Geo 노드에 대해 정의된 OAuth 응용 프로그램이 없습니다.
POST /geo_sites/:id/repair

예시 응답:

{
  "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,
  "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"
  }
}

모든 Geo 사이트에 대한 상태 검색

GET /geo_sites/status
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites/status"

예시 응답:

[
  {
    "geo_node_id": 1,
    "projects_count": 19,
    "container_repositories_replication_enabled": null,
    ...
  },
  {
    "geo_node_id": 2,
    "projects_count": 19,
    "container_repositories_replication_enabled": null,
    ...
  }
]

특정 Geo 사이트에 대한 상태 확인

GET /geo_sites/:id/status
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites/2/status"

예시 응답:

  {
  "geo_node_id": 2,
  "projects_count": 19,
  "container_repositories_replication_enabled": null,
  "lfs_objects_count": 0,
  ...
  "repositories_checked_count": null,
  "repositories_checked_failed_count": null,
  "last_event_id": 357,
  ...
  "storage_shards_match": true,
  "_links": {
    "self": "https://primary.example.com/api/v4/geo_sites/2/status",
    "site": "https://primary.example.com/api/v4/geo_sites/2"
  }
}

참고: health_status 매개변수는 “Healthy” 또는 “Unhealthy” 상태만 가질 수 있으며, health 매개변수는 비어 있을 수도 있고 “Healthy”이거나 실제 오류 메시지를 포함할 수 있습니다.

현재 사이트에서 발생한 프로젝트 동기화 또는 확인 실패 사례 검색

이 기능은 보조 사이트에서만 작동합니다.

GET /geo_sites/current/failures
속성 유형 필수 설명
type string no 실패한 객체의 유형 (repository/wiki)
failure_type string no 실패 유형 (sync/checksum_mismatch/verification)

이 엔드포인트는 페이지네이션을 사용합니다.

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_sites/current/failures"

예시 응답:

[
  {
    "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,
    "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
  }
]