To run this project, you will need to add the following environment variables to your .env file
PORT
: server port, ex: 4000
HTTP_PROVIDER_HOST
: JSON-RPC node URL, ex: http://172.17.0.1:8545
MONGODB_URI
: MongoDB instance URL, ex: mongodb://host.docker.internal:27017
$ DOCKER_DEFAULT_PLATFORM=linux/amd64 docker build -t aymantaybi/eth-logs-indexer-mongodb:latest .
$ docker run -p 4000:4000 --name indexer -e PORT=4000 -e MONGODB_URI=mongodb://host.docker.internal:27017 -e HTTP_PROVIDER_HOST=http://172.17.0.1:8545 -d aymantaybi/eth-logs-indexer-mongodb
setOptions
Mutation.executeAggregation
Query.autoStart
Option.
executeQuery
Mutation: removechainId
&filterId
from required mutation arguments.
- Create logs collection compound & unique index
{ 'transaction.blockNumber': 1, 'transaction.transactionIndex': 1, logIndex: 1 }
at server startup.
- Use
bulkWrite
withreplaceOne
operations instead ofinsertMany
for logs saving, useful if you want to restart the indexer at an earlier block number and avoid adding duplicate logs.
- Set options at server startup.
- Allow passing custom timeout argument for stop mutation.