-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ed0021
commit 1ca3420
Showing
49 changed files
with
566 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Ignore all | ||
* | ||
|
||
# Add metadata and build files | ||
!demo_etherlink | ||
!pyproject.toml | ||
!pdm.lock | ||
!README.md | ||
|
||
# Add Python code | ||
!**/*.py | ||
**/.*_cache | ||
**/__pycache__ | ||
|
||
# Add configs and scripts (but not env!) | ||
!**/*.graphql | ||
!**/*.json | ||
!**/*.sql | ||
!**/*.yaml | ||
!**/*.yml | ||
!**/*.j2 | ||
!**/.keep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Ignore all | ||
* | ||
!*/ | ||
|
||
# Add metadata and build files | ||
!demo_etherlink | ||
!.gitignore | ||
!.dockerignore | ||
!py.typed | ||
!**/Dockerfile | ||
!**/Makefile | ||
!**/pyproject.toml | ||
!**/pdm.lock | ||
!**/README.md | ||
!**/.keep | ||
|
||
# Add Python code | ||
!**/*.py | ||
**/.*_cache | ||
**/__pycache__ | ||
|
||
# Add configs and scripts (but not env!) | ||
!**/*.graphql | ||
!**/*.json | ||
!**/*.sql | ||
!**/*.yaml | ||
!**/*.yml | ||
!**/*.j2 | ||
!**/*.env.default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# demo_etherlink | ||
|
||
Indexing Etherlink smart rollup transactions | ||
|
||
## Installation | ||
|
||
This project is based on [DipDup](https://dipdup.io), a framework for building featureful dapps. | ||
|
||
You need a Linux/macOS system with Python 3.11 installed. Use our installer for easy setup: | ||
|
||
```shell | ||
curl -Lsf https://dipdup.io/install.py | python3 | ||
``` | ||
|
||
See the [Installation](https://dipdup.io/docs/installation) page for all options. | ||
|
||
## Usage | ||
|
||
Run the indexer in-memory: | ||
|
||
```shell | ||
dipdup run | ||
``` | ||
|
||
Store data in SQLite database: | ||
|
||
```shell | ||
dipdup -c . -c configs/dipdup.sqlite.yml run | ||
``` | ||
|
||
Or spawn a Compose stack: | ||
|
||
```shell | ||
cd deploy | ||
cp .env.default .env | ||
# Edit .env file before running | ||
docker-compose up | ||
``` | ||
|
||
## Development setup | ||
|
||
We recommend [PDM](https://pdm.fming.dev/latest/) for managing Python projects. To set up the development environment: | ||
|
||
```shell | ||
pdm install | ||
$(pdm venv activate) | ||
``` | ||
|
||
Some tools are included to help you keep the code quality high: black, ruff and mypy. Use scripts from the `pyproject.toml` to run checks manually or in CI: | ||
|
||
```shell | ||
# Format code | ||
pdm format | ||
|
||
# Lint code | ||
pdm lint | ||
|
||
# Build Docker image | ||
pdm image | ||
|
||
# Show all available scripts | ||
pdm run --list | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
database: | ||
kind: postgres | ||
host: ${POSTGRES_HOST:-db} | ||
port: 5432 | ||
user: ${POSTGRES_USER:-dipdup} | ||
password: ${POSTGRES_PASSWORD} | ||
database: ${POSTGRES_DB:-dipdup} | ||
|
||
hasura: | ||
url: http://${HASURA_HOST:-hasura}:8080 | ||
admin_secret: ${HASURA_SECRET} | ||
allow_aggregations: true | ||
camel_case: true | ||
|
||
sentry: | ||
dsn: ${SENTRY_DSN:-""} | ||
environment: ${SENTRY_ENVIRONMENT:-""} | ||
|
||
prometheus: | ||
host: 0.0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
database: | ||
kind: sqlite | ||
path: ${SQLITE_PATH:-/tmp/demo_etherlink.sqlite} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
database: | ||
kind: postgres | ||
host: ${POSTGRES_HOST:-demo_etherlink_db} | ||
port: 5432 | ||
user: ${POSTGRES_USER:-dipdup} | ||
password: ${POSTGRES_PASSWORD} | ||
database: ${POSTGRES_DB:-dipdup} | ||
|
||
hasura: | ||
url: http://${HASURA_HOST:-demo_etherlink_hasura}:8080 | ||
admin_secret: ${HASURA_SECRET} | ||
allow_aggregations: false | ||
camel_case: true | ||
|
||
sentry: | ||
dsn: ${SENTRY_DSN:-""} | ||
environment: ${SENTRY_ENVIRONMENT:-""} | ||
|
||
prometheus: | ||
host: 0.0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# To refresh existing project run `dipdup init --base --force` after modifying this file. | ||
# To generate a new project from this replay run `dipdup new --replay <path_to_file>`. | ||
# | ||
spec_version: 2.0 | ||
replay: | ||
dipdup_version: 7 | ||
template: demo_etherlink | ||
package: demo_etherlink | ||
version: 0.0.1 | ||
description: Indexing Etherlink smart rollup transactions | ||
license: MIT | ||
name: John Doe | ||
email: [email protected] | ||
postgres_image: postgres:15 | ||
postgres_data_path: /var/lib/postgresql/data | ||
hasura_image: hasura/graphql-engine:latest | ||
line_length: 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This env file was generated automatically by DipDup. Do not edit it! | ||
# Create a copy with .env extension, fill it with your values and run DipDup with `--env-file` option. | ||
# | ||
HASURA_HOST=hasura | ||
HASURA_SECRET= | ||
POSTGRES_DB=dipdup | ||
POSTGRES_HOST=db | ||
POSTGRES_PASSWORD= | ||
POSTGRES_USER=dipdup | ||
SENTRY_DSN="" | ||
SENTRY_ENVIRONMENT="" | ||
TZKT_URL=https://api.tzkt.io |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM dipdup/dipdup:7 | ||
# FROM ghcr.io/dipdup-io/dipdup:7 | ||
# FROM ghcr.io/dipdup-io/dipdup:next | ||
|
||
# COPY --chown=dipdup pyproject.toml README.md . | ||
# RUN pip install . | ||
|
||
COPY --chown=dipdup . demo_etherlink | ||
WORKDIR demo_etherlink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: "3.8" | ||
name: demo_etherlink | ||
|
||
services: | ||
dipdup: | ||
build: | ||
context: .. | ||
dockerfile: deploy/Dockerfile | ||
command: ["-c", "dipdup.yaml", "-c", "configs/dipdup.sqlite.yaml", "run"] | ||
restart: always | ||
env_file: .env | ||
ports: | ||
- 46339 | ||
- 9000 | ||
volumes: | ||
- sqlite:${SQLITE_PATH:-/tmp/demo_etherlink.sqlite} | ||
|
||
volumes: | ||
sqlite: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
version: "3.8" | ||
name: demo_etherlink | ||
|
||
services: | ||
dipdup: | ||
image: ${IMAGE:-ghcr.io/dipdup-io/dipdup}:${TAG:-7} | ||
depends_on: | ||
- db | ||
- hasura | ||
command: ["-c", "dipdup.yaml", "-c", "configs/dipdup.swarm.yaml", "run"] | ||
env_file: .env | ||
networks: | ||
- internal | ||
- prometheus-private | ||
deploy: | ||
mode: replicated | ||
replicas: ${INDEXER_ENABLED:-1} | ||
labels: | ||
- prometheus-job=${SERVICE} | ||
- prometheus-port=8000 | ||
placement: &placement | ||
constraints: | ||
- node.labels.${SERVICE} == true | ||
logging: &logging | ||
driver: "json-file" | ||
options: | ||
max-size: "10m" | ||
max-file: "10" | ||
tag: "\{\{.Name\}\}.\{\{.ImageID\}\}" | ||
|
||
db: | ||
image: postgres:15 | ||
volumes: | ||
- db:/var/lib/postgresql/data | ||
env_file: .env | ||
environment: | ||
- POSTGRES_USER=dipdup | ||
- POSTGRES_DB=dipdup | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U postgres"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
networks: | ||
- internal | ||
deploy: | ||
mode: replicated | ||
replicas: 1 | ||
placement: *placement | ||
logging: *logging | ||
|
||
hasura: | ||
image: hasura/graphql-engine:latest | ||
depends_on: | ||
- db | ||
environment: | ||
- HASURA_GRAPHQL_DATABASE_URL=postgres://dipdup:${POSTGRES_PASSWORD}@demo_etherlink_db:5432/dipdup | ||
- HASURA_GRAPHQL_ADMIN_SECRET=${HASURA_SECRET} | ||
- HASURA_GRAPHQL_ENABLE_CONSOLE=true | ||
- HASURA_GRAPHQL_DEV_MODE=false | ||
- HASURA_GRAPHQL_LOG_LEVEL=warn | ||
- HASURA_GRAPHQL_ENABLE_TELEMETRY=false | ||
- HASURA_GRAPHQL_UNAUTHORIZED_ROLE=user | ||
- HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES=true | ||
networks: | ||
- internal | ||
- traefik-public | ||
deploy: | ||
mode: replicated | ||
replicas: 1 | ||
labels: | ||
- traefik.enable=true | ||
- traefik.http.services.${SERVICE}.loadbalancer.server.port=8080 | ||
- "traefik.http.routers.${SERVICE}.rule=Host(`${HOST}`) && (PathPrefix(`/v1/graphql`) || PathPrefix(`/api/rest`))" | ||
- traefik.http.routers.${SERVICE}.entrypoints=http,${INGRESS:-ingress} | ||
- "traefik.http.routers.${SERVICE}-console.rule=Host(`${SERVICE}.${SWARM_ROOT_DOMAIN}`)" | ||
- traefik.http.routers.${SERVICE}-console.entrypoints=https | ||
- traefik.http.middlewares.${SERVICE}-console.headers.customrequestheaders.X-Hasura-Admin-Secret=${HASURA_SECRET} | ||
- traefik.http.routers.${SERVICE}-console.middlewares=authelia@docker,${SERVICE}-console | ||
placement: *placement | ||
logging: *logging | ||
|
||
volumes: | ||
db: | ||
|
||
networks: | ||
internal: | ||
traefik-public: | ||
external: true | ||
prometheus-private: | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
version: "3.8" | ||
name: demo_etherlink | ||
|
||
services: | ||
dipdup: | ||
build: | ||
context: .. | ||
dockerfile: deploy/Dockerfile | ||
restart: always | ||
env_file: .env | ||
ports: | ||
- 46339 | ||
- 9000 | ||
command: ["-c", "dipdup.yaml", "-c", "configs/dipdup.compose.yaml", "run"] | ||
depends_on: | ||
- db | ||
- hasura | ||
|
||
db: | ||
image: postgres:15 | ||
ports: | ||
- 5432 | ||
volumes: | ||
- db:/var/lib/postgresql/data | ||
restart: always | ||
env_file: .env | ||
environment: | ||
- POSTGRES_USER=dipdup | ||
- POSTGRES_DB=dipdup | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U dipdup"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
hasura: | ||
image: hasura/graphql-engine:latest | ||
ports: | ||
- 8080 | ||
depends_on: | ||
- db | ||
restart: always | ||
environment: | ||
- HASURA_GRAPHQL_DATABASE_URL=postgres://dipdup:${POSTGRES_PASSWORD}@db:5432/dipdup | ||
- HASURA_GRAPHQL_ADMIN_SECRET=${HASURA_SECRET} | ||
- HASURA_GRAPHQL_ENABLE_CONSOLE=true | ||
- HASURA_GRAPHQL_DEV_MODE=true | ||
- HASURA_GRAPHQL_LOG_LEVEL=info | ||
- HASURA_GRAPHQL_ENABLE_TELEMETRY=false | ||
- HASURA_GRAPHQL_UNAUTHORIZED_ROLE=user | ||
- HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES=true | ||
|
||
volumes: | ||
db: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This env file was generated automatically by DipDup. Do not edit it! | ||
# Create a copy with .env extension, fill it with your values and run DipDup with `--env-file` option. | ||
# | ||
SQLITE_PATH=/tmp/demo_etherlink.sqlite | ||
TZKT_URL=https://api.tzkt.io |
Oops, something went wrong.