From 635d1a0db067f40c28a20e19f22d5a327c0d2687 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 9 Feb 2021 18:57:37 +0300 Subject: [PATCH] [#46] services/ir: Add NeoFS LOCODE database to IR volumes Signed-off-by: Leonard Lyubich --- .env | 4 ++++ services/ir/.ir.env | 2 ++ services/ir/artifacts.mk | 20 ++++++++++++++++++++ services/ir/docker-compose.yml | 7 +++++++ services/storage/docker-compose.yml | 12 ++++++++---- 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 services/ir/artifacts.mk diff --git a/.env b/.env index fb88865..a428a04 100644 --- a/.env +++ b/.env @@ -24,3 +24,7 @@ HTTP_GW_IMAGE=nspccdev/neofs-http-gate # S3 Gate S3_GW_VERSION=0.14.2 S3_GW_IMAGE=nspccdev/neofs-s3-gate + +# NeoFS LOCODE database +LOCODE_DB_URL=https://github.com/nspcc-dev/neofs-locode-db/releases/download/v0.1.0/locode_db.gz +#LOCODE_DB_PATH=/path/to/locode_db diff --git a/services/ir/.ir.env b/services/ir/.ir.env index 5e5a6af..ee29c15 100644 --- a/services/ir/.ir.env +++ b/services/ir/.ir.env @@ -26,3 +26,5 @@ NEOFS_IR_CONTRACTS_ALPHABET_ZHIVETE=3623a2094e5163a426edeee70eb11582764a771b NEOFS_IR_MORPH_VALIDATORS=02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2 NEOFS_IR_AUDIT_PDP_MAX_SLEEP_INTERVAL=100ms + +NEOFS_IR_LOCODE_DB_PATH=/locode/db diff --git a/services/ir/artifacts.mk b/services/ir/artifacts.mk new file mode 100644 index 0000000..3dac781 --- /dev/null +++ b/services/ir/artifacts.mk @@ -0,0 +1,20 @@ +# Get NeoFS LOCODE database + +LOCODE_DB_ARCHIVE_PATH=./vendor +LOCODE_DB_ARCHIVE_FILE=locode_db.gz + +get.ir: LOCODE_DB_PATH?= +get.ir: + @mkdir -p ${LOCODE_DB_ARCHIVE_PATH} + +ifeq (${LOCODE_DB_PATH},) + @echo "⇒ Download NeoFS LOCODE database from ${LOCODE_DB_URL}" + @curl \ + -sSL "${LOCODE_DB_URL}" \ + -o ${LOCODE_DB_ARCHIVE_PATH}/${LOCODE_DB_ARCHIVE_FILE} +else + @echo "⇒ Copy local archive of NeoFS LOCODE database from ${LOCODE_DB_PATH}" + @cp ${LOCODE_DB_PATH} ${LOCODE_DB_ARCHIVE_PATH}/${LOCODE_DB_ARCHIVE_FILE} +endif + + gzip -dfk ${LOCODE_DB_ARCHIVE_PATH}/${LOCODE_DB_ARCHIVE_FILE} diff --git a/services/ir/docker-compose.yml b/services/ir/docker-compose.yml index c0344d0..18c592c 100644 --- a/services/ir/docker-compose.yml +++ b/services/ir/docker-compose.yml @@ -17,6 +17,7 @@ services: volumes: - ./01.key:/01.key - ./../../vendor/hosts:/etc/hosts + - ./../../vendor/locode_db:/locode/db env_file: [ ".env", ".ir.env" ] environment: - NEOFS_IR_KEY=/01.key @@ -34,6 +35,7 @@ services: volumes: - ./02.key:/02.key - ./../../vendor/hosts:/etc/hosts + - ./../../vendor/locode_db:/locode/db stop_signal: SIGKILL env_file: [ ".env", ".ir.env" ] environment: @@ -52,6 +54,7 @@ services: volumes: - ./03.key:/03.key - ./../../vendor/hosts:/etc/hosts + - ./../../vendor/locode_db:/locode/db stop_signal: SIGKILL env_file: [ ".env", ".ir.env" ] environment: @@ -70,6 +73,7 @@ services: volumes: - ./04.key:/04.key - ./../../vendor/hosts:/etc/hosts + - ./../../vendor/locode_db:/locode/db stop_signal: SIGKILL env_file: [ ".env", ".ir.env" ] environment: @@ -88,6 +92,7 @@ services: volumes: - ./05.key:/05.key - ./../../vendor/hosts:/etc/hosts + - ./../../vendor/locode_db:/locode/db stop_signal: SIGKILL env_file: [ ".env", ".ir.env" ] environment: @@ -106,6 +111,7 @@ services: volumes: - ./06.key:/06.key - ./../../vendor/hosts:/etc/hosts + - ./../../vendor/locode_db:/locode/db stop_signal: SIGKILL env_file: [ ".env", ".ir.env" ] environment: @@ -124,6 +130,7 @@ services: volumes: - ./07.key:/07.key - ./../../vendor/hosts:/etc/hosts + - ./../../vendor/locode_db:/locode/db stop_signal: SIGKILL env_file: [ ".env", ".ir.env" ] environment: diff --git a/services/storage/docker-compose.yml b/services/storage/docker-compose.yml index 9696e85..db20cf5 100644 --- a/services/storage/docker-compose.yml +++ b/services/storage/docker-compose.yml @@ -22,7 +22,8 @@ services: - NEOFS_NODE_KEY=/01.key - NEOFS_NODE_ADDRESS=s01.${LOCAL_DOMAIN}:8080 - NEOFS_GRPC_ENDPOINT=s01.${LOCAL_DOMAIN}:8080 - - NEOFS_NODE_ATTRIBUTE_0=/Location:Europe/Country:Russia/City:Moscow + - NEOFS_NODE_ATTRIBUTE_0=UN-LOCODE:RU MSK + - NEOFS_NODE_ATTRIBUTE_1=Price:22 storage02: image: ${NODE_IMAGE}:${NODE_VERSION} @@ -44,7 +45,8 @@ services: - NEOFS_NODE_KEY=/02.key - NEOFS_NODE_ADDRESS=s02.${LOCAL_DOMAIN}:8080 - NEOFS_GRPC_ENDPOINT=s02.${LOCAL_DOMAIN}:8080 - - NEOFS_NODE_ATTRIBUTE_0=/Location:Europe/Country:Russia/City:Saint-Petersburg + - NEOFS_NODE_ATTRIBUTE_0=UN-LOCODE:RU LED + - NEOFS_NODE_ATTRIBUTE_1=Price:33 storage03: image: ${NODE_IMAGE}:${NODE_VERSION} @@ -66,7 +68,8 @@ services: - NEOFS_NODE_KEY=/03.key - NEOFS_NODE_ADDRESS=s03.${LOCAL_DOMAIN}:8080 - NEOFS_GRPC_ENDPOINT=s03.${LOCAL_DOMAIN}:8080 - - NEOFS_NODE_ATTRIBUTE_0=/Location:Europe/Country:Sweden/City:Stockholm + - NEOFS_NODE_ATTRIBUTE_0=UN-LOCODE:SE STO + - NEOFS_NODE_ATTRIBUTE_1=Price:11 storage04: image: ${NODE_IMAGE}:${NODE_VERSION} @@ -88,7 +91,8 @@ services: - NEOFS_NODE_KEY=/04.key - NEOFS_NODE_ADDRESS=s04.${LOCAL_DOMAIN}:8080 - NEOFS_GRPC_ENDPOINT=s04.${LOCAL_DOMAIN}:8080 - - NEOFS_NODE_ATTRIBUTE_0=/Location:Europe/Country:Finalnd/City:Helsinki + - NEOFS_NODE_ATTRIBUTE_0=UN-LOCODE:FI HEL + - NEOFS_NODE_ATTRIBUTE_1=Price:44 volumes: storage_s01: