Skip to content

Commit

Permalink
adding healthcheck for neo-faucet (#141)
Browse files Browse the repository at this point in the history
Merging
  • Loading branch information
nunojusto committed Jan 6, 2019
1 parent 150a565 commit 9edfc3a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
25 changes: 20 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,24 @@ services:
- neo-scan-api
environment:
NEOSCAN: 'neo-scan-api:4000'
healthcheck:
interval: 30s
retries: 3
start_period: 20s
test:
- CMD
- bash
- '-c'
- exec 6<>/dev/tcp/127.0.0.1/4002
timeout: 10s
image: 'cityofzion/neo-local-faucet:latest'
labels:
autoheal: 'true'
links:
- 'neo-scan-api:4000'
ports:
- '4002:4002'
restart: always

neo-python:
container_name: neo-python
Expand Down Expand Up @@ -101,7 +114,8 @@ services:
DB_PASSWORD: postgres
DB_USERNAME: postgres
NEO_NOTIFICATIONS_SERVER: 'http://${NOTIFICATIONS_SERVER}:8080/v1'
NEO_SEEDS: http://neo-cli-privatenet-1:30333;http://neo-cli-privatenet-2:30334;http://neo-cli-privatenet-3:30335;http://neo-cli-privatenet-4:30336
NEO_SEEDS: >-
http://neo-cli-privatenet-1:30333;http://neo-cli-privatenet-2:30334;http://neo-cli-privatenet-3:30335;http://neo-cli-privatenet-4:30336
PORT: 4000
REPLACE_OS_VARS: 'true'
healthcheck:
Expand Down Expand Up @@ -141,7 +155,8 @@ services:
DB_PASSWORD: postgres
DB_USERNAME: postgres
NEO_NOTIFICATIONS_SERVER: 'http://${NOTIFICATIONS_SERVER}:8080/v1'
NEO_SEEDS: http://neo-cli-privatenet-1:30333;http://neo-cli-privatenet-2:30334;http://neo-cli-privatenet-3:30335;http://neo-cli-privatenet-4:30336
NEO_SEEDS: >-
http://neo-cli-privatenet-1:30333;http://neo-cli-privatenet-2:30334;http://neo-cli-privatenet-3:30335;http://neo-cli-privatenet-4:30336
REPLACE_OS_VARS: 'true'
image: 'registry.gitlab.com/cityofzion/neo-scan/sync:latest'
links:
Expand All @@ -160,12 +175,12 @@ services:
- neo-cli-privatenet-2
- neo-cli-privatenet-3
- neo-cli-privatenet-4
image: cityofzion/neo-python:v0.8.2
image: 'cityofzion/neo-python:v0.8.2'
ports:
- '8080:8080'
volumes:
- './notifications-server.config.json:/neo-python/custom-config.json'

postgres:
container_name: postgres
environment:
Expand All @@ -174,4 +189,4 @@ services:
POSTGRES_USER: postgres
expose:
- 5432
image: 'library/postgres:10.5'
image: 'library/postgres:10.5'
8 changes: 7 additions & 1 deletion scripts/ping.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#! /bin/bash
# Script to check and wait until the NeoScan service is operational.

while [ "$(docker inspect --format '{{json .State.Health.Status }}' neo-local_autoheal)" != "\"healthy\"" ]
do
printf '.'
sleep 3
done

while [ "$(docker inspect --format '{{json .State.Health.Status }}' neo-scan-api)" != "\"healthy\"" ]
do
printf '.'
sleep 3
done

while [ "$(docker inspect --format '{{json .State.Health.Status }}' neo-local_autoheal)" != "\"healthy\"" ]
while [ "$(docker inspect --format '{{json .State.Health.Status }}' neo-faucet)" != "\"healthy\"" ]
do
printf '.'
sleep 3
Expand Down

0 comments on commit 9edfc3a

Please sign in to comment.