Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/build-monitoring-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Monitoring Container

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test-docker-compose:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Start Docker Compose
run: |
docker compose --profile monitoring build
docker compose --profile monitoring up -d

- name: Wait for bitcoin-node to be healthy
run: |
chmod +x docker/wait-for-bitcoin-healthy.sh
docker/wait-for-bitcoin-healthy.sh

- name: Stop Docker Compose
run: |
docker compose down -v
2 changes: 1 addition & 1 deletion docker/bitcoin-node-healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ case "$BITCOIN_NETWORK" in
mainnet) NETWORK="" ;;
signet) NETWORK="-signet" ;;
testnet) NETWORK="-testnet" ;;
regtest|"") NETWORK="-regtest" ;; regtest is the default
regtest|"") NETWORK="-regtest" ;; # regtest is the default
*)
echo "Unknown BITCOIN_NETWORK: $BITCOIN_NETWORK"
exit 1
Expand Down
22 changes: 22 additions & 0 deletions docker/wait-for-bitcoin-healthy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

echo "Waiting for bitcoin-node to be healthy..."
TIMEOUT=60
INTERVAL=6
ELAPSED=0

while [ $ELAPSED -lt $TIMEOUT ]; do
HEALTH=$(docker container inspect -f '{{.State.Health.Status}}' peer-observer-docker-bitcoin-node-1)
if [ "$HEALTH" = "healthy" ]; then
echo "bitcoin-node is healthy!"
exit 0
fi

echo "Current health status: $HEALTH"
sleep $INTERVAL
ELAPSED=$((ELAPSED + INTERVAL))
done

echo "bitcoin-node failed to become healthy within $TIMEOUT seconds."
docker compose logs bitcoin-node
exit 1