blockwatch-cc / tzindex

Tezos Blockchain Indexer
MIT License
71 stars 12 forks source link

Include chain id into db path #14

Open itkach opened 4 years ago

itkach commented 4 years ago

It would be convenient if data store were scoped to chain, e.g. full db path included chain id so that tzindex instance would gracefully handle switching/pointing to a different tezos network. In particular, this would make it easier to pair tzindex with a sandbox such as flextesa for testing/dev scenarios. Currently tzindex shuts down with an error if the tezos node it points to starts serving different chain data, such as the case when sandbox is started/restarted as a new chain.

echa commented 4 years ago

Thanks, good point. Implementing this feature will need some refactoring. With the current architecture the chain id is unknown at the time database files are created. Will keep this in mind for a future version.

As workaround you can specify a database path as command line argument -p path/to/database/files.

itkach commented 4 years ago

As workaround you can specify a database path as command line argument -p path/to/database/files

Indeed, that should work, but requires a somewhat tedious scripting to coordinate services startup - start sandbox first, get chain id, construct args to start tzindex, whereas with this feature (and a fix for #13) the setup can become very simple - just add flextesa and tzindex to docker stack as described in #13.