Skip to content

Commit

Permalink
chore: update indexer in local environment (#2268)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul121 committed Jan 25, 2024
1 parent 8789af0 commit 04fd3b7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ services:
container_name: indexer_container
environment:
DATABASE_URL: postgres://postgres:password@localhost:5432/indexer
ROOT_DATABASE_URL: postgres://postgres:password@localhost:5432/postgres
REGEN_API: http://127.0.0.1:1317
REGEN_RPC: http://127.0.0.1:26657
entrypoint: ["/bin/sh", "-c", "./scripts/indexer_start.sh"]
Expand Down
14 changes: 4 additions & 10 deletions docker/indexer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM python:3.9-slim
FROM python:3.9

# Install dependencies
RUN apt-get update
RUN apt-get install git libpq-dev gcc postgresql-client -y
RUN apt-get install libpq-dev postgresql-client nodejs python3-poetry yarnpkg -y

# Set version and chain
ENV GIT_CHECKOUT='8d3635aa33d4d49db903f947bb357c938d168f8d'
ENV GIT_CHECKOUT='07ba5fa054e34d2a0587daa944c8e517ff82ce18'

# Clone regen ledger
RUN git clone https://github.com/regen-network/indexer/ /home/indexer
Expand All @@ -16,15 +16,9 @@ WORKDIR /home/indexer
# Use provided version
RUN git checkout $GIT_CHECKOUT

# Install python dependencies
RUN pip install poetry
RUN pip install load_dotenv
RUN pip install psycopg2
RUN pip install sentry_sdk
RUN pip install tenacity

# Install indexer
RUN poetry install
RUN yarnpkg install

# Copy indexer init script
COPY docker/scripts/indexer_init.sh /home/indexer/scripts/
Expand Down
2 changes: 1 addition & 1 deletion docker/scripts/indexer_init.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# run migrations
(cd sql && ./run_all_migrations.sh)
yarnpkg run db-init

# workaround for indexer starting with new chain
psql "$DATABASE_URL" -c "INSERT INTO chain (
Expand Down
2 changes: 1 addition & 1 deletion docker/scripts/indexer_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ if [ ! -e $INDEXER_INITIALIZED ]; then
fi

# start indexer
python main.py
poetry run python main.py

0 comments on commit 04fd3b7

Please sign in to comment.