Update sushiswap-subgraph stack to point to filecoin endpoint #509

Merged
prathamesh0 merged 16 commits from pm-sushigraph-filecoin into main 2023-08-30 10:35:16 +00:00
5 changed files with 114 additions and 19 deletions
Showing only changes of commit ea1bbb92d9 - Show all commits

View File

@ -1,8 +1,8 @@
version: "3.8"
services:
lotus-miner:
hostname: lotus-miner
lotus-miner-1:
hostname: lotus-miner-1
env_file:
- ../config/fixturenet-lotus/lotus-env.env
image: cerc/lotus:local
@ -11,7 +11,7 @@ services:
- ../config/fixturenet-lotus/fund-account.sh:/fund-account.sh
- lotus_miner_params:/var/tmp/filecoin-proof-parameters
- lotus_shared:/root/.lotus-shared
- lotus_miner_data:/root/data
- lotus_miner_1_data:/root/data
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-miner.sh"]
ports:
- "1234"
@ -19,6 +19,48 @@ services:
- "3456"
- "1777"
lotus-miner-2:
hostname: lotus-miner-2
env_file:
- ../config/fixturenet-lotus/lotus-env.env
environment:
- MINER_INDEX=1
image: cerc/lotus:local
volumes:
- ../config/fixturenet-lotus/setup-secondary-miner.sh:/docker-entrypoint-scripts.d/setup-secondary-miner.sh
- lotus_miner_params:/var/tmp/filecoin-proof-parameters
- lotus_shared:/root/.lotus-shared
- lotus_miner_2_data:/root/data
depends_on:
- lotus-miner-1
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-secondary-miner.sh"]
ports:
- "1234"
- "2345"
- "3456"
- "1777"
lotus-miner-3:
hostname: lotus-miner-3
env_file:
- ../config/fixturenet-lotus/lotus-env.env
environment:
- MINER_INDEX=2
image: cerc/lotus:local
volumes:
- ../config/fixturenet-lotus/setup-secondary-miner.sh:/docker-entrypoint-scripts.d/setup-secondary-miner.sh
- lotus_miner_params:/var/tmp/filecoin-proof-parameters
- lotus_shared:/root/.lotus-shared
- lotus_miner_3_data:/root/data
depends_on:
- lotus-miner-1
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-secondary-miner.sh"]
ports:
- "1234"
- "2345"
- "3456"
- "1777"
lotus-node-1:
hostname: lotus-node-1
env_file:
@ -39,7 +81,7 @@ services:
retries: 60
start_period: 3s
depends_on:
- lotus-miner
- lotus-miner-1
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"]
ports:
- "1234"
@ -67,7 +109,7 @@ services:
retries: 60
start_period: 3s
depends_on:
- lotus-miner
- lotus-miner-1
entrypoint: ["sh", "/docker-entrypoint-scripts.d/setup-node.sh"]
ports:
- "1234"
@ -80,6 +122,8 @@ volumes:
lotus_node_1_params:
lotus_node_2_params:
lotus_shared:
lotus_miner_data:
lotus_miner_1_data:
lotus_miner_2_data:
lotus_miner_3_data:
lotus_node_1_data:
lotus_node_2_data:

View File

