Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example scripts to help with onboarding #886

Merged
merged 8 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
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=1
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