Skip to content

Commit

Permalink
Increase query timeout & merge docker images (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio authored Jul 10, 2023
1 parent b44c193 commit 7b8ad3a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
15 changes: 3 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,12 @@ EXPOSE 3000
EXPOSE 4000


FROM squid AS processor
FROM squid AS efinity-indexer

LABEL org.opencontainers.image.source=https://github.com/efinity/indexer
LABEL org.opencontainers.image.description="Efinity Indexer - Processor"
LABEL org.opencontainers.image.description="Efinity Blockchain Indexer"
LABEL org.opencontainers.image.licenses=GPLv3

COPY --chmod=0755 start.sh .

CMD ["/bin/sh", "-c", "/squid/start.sh"]


FROM squid AS query-node

LABEL org.opencontainers.image.source=https://github.com/efinity/indexer
LABEL org.opencontainers.image.description="Efinity Indexer - GraphQL"
LABEL org.opencontainers.image.licenses=GPLv3

CMD ["npx", "squid-graphql-server", "--subscriptions", "--dumb-cache", "in-memory", "--dumb-cache-ttl", "12000", "--dumb-cache-size", "1024", "--dumb-cache-max-age", "12000", "--max-root-fields", "10", "--sql-statement-timeout", "3000"]
CMD ["/bin/sh", "-c", "/squid/start.sh"]
11 changes: 6 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,24 @@ services:
indexer_processor:
container_name: indexer_processor
restart: unless-stopped
image: ghcr.io/efinity/indexer-processor:${VERSION:-latest}
image: ghcr.io/efinity/indexer:${VERSION:-latest}
environment:
CONTAINER_ROLE: processor
build:
context: .
target: processor
volumes:
- .env:/squid/.env
depends_on:
- indexer_redis
- indexer_db

indexer_graphql:
container_name: indexer_graphql
restart: unless-stopped
image: ghcr.io/efinity/indexer-graphql:${VERSION:-latest}
image: ghcr.io/efinity/indexer:${VERSION:-latest}
environment:
CONTAINER_ROLE: graphql
build:
context: .
target: query-node
ports:
- "4467:4347"
volumes:
Expand Down
14 changes: 12 additions & 2 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/usr/bin/env sh
set -e

npm run db:migrate
npm run processor:debug
role=${CONTAINER_ROLE:-app}

if [ "$role" = "processor" ]; then
npm run db:migrate
npm run processor:debug
elif [ "$role" = "graphql" ]; then
npx squid-graphql-server --subscriptions --dumb-cache in-memory --dumb-cache-ttl 12000 --dumb-cache-size 1024 --dumb-cache-max-age 12000 --max-root-fields 10 --sql-statement-timeout 5000
else
echo "Could not match the container role \"$role\""
exit 1
fi

0 comments on commit 7b8ad3a

Please sign in to comment.