@ -17,13 +17,18 @@ fi
# if genesis is not already setup
if [ ! -f /root/data/localnet.json ]; then
lotus-seed --sector-dir /root/data/.genesis-sectors pre-seal --sector-size 2KiB --num-sectors 2
lotus-seed --sector-dir /root/data/.genesis-sectors genesis new /root/data/localnet.json
lotus-seed --sector-dir /root/data/.genesis-sectors genesis add-miner /root/data/localnet.json /root/data/.genesis-sectors/pre-seal-t01000.json
lotus-seed --sector-dir /root/.lotus-shared/.genesis-sectors pre-seal --sector-size 2KiB --num-sectors 2 --miner-addr t01000
lotus-seed --sector-dir /root/.lotus-shared/.genesis-sectors pre-seal --sector-size 2KiB --num-sectors 2 --miner-addr t01001
lotus-seed --sector-dir /root/.lotus-shared/.genesis-sectors pre-seal --sector-size 2KiB --num-sectors 2 --miner-addr t01002
lotus-seed --sector-dir /root/.lotus-shared/.genesis-sectors genesis new /root/data/localnet.json
lotus-seed --sector-dir /root/.lotus-shared/.genesis-sectors genesis add-miner /root/data/localnet.json /root/.lotus-shared/.genesis-sectors/pre-seal-t01000.json
lotus-seed --sector-dir /root/.lotus-shared/.genesis-sectors genesis add-miner /root/data/localnet.json /root/.lotus-shared/.genesis-sectors/pre-seal-t01001.json
lotus-seed --sector-dir /root/.lotus-shared/.genesis-sectors genesis add-miner /root/data/localnet.json /root/.lotus-shared/.genesis-sectors/pre-seal-t01002.json
fi
# start daemon
# /root/.lotus-shared/devgen.car path
nohup lotus daemon --lotus-make-genesis=/root/.lotus-shared/devgen.car --profile=bootstrapper --genesis-template=/root/data/localnet.json --bootstrap=false > /var/log/lotus.log 2>&1 &
# Loop until the daemon is started
@ -33,18 +38,16 @@ while ! grep -q "started ChainNotify channel" /var/log/lotus.log ; do
done
echo "Daemon started."
# copy genesis file to shared volume
cp /devgen.car /root/.lotus-shared
# if miner not already initialized
if [ ! -d $LOTUS_MINER_PATH ]; then
# initialize miner
lotus wallet import --as-default /root/data/.genesis-sectors/pre-seal-t01000.key
lotus wallet import --as-default /root/.lotus-shared/.genesis-sectors/pre-seal-t01000.key
# fund a known account for usage
/fund-account.sh
lotus-miner init --genesis-miner --actor=t01000 --sector-size=2KiB --pre-sealed-sectors=/root/data/.genesis-sectors --pre-sealed-metadata=/root/data/.genesis-sectors/pre-seal-t01000.json --nosync
echo "Initializing miner..."
lotus-miner init --genesis-miner --actor=t01000 --sector-size=2KiB --pre-sealed-sectors=/root/.lotus-shared/.genesis-sectors --pre-sealed-metadata=/root/.lotus-shared/.genesis-sectors/pre-seal-t01000.json --nosync
fi
# publish bootnode peer info to shared volume

View File

@ -0,0 +1,44 @@
#!/bin/bash
lotus --version
# Wait for bootstrap peer info
echo "Waiting for miner 1 to share peering info..."
while [ ! -f /root/.lotus-shared/miner.addr ]; do
sleep 5
done
echo "Resuming..."
# init node config
mkdir -p "$LOTUS_PATH"
lotus config default > "$LOTUS_PATH"/config.toml
# add bootstrap peer info to config file
MINER_ADDR=\"$(cat /root/.lotus-shared/miner.addr)\"
sed -i "/^\[Libp2p\]/a \ \ BootstrapPeers = [$MINER_ADDR]" $LOTUS_PATH/config.toml
# start node
nohup lotus daemon --genesis=/root/.lotus-shared/devgen.car > /var/log/lotus.log 2>&1 &
# Loop until the daemon is started
echo "Waiting for daemon to start..."
while ! grep -q "started ChainNotify channel" /var/log/lotus.log ; do
sleep 5
done
echo "Daemon started."
# if miner not already initialized
if [ ! -d "$LOTUS_MINER_PATH" ]; then
# initialize miner
MINER_ACTOR="t0100$MINER_INDEX"
lotus wallet import --as-default "/root/.lotus-shared/.genesis-sectors/pre-seal-$MINER_ACTOR.key"
echo "Initializing miner..."
lotus-miner init --actor="$MINER_ACTOR" --sector-size=2KiB --pre-sealed-sectors=/root/.lotus-shared/.genesis-sectors --pre-sealed-metadata=/root/.lotus-shared/.genesis-sectors/pre-seal-"$MINER_ACTOR".json --nosync
fi
# start miner
nohup lotus-miner run --nosync &
tail -f /dev/null

View File

@ -19,13 +19,17 @@ Note: When running for the first time (or after clean up), the services will tak
Correct operation should be verified by checking the container logs with:
```
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus logs lotus-miner
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus logs lotus-miner-1
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus logs lotus-miner-2
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus logs lotus-miner-3
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus logs lotus-node-1
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus logs lotus-node-2
```
or by checking the chain status on each node:
```
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus exec lotus-miner "lotus status"
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus exec lotus-miner-1 "lotus status"
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus exec lotus-miner-2 "lotus status"
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus exec lotus-miner-3 "lotus status"
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus exec lotus-node-1 "lotus status"
$ laconic-so --stack fixturenet-lotus deploy --cluster lotus exec lotus-node-2 "lotus status"
```

View File

@ -1,4 +1,4 @@
# SushiSwap Graph
# SushiSwap Subgraph
## Setup
@ -75,7 +75,7 @@ After all services have started:
# sushigraph-sushiswap-subgraph-v3-1 | Done
```
After `graph-node` has fetched the latest blocks from upstream, use the subgraph (GQL) endpoints to for querying:
After `graph-node` has fetched the latest blocks from upstream, use the subgraph (GQL) endpoints for querying:
```bash
# Find out the mapped host port for the subgraph endpoint