Skip to content

Commit

Permalink
Merge pull request #886 from n1tranquilla/main
Browse files Browse the repository at this point in the history
Add example scripts to help with onboarding
  • Loading branch information
n1tranquilla authored May 14, 2024
2 parents d13430a + 7202bde commit 943301f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ tools, removing the need for a separate host Rust installation.
### Building the Project

Run `nix build` to compile the project. This will
compile the `mina-indexer` binary. See the ops folder for
working examples with the binary.
compile the `mina-indexer` binary. See the `./scripts`
folder for examples.

### Running Tests

Expand Down
17 changes: 17 additions & 0 deletions scripts/download-blocks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
set -ex

BLOCKS_DIR="./blocks"
touch "$BLOCKS_DIR"/block_urls

MIN_LENGTH=2
MAX_LENGTH=200

OUT_DIR=.

for LENGTH in `seq $MIN_LENGTH $MAX_LENGTH`
do
echo "gs://mina_network_block_data/mainnet-${LENGTH}-*.json" >> "$BLOCKS_DIR"/block_urls
done 2>/dev/null

gsutil -m cp -n -I "$BLOCKS_DIR" < "$BLOCKS_DIR"/block_urls
3 changes: 3 additions & 0 deletions scripts/nuke-database.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

rm -rf ~/.mina-indexer/database
20 changes: 20 additions & 0 deletions scripts/start-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

#BLOCKS_DIR=~/blocks/15000
BLOCKS_DIR=./blocks
STAKING_LEDGERS_DIR=~/.mina-indexer/staking-ledgers
GENESIS_LEDGERS_DIR=~/.mina-indexer/genesis-ledgers
DATABASE_DIR=~/.mina-indexer/database

IDXR="$(pwd)"/rust/target/release/mina-indexer
DOMAIN_SOCKET_PATH="$(pwd)"/rust/mina-indexer.sock

mina-indexer() {
"$IDXR" "$@"
}

mina-indexer server start \
--blocks-dir "$BLOCKS_DIR" \
--staking-ledgers-dir "$STAKING_LEDGERS_DIR" \
--database-dir "$DATABASE_DIR" \
--log-level debug 2>&1

0 comments on commit 943301f

Please sign in to comment.