Skip to content

Commit

Permalink
PM-1764 - Add daily Seed Synchronisation Check
Browse files Browse the repository at this point in the history
  • Loading branch information
kaozenn committed Jun 13, 2024
1 parent 38dee22 commit f16c120
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 5 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/sync-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Daily Seed Synchronization Check
on:
push:
branches: [PM-1764-create-daily-seed-synchronisation-check]
workflow_dispatch:
schedule:
- cron: '0 0 * * 1,3,5' # At 00:00 on Monday, Wednesday, and Friday
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
parse-mainnet-seed-list:
runs-on: minafoundation-xlarge-runners
outputs:
seeds: ${{ steps.parse-mainnet-seed-list.outputs.seeds }}
steps:
- name: 📥 Checkout
uses: actions/[email protected]
- name: Parse Mainnet Seed List
id: parse-mainnet-seed-list
run: |
echo "Parsing Mainnet Seed List"
seeds=$(cat networks/mainnet.txt | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "seeds=$seeds" >> $GITHUB_OUTPUT
test-peer:
needs: parse-mainnet-seed-list
runs-on: minafoundation-xlarge-runners
if: needs.parse-mainnet-seed-list.outputs.seeds != '[]' && needs.parse-mainnet-seed-list.outputs.seeds != ''
continue-on-error: true
strategy:
matrix:
seed: ${{ fromJson(needs.parse-mainnet-seed-list.outputs.seeds) }}
steps:
- name: 📥 Checkout
uses: actions/[email protected]
- name: Start Mina Daemon
run: |
docker run -d --restart always --name mina \
--entrypoint="" \
minaprotocol/mina-daemon:3.0.0-93e0279-bullseye-mainnet \
mina daemon \
--peer ${{ matrix.seed }}
- name: Wait for Daemon to Sync
id: wait-for-sync
run: ./scripts/mina-sync-monitor.sh
- name: Post to a Slack channel
id: slack
if: steps.wait-for-sync.outcome == 'failure'
uses: slackapi/[email protected]
with:
channel-id: 'test-slack-api'
slack-message: "Unable to sync a Mina Node using ${{ matrix.seed }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
11 changes: 6 additions & 5 deletions networks/mainnet.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/dns4/mina-seed.etonec.com/tcp/8302/p2p/12D3KooWKQ1YVtqZFzxDmSw8RASCPZpDCQBywnFz76RbrvZCXk5T
/dns4/mina-mainnet-seed.obscura.network/tcp/5002/p2p/12D3KooWLMHuJrir6q42qUiihZmqJshzWZ6baYNP6zs3UtJt67BF
/dns4/mina-mainnet-seed.obscura.network/tcp/5002/p2p/12D3KooWFRpU3giZDFjJjwoHSY8kdpv8ktvferGkyQRUHozsXw4X
/dns4/mina-mainnet-seed.staketab.com/tcp/10003/p2p/12D3KooWSDTiXcdBVpN12ZqXJ49qCFp8zB1NnovuhZu6A28GLF1J
/dns4/mina-seed-1.zkvalidator.com/tcp/8302/p2p/12D3KooWSR7LMBSfEk3LQUudmsX27yuRHe9NUxwLumurGF5P1MNS
/dns4/mina-seed-1.zkvalidator.com/tcp/8302/p2p/12D3KooWSfEfnVCqzpMbmyUmRY3ESEVmJaRcd1EkLbnvvERQxwtu
/dns4/mina-seed.bitcat365.com/tcp/10001/p2p/12D3KooWQzozNTDKL7MqUh6Nh11GMA4pQhRCAsNTRWxCAzAi4VbE
/dns4/production-mainnet-libp2p.minaprotocol.network/tcp/10000/p2p/12D3KooWPywsM191KGGNVGiNqN35nyyJg4W2BhhYukF6hP9YBR8q
/dns4/production-mainnet-libp2p.minaprotocol.network/tcp/10010/p2p/12D3KooWGB6mJ9Ub9qRBDgHhedNXH4FawWjGQGGN2tQKaKa3gK2h
/dns4/production-mainnet-libp2p.minaprotocol.network/tcp/10020/p2p/12D3KooWMvsPx6A1XNa4V8bTbNb6Fh7WHWf92Ezgfxt6UWxiNq5n
/dns4/production-mainnet-libp2p.minaprotocol.network/tcp/10030/p2p/12D3KooW9wL9iaj7qbCTBFspi4gCwdZFCdNRnwkRrdRfe4GBJ978
/dns4/production-mainnet-libp2p.minaprotocol.network/tcp/10040/p2p/12D3KooWL8SFDx6PSzpSLgBtRSK1brjKFqs8EvW2yX9zexQEefAo
/dns4/seed-1.mainnet.o1test.net/tcp/10000/p2p/12D3KooWCa1d7G3SkRxy846qTvdAFX69NnoYZ32orWVLqJcDVGHW
/dns4/seed-2.mainnet.o1test.net/tcp/10001/p2p/12D3KooWK4NfthViCTyLgVQa1WvqDC1NccVxGruCXCZUt3GqvFvn
/dns4/seed-3.mainnet.o1test.net/tcp/10002/p2p/12D3KooWNofeYVAJXA3WGg2qCDhs3GEe71kTmKpFQXRbZmCz1Vr7
/dns4/seed-1.mainnet.gcp.o1test.net/tcp/10003/p2p/12D3KooWCa1d7G3SkRxy846qTvdAFX69NnoYZ32orWVLqJcDVGHW
/dns4/seed-2.mainnet.gcp.o1test.net/tcp/10003/p2p/12D3KooWK4NfthViCTyLgVQa1WvqDC1NccVxGruCXCZUt3GqvFvn
/dns4/seed-4.mainnet.gcp.o1test.net/tcp/10003/p2p/12D3KooWEdBiTUQqxp3jeuWaZkwiSNcFxC6d6Tdq7u2Lf2ZD2Q6X
/dns4/seed-5.mainnet.gcp.o1test.net/tcp/10003/p2p/12D3KooWL1DJTigSwuKQRfQE3p7puFUqfbHjXbZJ9YBWtMNpr3GU
/dns4/seed.minaexplorer.com/tcp/8302/p2p/12D3KooWR7coZtrMHvsgsfiWq2GESYypac3i29LFGp6EpbtjxBiJ
/dns4/seed.minataur.net/tcp/8302/p2p/12D3KooWNyExDzG8T1BYXHpXQS66kaw3zi6qi5Pg9KD3GEyHW5FF
/dns4/seed.piconbello.com/tcp/10001/p2p/12D3KooWRFac2AztcTeen2DYNwnTrmVBvwNDsRiFpDVdTkwdFAHP
33 changes: 33 additions & 0 deletions scripts/mina-sync-monitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -e
exit_code=1

check_sync_status() {
status=$(docker exec mina mina client status --json | jq -r .sync_status || echo "Null")
echo "Current sync status: $status"
}
max_attempts=50
attempt=0
sleep_duration=300

# Loop to check sync status
while [ $attempt -lt $max_attempts ]; do
check_sync_status
if [ "$status" == "Synced" ]; then
echo "Mina client is synced."
exit_code=0
break
fi

attempt=$((attempt + 1))

if [ $attempt -eq $((max_attempts / 2)) ]; then
echo "Half of the maximum attempts reached. Restarting Mina container."
docker restart mina
fi

echo "Mina client is not synced. Attempt $attempt/$max_attempts."
sleep $sleep_duration
done

exit "$exit_code"

0 comments on commit f16c120

Please sign in to comment.