Skip to content

Commit

Permalink
Merge pull request #25 from PowerLoom/dockerify
Browse files Browse the repository at this point in the history
v1.1.0 Pre-Mainnet simulation
  • Loading branch information
anomit authored Jul 17, 2024
2 parents fdffba5 + 8d5432c commit ffa7496
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.log*
.env
.env*
.python-version
__pycache__/
.idea/
Expand Down
33 changes: 0 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
- [Using Docker](#using-docker)
- [Without Docker](#without-docker)
- [Monitoring and Debugging](#monitoring-and-debugging)
- [Simulation run logs](#simulation-run-logs)
- [Verifying success of simulation run](#verifying-success-of-simulation-run)
- [Monitoring](#monitoring)
- [Debugging](#debugging)
- [For Contributors](#for-contributors)
- [Case Studies](#case-studies)
Expand Down Expand Up @@ -254,36 +251,6 @@ If you want to run the Snapshotter Lite Node without Docker, you need to make su
## Monitoring and Debugging
### Simulation run logs
While running this node for the first time, it performs a couple of dummy submissions to simulate its connections to the relayer and sequencer network. If you notice logs similar to the lines below in the node run logs, your node's simulation run was successful.

```
snapshotter-lite-new-proto-snapshotter-lite-v2-1 | 1|snapshotter-lite | June 6, 2024 > 17:30:49 | INFO | ✅ Event processed successfully: request {
snapshotter-lite-new-proto-snapshotter-lite-v2-1 | 1|snapshotter-lite | slotId: 4036
snapshotter-lite-new-proto-snapshotter-lite-v2-1 | 1|snapshotter-lite | deadline: 7747061
snapshotter-lite-new-proto-snapshotter-lite-v2-1 | 1|snapshotter-lite | snapshotCid: "bafkreia4m4icjc4q46rv2ncszplaibeiytce2iqa5qu4dr3wj7w3vwljai"
```
### Verifying success of simulation run
To verify the success of the same, make use of the utility script bundled within here by running the following on a MacOS/Linux command line terminal.
>This will work only after you have set up the node correctly with the right `.env` variables and run it successfully.
```bash
./check_simulation.sh
{"success":true,"submissionCount":2,"lastPing":1717672628,"message":"","nodeVersion":"v0.2.1"}
```

If you observe `submissionCount` and `lastPing` in the above response to be greater than 0, your node's simulation run was successful.

### Monitoring
**TODO** - Enter Node dashboard screenshots and information here

### Debugging
Usually the easiest way to fix node related issues is to restart the node. If you're facing issues with the node, you can try going through the logs present in the `logs` directory. If you're unable to find the issue, you can reach out to us on [Discord](https://powerloom.io/discord) and we will be happy to help you out.
Expand Down
11 changes: 11 additions & 0 deletions _override_defaults.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source .env

if [ -z "$OVERRIDE_DEFAULTS" ]; then
echo "reset to default values...";
export PROST_RPC_URL="https://rpc-prost1h-proxy.powerloom.io"
export PROTOCOL_STATE_CONTRACT="0x10c5E2ee14006B3860d4FdF6B173A30553ea6333"
export PROST_CHAIN_ID="11165"
export SEQUENCER_ID="QmdJbNsbHpFseUPKC9vLt4vMsfdxA4dyHPzsAWuzYz3Yxx"
export RELAYER_RENDEZVOUS_POINT="Relayer_POP_test_simulation_phase_1"
export CLIENT_RENDEZVOUS_POINT="POP_Client_simulation_test_alpha"
fi
17 changes: 15 additions & 2 deletions build-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ if [ ! -f .env ]; then

fi

./_override_defaults.sh

source .env

echo "testing before build...";
Expand Down Expand Up @@ -91,7 +93,10 @@ if [ "$POWERLOOM_REPORTING_URL" ]; then
echo "Found POWERLOOM_REPORTING_URL ${POWERLOOM_REPORTING_URL}";
fi

if [ "$LOCAL_COLLECTOR_PORT" ]; then
if [ -z "$LOCAL_COLLECTOR_PORT" ]; then
export LOCAL_COLLECTOR_PORT=50051;
echo "LOCAL_COLLECTOR_PORT not found in .env, setting to default value ${LOCAL_COLLECTOR_PORT}";
else
echo "Found LOCAL_COLLECTOR_PORT ${LOCAL_COLLECTOR_PORT}";
fi

Expand All @@ -104,7 +109,15 @@ fi

# setting up git submodules
git submodule update --init --recursive
git clone https://github.com/PowerLoom/snapshotter-lite-local-collector/ snapshotter-lite-local-collector --single-branch --branch main
# check if snapshotter-lite-local-collector exists
if [ -d "./snapshotter-lite-local-collector" ]; then
echo "snapshotter-lite-local-collector exists, do you want to delete and clone a fresh one? (y/n)";
read response;
if [ "$response" == "y" ]; then
rm -rf ./snapshotter-lite-local-collector
git clone https://github.com/PowerLoom/snapshotter-lite-local-collector/ snapshotter-lite-local-collector --single-branch --branch main
fi
fi
cd ./snapshotter-lite-local-collector/ && chmod +x build-docker.sh && ./build-docker.sh;
cd ../;

Expand Down
26 changes: 13 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,9 @@ if [ ! -f .env ]; then

fi

source .env
./_override_defaults.sh

if [ -z "$OVERRIDE_DEFAULTS" ]; then
echo "reset to default values...";
export PROST_RPC_URL="https://rpc-prost1h-proxy.powerloom.io"
export PROTOCOL_STATE_CONTRACT="0x1996e00549a7b664E927F872342cE66D2545869c"
export PROST_CHAIN_ID="11165"
fi
source .env

echo "testing before build...";

Expand Down Expand Up @@ -82,9 +77,6 @@ if [ "$PROTOCOL_STATE_CONTRACT" ]; then
echo "Found PROTOCOL_STATE_CONTRACT ${PROTOCOL_STATE_CONTRACT}";
fi

if [ "$LOCAL_COLLECTOR_PORT" ]; then
echo "Found LOCAL_COLLECTOR_PORT ${LOCAL_COLLECTOR_PORT}";
fi

if [ "$RELAYER_HOST" ]; then
echo "Found RELAYER_HOST ${RELAYER_HOST}";
Expand All @@ -109,17 +101,25 @@ else
echo "Found CORE_API_PORT ${CORE_API_PORT}";
fi

if [ -z "$LOCAL_COLLECTOR_PORT" ]; then
export LOCAL_COLLECTOR_PORT=50051;
echo "LOCAL_COLLECTOR_PORT not found in .env, setting to default value ${LOCAL_COLLECTOR_PORT}";
else
echo "Found LOCAL_COLLECTOR_PORT ${LOCAL_COLLECTOR_PORT}";
fi

#fetch current git branch name
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)

echo "Current branch is ${GIT_BRANCH}";

#if on main git branch, set image_tag to latest or use the branch name

if [ "$GIT_BRANCH" = "main" ]; then
export IMAGE_TAG="latest";

if [ "$GIT_BRANCH" = "dockerify" ]; then
export IMAGE_TAG="dockerify"
else
export IMAGE_TAG="${GIT_BRANCH}";
export IMAGE_TAG="latest"
fi

echo "Building image with tag ${IMAGE_TAG}";
Expand Down
2 changes: 1 addition & 1 deletion config
Submodule config updated 1 files
+1 −1 settings.example.json
4 changes: 2 additions & 2 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
- RELAYER_PRIVATE_KEY=$RELAYER_PRIVATE_KEY
- BLOCK_TIME=$BLOCK_TIME
command:
bash -c "sh server_autofill.sh && sh init_processes.sh"
bash -c "bash server_autofill.sh && bash init_processes.sh"

snapshotter-lite-v2:
image: snapshotter-lite-v2
Expand Down Expand Up @@ -61,7 +61,7 @@ services:
retries: 3
start_period: 30s
command:
bash -c "sh snapshotter_autofill.sh && sh init_docker.sh"
bash -c "bash snapshotter_autofill.sh && bash init_docker.sh"
ipfs:
image: ipfs/kubo:release
profiles: ["ipfs"]
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
- RELAYER_PRIVATE_KEY=$RELAYER_PRIVATE_KEY
- BLOCK_TIME=$BLOCK_TIME
command:
bash -c "sh server_autofill.sh && sh init_processes.sh"
bash -c "bash server_autofill.sh && bash init_processes.sh"

snapshotter-lite-v2:
image: ghcr.io/powerloom/snapshotter-lite-v2:${IMAGE_TAG}
Expand Down Expand Up @@ -59,7 +59,7 @@ services:
retries: 3
start_period: 30s
command:
bash -c "sh snapshotter_autofill.sh && sh init_docker.sh"
bash -c "bash snapshotter_autofill.sh && bash init_docker.sh"
ipfs:
image: ipfs/kubo:release
profiles: ["ipfs"]
Expand Down
2 changes: 1 addition & 1 deletion env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SIGNER_ACCOUNT_ADDRESS=<signer-account-address>
SIGNER_ACCOUNT_PRIVATE_KEY=<signer-account-private-key>
SLOT_ID=<slot-id>
PROST_RPC_URL=https://rpc-prost1h-proxy.powerloom.io
PROTOCOL_STATE_CONTRACT=0x1996e00549a7b664E927F872342cE66D2545869c
PROTOCOL_STATE_CONTRACT=0x10c5E2ee14006B3860d4FdF6B173A30553ea6333
RELAYER_HOST=https://prost1h-relayer-public.powerloom.io
NAMESPACE=UNISWAPV2
POWERLOOM_REPORTING_URL=https://nms-testnet-reporting.powerloom.io
Expand Down
9 changes: 0 additions & 9 deletions snapshotter_autofill.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
#!/bin/bash

source .env

if [ -z "$OVERRIDE_DEFAULTS" ]; then
echo "reset to default values...";
export PROST_RPC_URL="https://rpc-prost1h-proxy.powerloom.io"
export PROTOCOL_STATE_CONTRACT="0x1996e00549a7b664E927F872342cE66D2545869c"
export PROST_CHAIN_ID="11165"
fi

echo 'populating setting from environment values...';

if [ -z "$SOURCE_RPC_URL" ]; then
Expand Down

0 comments on commit ffa7496

Please sign in to comment.