Add a stack for Gelato watcher (#394)
* Add a stack for Gelato watcher * Add option to create and use a state snapshot * Add commands to create and import a state checkpoint * Rename ipld-eth-server endpoint env variables * Fix default env variable Former-commit-id: 8b4b5deba88bc5008a623a3826a5d2c0d76aadb6
This commit is contained in:
@@ -4,7 +4,7 @@ Instructions to setup and deploy Azimuth Watcher stack
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: ipld-eth-server RPC and GQL endpoints
|
||||
Prerequisite: `ipld-eth-server` RPC and GQL endpoints
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
@@ -41,7 +41,7 @@ This should create the required docker images in the local image registry.
|
||||
CERC_IPLD_ETH_GQL=
|
||||
```
|
||||
|
||||
* NOTE: If ipld-eth-server is running on the host machine, use `host.docker.internal` as the hostname to access host ports
|
||||
* NOTE: If `ipld-eth-server` is running on the host machine, use `host.docker.internal` as the hostname to access host ports
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
# Gelato watcher
|
||||
|
||||
Instructions to setup and deploy Gelato watcher using [laconic-stack-orchestrator](/README.md#install)
|
||||
|
||||
## Setup
|
||||
|
||||
Prerequisite: `ipld-eth-server` RPC and GQL endpoints
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato setup-repositories
|
||||
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
||||
Checkout to required version in the repo:
|
||||
|
||||
```bash
|
||||
# gelato-watcher-ts
|
||||
cd ~/cerc/gelato-watcher-ts
|
||||
git checkout v0.1.0
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato build-containers
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry.
|
||||
|
||||
## Deploy
|
||||
|
||||
### Configuration
|
||||
|
||||
Create and update an env file to be used in the next step ([defaults](../../config/watcher-gelato/watcher-params.env)):
|
||||
|
||||
```bash
|
||||
# External ipld-eth-server endpoints
|
||||
CERC_IPLD_ETH_RPC=
|
||||
CERC_IPLD_ETH_GQL=
|
||||
|
||||
# Whether to use a state snapshot to initialize the watcher
|
||||
CERC_USE_STATE_SNAPSHOT=false
|
||||
|
||||
# State snapshot params
|
||||
# Required if CERC_USE_STATE_SNAPSHOT is set to true
|
||||
CERC_SNAPSHOT_GQL_ENDPOINT=
|
||||
CERC_SNAPSHOT_BLOCKHASH=
|
||||
```
|
||||
|
||||
* NOTE: If `ipld-eth-server` is running on the host machine, use `host.docker.internal` as the hostname to access the host port(s)
|
||||
|
||||
### Deploy the stack
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato deploy --env-file <PATH_TO_ENV_FILE> up
|
||||
```
|
||||
|
||||
To list down and monitor the running containers:
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato deploy ps
|
||||
|
||||
# With status
|
||||
docker ps
|
||||
|
||||
# Check logs for a container
|
||||
docker logs -f <CONTAINER_ID>
|
||||
```
|
||||
|
||||
The stack runs an active watcher with following endpoints exposed on the host ports:
|
||||
* `3008`: watcher endpoint
|
||||
* `9000`: watcher metrics
|
||||
* `9001`: watcher GQL metrics
|
||||
|
||||
## Web Apps
|
||||
|
||||
TODO
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack gelato deploy down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
```bash
|
||||
# List all relevant volumes
|
||||
docker volume ls -q --filter "name=.*gelato_watcher_db_data|.*gelato_watcher_state_gql"
|
||||
|
||||
# Remove all the listed volumes
|
||||
docker volume rm $(docker volume ls -q --filter "name=.*gelato_watcher_db_data|.*gelato_watcher_state_gql")
|
||||
```
|
||||
@@ -0,0 +1,8 @@
|
||||
version: "1.0"
|
||||
name: gelato
|
||||
repos:
|
||||
- cerc-io/gelato-watcher-ts
|
||||
containers:
|
||||
- cerc/watcher-gelato
|
||||
pods:
|
||||
- watcher-gelato
|
||||
Reference in New Issue
Block a user