Skip to content

Commit

Permalink
feat(indexer): Add api to docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Cory authored and Will Cory committed Jun 9, 2023
1 parent 722812d commit 242ec64
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 34 deletions.
2 changes: 2 additions & 0 deletions indexer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ FROM alpine:3.15

COPY --from=builder /go/indexer/indexer /usr/local/bin

RUN mkdir /configs

CMD ["indexer"]
19 changes: 19 additions & 0 deletions indexer/Dockerfile.refresh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM golang:1.18.0-alpine3.15 as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash

COPY ./indexer /go/indexer
COPY ./.git /go/.git
COPY ./indexer/go.mod /go/indexer/go.mod
COPY ./indexer/go.sum /go/indexer/go.sum


WORKDIR /go/indexer
RUN make indexer-refresh

FROM alpine:3.15

COPY --from=builder /go/indexer/indexer-refresh /usr/local/bin

CMD ["indexer-refresh"]

61 changes: 27 additions & 34 deletions indexer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,24 @@ services:
volumes:
- postgres_data:/data/postgres

indexer:
api:
build:
context: ..
dockerfile: indexer/Dockerfile
dockerfile: indexer/Dockerfile.refresh
command: ["indexer-refresh", "api"]
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=${INDEXER_BEDROCK_L1_STANDARD_BRIDGE:-0x636Af16bf2f682dD3109e60102b8E1A089FedAa8}
- INDEXER_BEDROCK_OPTIMISM_PORTAL=${INDEXER_BEDROCK_OPTIMISM_PORTAL:-0xB7040fd32359688346A3D1395a42114cf8E3b9b2}
- INDEXER_L1_ADDRESS_MANAGER_ADDRESS=${INDEXER_L1_ADDRESS_MANAGER_ADDRESS:-0xdE1FCfB0851916CA5101820A69b13a4E276bd81F}
ports:
- 8080:8080
environment:
- INDEXER_DB_PORT=5432
- INDEXER_DB_USER=db_username
- INDEXER_DB_PASSWORD=db_password
- INDEXER_DB_NAME=db_name
- INDEXER_DB_HOST=postgres
- INDEXER_CONFIG=/configs/indexer.toml
volumes:
- ./indexer.toml:/configs/indexer.toml
depends_on:
postgres:
condition: service_healthy
Expand All @@ -55,25 +46,27 @@ services:
- DATABASE_URL=${DATABASE_URL:-postgresql://db_username:db_password@postgres:5432/db_name}
ports:
- 5555:5555

healthcheck:
test: wget localhost:5555 -q -O - > /dev/null 2>&1
depends_on:
postgres:
condition: service_healthy

prisma-check:
restart: "no"
build:
context: ..
dockerfile: indexer/ui/Dockerfile
command: ./prisma.sh --check
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://db_username:db_password@postgres:5432/db_name}
depends_on:
indexer:
condition: service_healthy
postgres:
condition: service_healthy
# add back once indexer is added
# prisma-check:
# restart: "no"
# build:
# context: ..
# dockerfile: indexer/ui/Dockerfile
# command: ./prisma.sh --check
# environment:
# - DATABASE_URL=${DATABASE_URL:-postgresql://db_username:db_password@postgres:5432/db_name}
# depends_on:
# indexer:
# condition: service_healthy
# postgres:
# condition: service_healthy

volumes:
postgres_data:

0 comments on commit 242ec64

Please sign in to comment.