Use deployment command in sushiswap-subgraph stack

This commit is contained in:
Nabarun 2023-08-30 13:46:06 +05:30
parent 4b33c17b88
commit 92996c069b

View File

@ -30,12 +30,40 @@ Build the container images:
laconic-so --stack sushiswap-subgraph build-containers laconic-so --stack sushiswap-subgraph build-containers
``` ```
## Deploy ## Create a deployment
Initialize deployment and create "spec" file:
```bash
laconic-so --stack sushiswap-subgraph deploy init --output sushiswap-subgraph-spec.yml
```
We need to assign a fixed port `8000` for graph-node subgraph GQL endpoint. The values can be
customized by editing the "spec" file generated by `laconic-so deploy init`.
```
$ cat sushiswap-subgraph-spec.yml
stack: sushiswap-subgraph
ports:
graph-node:
- '8000:8000'
- '8001'
- '8020'
- '8030'
...
```
Create deployment:
```bash
laconic-so deploy create --spec-file sushiswap-subgraph-spec.yml --deployment-dir sushiswap-subgraph-deployment
```
## Start the stack
Deploy the stack: Deploy the stack:
```bash ```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph up laconic-so deployment --dir sushiswap-subgraph-deployment start
# Note: Remove any existing volumes for the cluster for a fresh start # Note: Remove any existing volumes for the cluster for a fresh start
``` ```
@ -45,13 +73,13 @@ After all services have started:
* Follow `graph-node` logs: * Follow `graph-node` logs:
```bash ```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph logs -f graph-node laconic-so deployment --dir sushiswap-subgraph-deployment logs -f graph-node
``` ```
* Check that the subgraphs have been deployed: * Check that the subgraphs have been deployed:
```bash ```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph logs -f sushiswap-subgraph-v3 laconic-so deployment --dir sushiswap-subgraph-deployment logs -f sushiswap-subgraph-v3
# Expected output: # Expected output:
# . # .
@ -78,15 +106,11 @@ After all services have started:
After `graph-node` has fetched the latest blocks from upstream, use the subgraph (GQL) endpoints for querying: After `graph-node` has fetched the latest blocks from upstream, use the subgraph (GQL) endpoints for querying:
```bash ```bash
# Find out the mapped host port for the subgraph endpoint
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph port graph-node 8000
# 0.0.0.0:HOST_PORT
# Blocks subgraph endpoint: # Blocks subgraph endpoint:
http://127.0.0.1:<HOST_PORT>/subgraphs/name/sushiswap/blocks/graphql http://127.0.0.1:8000/subgraphs/name/sushiswap/blocks/graphql
# v3 subgraph endpoint: # v3 subgraph endpoint:
http://127.0.0.1:<HOST_PORT>/subgraphs/name/sushiswap/v3-filecoin/graphql http://127.0.0.1:8000/subgraphs/name/sushiswap/v3-filecoin/graphql
``` ```
## Clean up ## Clean up
@ -94,15 +118,11 @@ http://127.0.0.1:<HOST_PORT>/subgraphs/name/sushiswap/v3-filecoin/graphql
Stop all the services running in background run: Stop all the services running in background run:
```bash ```bash
laconic-so --stack sushiswap-subgraph deploy --cluster sushigraph down laconic-so deployment --dir sushiswap-subgraph-deployment stop
``` ```
Clear volumes created by this stack: Clear volumes created by this stack:
```bash ```bash
# List all relevant volumes laconic-so deployment --dir sushiswap-subgraph-deployment stop --delete-volumes
docker volume ls -q --filter "name=sushigraph"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=sushigraph")
``` ```