subsquid / squid-cli

CLI for managing squid deployments to the SQD Cloud
17 stars 16 forks source link

RFC: deployment manifest for squids #12

Closed dzhelezov closed 6 months ago

dzhelezov commented 1 year ago

Motivation

1) The existing way of deploying squids with sqd deploy is not suitable for a growing list of deployment options Aquarium supports 2) We want to make each squid portable and easy to deploy on any platform aside from Aquarium. That's why all squids will be built into a single Docker image which is available via IPFS.

We also support the following user stories:

Manifest file format

The file consists of the following sections

A minimal manifest file is as follows:

manifestVersion: subsquid.io/v0.1
name: sample-squid
version: 1
description: |-
  The very first squid from manifest  

build: 

deploy:
  addons:
    postgres: 
  processor:
    cmd: [ "node", "lib/processor" ] 
  api:
    cmd: [ "npx", "squid-graphql-server"]

A more advanced will be as follows:

manifestVersion: subsquid.io/v0.1
name: sample-squid
version: 1
description: |-
  The very first squid from manifest  

build: 

deploy:
  addons:
    postgres: 
         # additional configs for addons
         version: 14
 # set of secrets that must be defined by the environment
  secrets:
    - ACALA_RPC_ENDPOINT
    - COINGECKO_API_KEY 
  processor:
    environment:
        SQD_DEBUG=sqd:mapping
    env:
       - .deploy.env  # add env variables from a file
    cmd: [ "node", "lib/processor" ] 
  api:
    # custom command
    cmd: [ "npx", "squid-graphql-server", "--subscriptions", "--max-root-fields", "10", "--sql-statement-timeout", "1000" ] 

scale:
  addons:
     postgres:
         read-replicas: 1
         storage: 100G
  processor:
     profile: p1.medium
  api:
     profile: a1.large
     # add three replicas
     replicas: 3

CLI deploy commands

Deploy

sqd deploy <source> [--update] [--manifest] [--hard-reset]. <source> can be as follows:

The deployment flow is as follows:

Environment variables interpolation

sqd deploy will interpolate${} placeholders in the manifest file before making a deployment request. E.g. running sqd deploy manifest.yaml -e NETWORK=kusama will replace all occurrences of ${NETWORK} with `kusama

Accessing squid images

All images of the deployed squids (previously built by Aquairum) will be available from the container registry and later via IPFS. List all images Aquarium: sqd images get [--name]

aintnomoreloyalty commented 1 year ago

If a developer wants to create a new version, do they need to create a separate manifest file or how does that work?

dzhelezov commented 1 year ago

Yes normally you just bump the version in the file

aintnomoreloyalty commented 1 year ago

Hi there What should happen if developer deploys a squid, then changes its name and deploys it from the same directory? @mo4islona

mo4islona commented 1 year ago

@aintnomoreloyalty a new squid will be created

icikibung commented 11 months ago

How to add rpc