Skip to content

Commit

Permalink
Update subgraph watcher versions and instructions to use deployments …
Browse files Browse the repository at this point in the history
  • Loading branch information
prathamesh0 authored and ashwin committed Mar 12, 2024
1 parent 523b577 commit 17e860d
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 36 deletions.
67 changes: 50 additions & 17 deletions stack_orchestrator/data/stacks/merkl-sushiswap-v3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,55 @@ laconic-so --stack merkl-sushiswap-v3 build-containers

## Deploy

Create a spec file for the deployment:

```bash
laconic-so --stack merkl-sushiswap-v3 deploy init --output merkl-sushiswap-v3-spec.yml
```

### Ports

Edit `network` in the spec file to map container ports to host ports as required:

```
...
network:
ports:
merkl-sushiswap-v3-watcher-db:
- '5432'
merkl-sushiswap-v3-watcher-job-runner:
- 9002:9000
merkl-sushiswap-v3-watcher-server:
- 127.0.0.1:3007:3008
- 9003:9001
```

### Create a deployment

Create a deployment from the spec file:

```bash
laconic-so --stack merkl-sushiswap-v3 deploy create --spec-file merkl-sushiswap-v3-spec.yml --deployment-dir merkl-sushiswap-v3-deployment
```

### Configuration

Create and update an env file to be used in the next step:
Inside deployment directory, open the `config.env` file and set following env variables:

```bash
# External Filecoin (ETH RPC) endpoint to point the watcher
CERC_ETH_RPC_ENDPOINT=
```
```bash
# External Filecoin (ETH RPC) endpoint to point the watcher to
CERC_ETH_RPC_ENDPOINT=https://example-lotus-endpoint/rpc/v1
```

### Deploy the stack
### Start the deployment

```bash
laconic-so --stack merkl-sushiswap-v3 deploy --cluster merkl_sushiswap_v3 --env-file <PATH_TO_ENV_FILE> up
laconic-so deployment --dir merkl-sushiswap-v3-deployment start
```

* To list down and monitor the running containers:

```bash
laconic-so --stack merkl-sushiswap-v3 deploy --cluster merkl_sushiswap_v3 ps

# With status
docker ps -a

Expand All @@ -46,6 +75,7 @@ laconic-so --stack merkl-sushiswap-v3 deploy --cluster merkl_sushiswap_v3 --env-
* Open the GQL playground at http://localhost:3007/graphql

```graphql
# Example query
{
_meta {
block {
Expand All @@ -54,7 +84,7 @@ laconic-so --stack merkl-sushiswap-v3 deploy --cluster merkl_sushiswap_v3 --env-
}
hasIndexingErrors
}

factories {
id
poolCount
Expand All @@ -64,18 +94,21 @@ laconic-so --stack merkl-sushiswap-v3 deploy --cluster merkl_sushiswap_v3 --env-

## Clean up

Stop all the services running in background:
Stop all the merkl-sushiswap-v3 services running in background:

```bash
laconic-so --stack merkl-sushiswap-v3 deploy --cluster merkl_sushiswap_v3 down
# Only stop the docker containers
laconic-so deployment --dir merkl-sushiswap-v3-deployment stop

# Run 'start' to restart the deployment
```

Clear volumes created by this stack:
To stop all the merkl-sushiswap-v3 services and also delete data:

```bash
# List all relevant volumes
docker volume ls -q --filter "name=merkl_sushiswap_v3"
# Stop the docker containers
laconic-so deployment --dir merkl-sushiswap-v3-deployment stop --delete-volumes

# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=merkl_sushiswap_v3")
# Remove deployment directory (deployment will have to be recreated for a re-run)
rm -r merkl-sushiswap-v3-deployment
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "1.0"
name: merkl-sushiswap-v3
description: "SushiSwap v3 watcher stack"
repos:
- github.com/cerc-io/[email protected].6
- github.com/cerc-io/[email protected].7
containers:
- cerc/watcher-merkl-sushiswap-v3
pods:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ports:
Create deployment:

```bash
laconic-so deploy create --spec-file sushiswap-subgraph-spec.yml --deployment-dir sushiswap-subgraph-deployment
laconic-so --stack sushiswap-subgraph deploy create --spec-file sushiswap-subgraph-spec.yml --deployment-dir sushiswap-subgraph-deployment
```

## Start the stack
Expand Down
84 changes: 68 additions & 16 deletions stack_orchestrator/data/stacks/sushiswap-v3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,47 +16,99 @@ laconic-so --stack sushiswap-v3 build-containers

## Deploy

Create a spec file for the deployment:

```bash
laconic-so --stack sushiswap-v3 deploy init --output sushiswap-v3-spec.yml
```

### Ports

Edit `network` in the spec file to map container ports to host ports as required:

```
...
network:
ports:
sushiswap-v3-watcher-db:
- '5432'
sushiswap-v3-watcher-job-runner:
- 9000:9000
sushiswap-v3-watcher-server:
- 127.0.0.1:3008:3008
- 9001:9001
```

### Create a deployment

Create a deployment from the spec file:

```bash
laconic-so --stack sushiswap-v3 deploy create --spec-file sushiswap-v3-spec.yml --deployment-dir sushiswap-v3-deployment
```

### Configuration

Create and update an env file to be used in the next step:
Inside deployment directory, open the `config.env` file and set following env variables:

```bash
# External Filecoin (ETH RPC) endpoint to point the watcher
CERC_ETH_RPC_ENDPOINT=
```
```bash
# External Filecoin (ETH RPC) endpoint to point the watcher to
CERC_ETH_RPC_ENDPOINT=https://example-lotus-endpoint/rpc/v1
```

### Deploy the stack
### Start the deployment

```bash
laconic-so --stack sushiswap-v3 deploy --cluster sushiswap_v3 --env-file <PATH_TO_ENV_FILE> up
laconic-so deployment --dir sushiswap-v3-deployment start
```

* To list down and monitor the running containers:

```bash
laconic-so --stack sushiswap-v3 deploy --cluster sushiswap_v3 ps

# With status
docker ps -a

# Check logs for a container
docker logs -f <CONTAINER_ID>
```

* Open the GQL playground at http://localhost:3008/graphql

```graphql
# Example query
{
_meta {
block {
number
timestamp
}
hasIndexingErrors
}

factories {
id
poolCount
}
}
```

## Clean up

Stop all the services running in background:
Stop all the sushiswap-v3 services running in background:

```bash
laconic-so --stack sushiswap-v3 deploy --cluster sushiswap_v3 down
# Only stop the docker containers
laconic-so deployment --dir sushiswap-v3-deployment stop

# Run 'start' to restart the deployment
```

Clear volumes created by this stack:
To stop all the sushiswap-v3 services and also delete data:

```bash
# List all relevant volumes
docker volume ls -q --filter "name=sushiswap_v3"
# Stop the docker containers
laconic-so deployment --dir sushiswap-v3-deployment stop --delete-volumes

# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=sushiswap_v3")
# Remove deployment directory (deployment will have to be recreated for a re-run)
rm -r sushiswap-v3-deployment
```
2 changes: 1 addition & 1 deletion stack_orchestrator/data/stacks/sushiswap-v3/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "1.0"
name: sushiswap-v3
description: "SushiSwap v3 watcher stack"
repos:
- github.com/cerc-io/[email protected].6
- github.com/cerc-io/[email protected].7
containers:
- cerc/watcher-sushiswap-v3
pods:
Expand Down

0 comments on commit 17e860d

Please sign in to comment.