diff --git a/indexer/.gitignore b/indexer/.gitignore new file mode 100644 index 0000000000000..8310373ee53d8 --- /dev/null +++ b/indexer/.gitignore @@ -0,0 +1,3 @@ +docker-compose.dev.yml +.env + diff --git a/indexer/README.md b/indexer/README.md new file mode 100644 index 0000000000000..e4d22377af028 --- /dev/null +++ b/indexer/README.md @@ -0,0 +1,23 @@ +# @eth-optimism/indexer + +## Getting started + +### Run indexer vs goerli + +- install docker +- `cp example.env .env` +- fill in .env +- run `docker-compose up` to start the indexer vs optimism goerli network + +### Run indexer with go + +See the flags in `flags.go` for reference of what command line flags to pass to `go run` + +### Run indexer vs devnet + +TODO add indexer to the optimism devnet compose file (previously removed for breaking CI) + +### Run indexer vs a custom configuration + +`docker-compose.dev.yml` is git ignored. Fill in your own docker-compose file here. + diff --git a/indexer/docker-compose.yml b/indexer/docker-compose.yml new file mode 100644 index 0000000000000..856da8cde819e --- /dev/null +++ b/indexer/docker-compose.yml @@ -0,0 +1,50 @@ +version: '3.8' + +services: + postgres: + image: postgres:latest + environment: + - POSTGRES_USER=db_username + - POSTGRES_PASSWORD=db_password + - POSTGRES_DB=db_name + - PGDATA=/data/postgres + - POSTGRES_HOST_AUTH_METHOD=trust + healthcheck: + test: [ "CMD-SHELL", "pg_isready -q -U db_username -d db_name" ] + ports: + - "5434:5432" + volumes: + - postgres_data:/data/postgres + + indexer: + build: + context: .. + dockerfile: indexer/Dockerfile + healthcheck: + test: wget localhost:8080/healthz -q -O - > /dev/null 2>&1 + environment: + # Note that you must index goerli with INDEXER_BEDROCK=false first, then + # reindex with INDEXER_BEDROCK=true or seed the database + - INDEXER_BEDROCK=${INDEXER_BEDROCK_GOERLI:-true} + - INDEXER_BUILD_ENV=${INDEXER_BUILD_ENV:-development} + - INDEXER_DB_PORT=${INDEXER_DB_PORT:-5432} + - INDEXER_DB_USER=${INDEXER_DB_USER:-db_username} + - INDEXER_DB_PASSWORD=${INDEXER_DB_PASSWORD:-db_password} + - INDEXER_DB_NAME=${INDEXER_DB_NAME:-db_name} + - INDEXER_DB_HOST=${INDEXER_DB_HOST:-postgres} + - INDEXER_CHAIN_ID=${INDEXER_CHAIN_ID:-5} + - INDEXER_L1_ETH_RPC=$INDEXER_L1_ETH_RPC + - INDEXER_L2_ETH_RPC=$INDEXER_L2_ETH_RPC + - INDEXER_REST_HOSTNAME=0.0.0.0 + - INDEXER_REST_PORT=8080 + - INDEXER_BEDROCK_L1_STANDARD_BRIDGE=0 + - INDEXER_BEDROCK_L1_STANDARD_BRIDGE=0x636Af16bf2f682dD3109e60102b8E1A089FedAa8 + - INDEXER_BEDROCK_OPTIMISM_PORTAL=0xB7040fd32359688346A3D1395a42114cf8E3b9b2 + ports: + - 8080:8080 + depends_on: + postgres: + condition: service_healthy + +volumes: + postgres_data: diff --git a/indexer/example.env b/indexer/example.env new file mode 100644 index 0000000000000..ed38dc179e388 --- /dev/null +++ b/indexer/example.env @@ -0,0 +1,4 @@ +# Fill me in with goerli uris and run docker-compose up to run indexer vs goerli +INDEXER_L1_ETH_RPC=FILL_ME_IN +INDEXER_L2_ETH_RPC=FILL_ME_IN +