[#106] service/ir: Add healthcheck

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-06-29 22:36:04 +03:00 committed by Alex Vanin
parent 3713201f62
commit 140734d457
4 changed files with 24 additions and 0 deletions

View file

@ -56,3 +56,5 @@ NEOFS_IR_SETTLEMENT_BASIC_INCOME_RATE=100000000
NEOFS_IR_SETTLEMENT_AUDIT_FEE=100000 NEOFS_IR_SETTLEMENT_AUDIT_FEE=100000
NEOFS_IR_LOCODE_DB_PATH=/locode/db NEOFS_IR_LOCODE_DB_PATH=/locode/db
NEOFS_IR_CONTROL_GRPC_ENDPOINT=127.0.0.1:16512

View file

@ -16,13 +16,29 @@ services:
stop_signal: SIGKILL stop_signal: SIGKILL
volumes: volumes:
- ./wallet01.json:/wallet.json - ./wallet01.json:/wallet.json
- ./wallet01.key:/wallet01.key
- ./../../vendor/hosts:/etc/hosts - ./../../vendor/hosts:/etc/hosts
- ./../../vendor/locode_db:/locode/db - ./../../vendor/locode_db:/locode/db
- ./../../vendor/neofs-cli:/neofs-cli
- ./healthcheck.sh:/healthcheck.sh
env_file: [ ".env", ".ir.env" ] env_file: [ ".env", ".ir.env" ]
environment: environment:
- NEOFS_IR_WALLET_PATH=/wallet.json - NEOFS_IR_WALLET_PATH=/wallet.json
- NEOFS_IR_WALLET_ADDRESS=Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn - NEOFS_IR_WALLET_ADDRESS=Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn
- NEOFS_IR_WALLET_PASSWORD=one - NEOFS_IR_WALLET_PASSWORD=one
healthcheck:
test: ["CMD-SHELL", "/healthcheck.sh"]
interval: 2s
timeout: 1s
retries: 5
start_period: 20s
ir-healthcheck:
container_name: ir-healthcheck
image: debian:10
depends_on:
ir01:
condition: service_healthy
networks: networks:
ir_int: ir_int:

5
services/ir/healthcheck.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
EXPECTED="Health status: READY"
GOT=`/neofs-cli -r $NEOFS_IR_CONTROL_GRPC_ENDPOINT --binary-key /wallet01.key control healthcheck --ir | grep Health`
if [ "$EXPECTED" = "$GOT" ]; then exit 0; else exit 1; fi

1
services/ir/wallet01.key Normal file
View file

@ -0,0 +1 @@
4{½ž·ąô!z&ÜZ=*<%ěáČżńŐˇFŞôn46