apibara / dna

Apibara is the fastest platform to build production-grade indexers that connect onchain data to web2 services.
https://www.apibara.com/
Apache License 2.0
166 stars 26 forks source link

`apibara up` command to run multiple indexers at the same time #226

Open fracek opened 10 months ago

fracek commented 10 months ago

Is your feature request related to a problem? Please describe.

At the moment, if I want to run multiple indexers concurrently, I need to create many terminal windows and run each one of them with apibara run my-indexer.ts. If I change my code, I then need to restart them individually.

Describe the solution you'd like

We should have a configuration file (apibara.config.ts) where I can define all indexers I want to run. Then there should be a command apibara up that reads this configuration file and starts the indexers defined there.

The configuration file should be in typescript/javascript so that developers can read environment variables and generate the indexers configuration at runtime.

export default {
  indexers: {
    "indexer-1": {
      script: "src/indexer1.ts",
      env: {
       "KEY_1": "value_1"
     }
    },
    "inedxer-2": {
      script: "src/indexer2.ts",
    }
  },
  persistence: {
    fs: ".apibara",
   // etcd: "http://localohst:2379"
  }
}

Notice that the key of the indexers property will be used as the sink-id if persistence is enabled.

This feature requires some planning:

Describe alternatives you've considered

We could use yaml/json for configuration. I believe using typescript is better because we get the following for free:

Additional context

This is related to the work on factory indexers.

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had activity in the six months. It will be closed in 2 weeks if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant.