secured-finance-watcher-stack/stack-orchestrator/stacks/secured-finance
Nabarun 8ccfcba01a Upgrade secured-finance-watcher-ts version to 0.1.3 (#3)
Part of [Investigate subgraph watchers lagging behind head](https://www.notion.so/Investigate-subgraph-watchers-lagging-behind-head-01b72294ca8e4f658e4c0e86b36d19e2)

Reviewed-on: #3
Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Co-committed-by: Nabarun <nabarun@deepstacksoft.com>
2024-07-15 08:46:22 +00:00
..
README.md Create stack for running secured-finanace-watcher-ts (#1) 2024-05-30 11:24:30 +05:30
stack.yml Upgrade secured-finance-watcher-ts version to 0.1.3 (#3) 2024-07-15 08:46:22 +00:00

Secured finance watcher

Clone the stack repo

laconic-so fetch-stack git.vdb.to/cerc-io/secured-finance-watcher-stack

Clone required repositories

laconic-so --stack ~/cerc/secured-finance-watcher-stack/stack-orchestrator/stacks/secured-finance setup-repositories

Build the container image

laconic-so --stack ~/cerc/secured-finance-watcher-stack/stack-orchestrator/stacks/secured-finance build-containers

Create a spec file for the deployment

laconic-so --stack ~/cerc/secured-finance-watcher-stack/stack-orchestrator/stacks/secured-finance deploy init --output secured-finance-spec.yml

Ports

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

...
network:
  ports:
    secured-finance-watcher-db:
     - 15432:5432
    secured-finance-watcher-job-runner:
     - 9000:9000
    secured-finance-watcher-server:
     - 3008:3008
     - 9001:9001

Create a deployment from the spec file

laconic-so --stack ~/cerc/secured-finance-watcher-stack/stack-orchestrator/stacks/secured-finance deploy create --spec-file  secured-finance-spec.yml --deployment-dir secured-finance-deployment

Configuration

Inside deployment directory, open the config.env file and set following env variables:

# External Filecoin (ETH RPC) endpoint to point the watcher to
CERC_ETH_RPC_ENDPOINTS=https://example-lotus-endpoint-1/rpc/v1,https://example-lotus-endpoint-2/rpc/v1

Start the deployment

laconic-so deployment --dir secured-finance-deployment start
  • To list down and monitor the running containers:

    # With status
    docker ps -a
    
    # Check logs for a container
    docker logs -f <CONTAINER_ID>
    
  • Open the GQL playground at http://localhost:3008/graphql

    # Example query
    query {
      _meta {
        block {
          hash
          number
          timestamp
        }
        deployment
        hasIndexingErrors
      }
    

Clean up

Stop all the secured finance services running in background:

# Only stop the docker containers
laconic-so deployment --dir secured-finance-deployment stop

# Run 'start' to restart the deployment

To stop all the secured finance services and also delete data:

# Stop the docker containers
laconic-so deployment --dir secured-finance-deployment stop --delete-volumes

# Remove deployment directory (deployment will have to be recreated for a re-run)
rm -r secured-finance-deployment