From a04eb0e42e65e0f016ae08dab042d56472c7d2cc Mon Sep 17 00:00:00 2001 From: Lavysh Alexander Date: Tue, 7 Nov 2023 20:54:55 +0300 Subject: [PATCH 1/9] remove commented msg --- pkg/indexer/decode/message.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/indexer/decode/message.go b/pkg/indexer/decode/message.go index 48c56bf2..ce5058c4 100644 --- a/pkg/indexer/decode/message.go +++ b/pkg/indexer/decode/message.go @@ -212,10 +212,6 @@ func Message( case *fee.MsgPayPacketFeeAsync: d.Msg.Type, d.Msg.Addresses, err = handle.MsgPayPacketFeeAsync() - // transfer module - // case *transferTypes.MsgTransfer: - // d.Msg.Type, d.Msg.Addresses, err = handle.MsgTransfer() - // coreClient module case *coreClient.MsgCreateClient: d.Msg.Type, d.Msg.Addresses, err = handle.MsgCreateClient(height, typedMsg) From 80c910ae5780ea6d9c14b8cb1e97d09208417c5d Mon Sep 17 00:00:00 2001 From: Lavysh Alexander Date: Tue, 7 Nov 2023 22:17:27 +0300 Subject: [PATCH 2/9] added instruction for running indexer on local machine --- .env.example | 10 +++++----- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index a918fc0d..3e85aa46 100644 --- a/.env.example +++ b/.env.example @@ -2,18 +2,18 @@ LOG_LEVEL=debug INDEXER_NAME=celestia_indexer INDEXER_START_LEVEL=1 INDEXER_BLOCK_PERIOD=15 # seconds -CELESTIA_DAL_API_URL= # REQUIRED +CELESTIA_DAL_API_URL= # REQUIRED CELESTIA_DAL_API_TIMEOUT=30 # seconds CELESTIA_DAL_API_RPS=10 -CELESTIA_NODE_AUTH_TOKEN= # REQUIRED FOR DAL API -CELESTIA_NODE_URL= # REQUIRED +CELESTIA_NODE_AUTH_TOKEN= # REQUIRED FOR DAL API +CELESTIA_NODE_URL= # REQUIRED CELESTIA_NODE_RPS=5 CELESTIA_NODE_TIMEOUT=10 # seconds INDEXER_THREADS_COUNT=10 POSTGRES_HOST=db POSTGRES_PORT=5432 -POSTGRES_USER= # REQUIRED -POSTGRES_PASSWORD= # REQUIRED +POSTGRES_USER= # REQUIRED +POSTGRES_PASSWORD= # REQUIRED POSTGRES_DB=celestia API_HOST=127.0.0.1 API_PORT=9876 diff --git a/README.md b/README.md index f4f61951..4766db6c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,55 @@ This is an indexing layer for Celestia DA written in Golang that operates on top of the [Celestia Full node](https://docs.celestia.org/nodes/consensus-full-node/) and stores data in a Postgres database. +## Run +**Prerequisites:** + +- Git for cloning the repository +- [Docker](https://docs.docker.com/engine/install/) must be installed on your machine +- [Go 1.21.2](https://go.dev/doc/install) programming language installed (for development and testing purposes) + +### Local run ### + +Clone the repository: + +```sh +git clone https://github.com/celenium-io/celestia-indexer.git +cd celestia-indexer +``` + +Create `.env` file and set up required environment variables: + +```sh +cp .env.example .env +vim .env +``` + +> **Required environment variables:** +> +> `CELESTIA_DAL_API_URL` - uri for [Celestia Full Storage Node](https://docs.celestia.org/nodes/full-storage-node) +> `CELESTIA_NODE_AUTH_TOKEN` - token with read access level for full storage node. You can get it from your running node instance by command `celestia full auth read` +> `CELESTIA_NODE_URL` - uri to [Celestia Consensus Node](https://docs.celestia.org/nodes/consensus-node) +> `POSTGRES_USER` - username for Postgres +> `POSTGRES_PASSWORD` - password for Postgres +> + +Build the Docker images for the indexer and API: + +```sh +docker compose build +``` + +Start the services using Docker Compose: + +```sh +docker compose up -d +``` + +This will start the indexer and API services as well as a Postgres database instance. +The services will be configured according to the `.env` file and the `docker-compose.yml` file in the repository. + +≠ ## Features ## - [x] RPC node client From ac28009c28d80de669315598410de0fcf28fefcd Mon Sep 17 00:00:00 2001 From: Lavysh Alexander Date: Tue, 7 Nov 2023 22:23:24 +0300 Subject: [PATCH 3/9] clean remove required env vars default values --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cc43502f..dfbf3ada 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,11 +41,11 @@ services: - 127.0.0.1:5432:5432 environment: - POSTGRES_HOST=${POSTGRES_HOST:-db} - - POSTGRES_USER=${POSTGRES_USER:-dipdup} + - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_DB=${POSTGRES_DB:-celestia} - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-changeme} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} healthcheck: - test: ["CMD-SHELL", "pg_isready -U dipdup -d celestia"] + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d celestia"] interval: 10s timeout: 5s retries: 5 From 14debcf4819467d37b77b506c1e4ec3862ee3345 Mon Sep 17 00:00:00 2001 From: Artem Date: Tue, 7 Nov 2023 21:10:24 +0100 Subject: [PATCH 4/9] Fix: docker-compose volume --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index dfbf3ada..7e7489e0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: image: timescale/timescaledb:latest-pg15 restart: always volumes: - - db:/var/lib/postgres/data + - db:/var/lib/postgresql/data ports: - 127.0.0.1:5432:5432 environment: From 06089fc500c877f13db45d66876a35f8db10cb65 Mon Sep 17 00:00:00 2001 From: Artem Date: Tue, 7 Nov 2023 21:18:48 +0100 Subject: [PATCH 5/9] Actualize docker-compose.yml --- docker-compose.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7e7489e0..3c8cb91c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.6" services: indexer: - image: ghcr.io/dipdup-io/celestia-indexer:${TAG:-master} + image: ghcr.io/celenium-io/celestia-indexer:${TAG:-master} build: dockerfile: build/indexer/Dockerfile context: . @@ -20,7 +20,7 @@ services: api: restart: always - image: ghcr.io/dipdup-io/celestia-indexer-api:${TAG:-master} + image: ghcr.io/celenium-io/celestia-indexer-api:${TAG:-master} build: context: . dockerfile: build/api/Dockerfile @@ -33,7 +33,10 @@ services: logging: *celestia-dipdup-logging db: - image: timescale/timescaledb:latest-pg15 + command: + - -cshared_preload_libraries=timescaledb,pg_stat_statements + - -cpg_stat_statements.track=all + image: timescale/timescaledb:2.12.2-pg15 restart: always volumes: - db:/var/lib/postgresql/data From ece5df93f060581dda8ffecb6ac53c17e46e1f07 Mon Sep 17 00:00:00 2001 From: Lavysh Alexander Date: Tue, 7 Nov 2023 23:44:27 +0300 Subject: [PATCH 6/9] cover ports with double quotes --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3c8cb91c..762a69b4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: depends_on: - db ports: - - 127.0.0.1:9876:9876 + - "127.0.0.1:9876:9876" logging: *celestia-dipdup-logging db: @@ -41,7 +41,7 @@ services: volumes: - db:/var/lib/postgresql/data ports: - - 127.0.0.1:5432:5432 + - "127.0.0.1:5432:5432" environment: - POSTGRES_HOST=${POSTGRES_HOST:-db} - POSTGRES_USER=${POSTGRES_USER} From ebbc354747b5653c0bd9951b6f68a4f3041d0195 Mon Sep 17 00:00:00 2001 From: Lavysh Alexander Date: Tue, 7 Nov 2023 23:53:19 +0300 Subject: [PATCH 7/9] .env.example with removed unnecessary api env vars --- .env.example | 3 --- 1 file changed, 3 deletions(-) diff --git a/.env.example b/.env.example index 3e85aa46..1a71bf61 100644 --- a/.env.example +++ b/.env.example @@ -15,10 +15,7 @@ POSTGRES_PORT=5432 POSTGRES_USER= # REQUIRED POSTGRES_PASSWORD= # REQUIRED POSTGRES_DB=celestia -API_HOST=127.0.0.1 -API_PORT=9876 API_RATE_LIMIT=20 API_PROMETHEUS_ENABLED=false API_REQUEST_TIMEOUT=10 -SENTRY_DSN= CELENIUM_ENV=production From 53a96572a3e785ba001bbb9381dfbc0b3072720a Mon Sep 17 00:00:00 2001 From: Lavysh Alexander Date: Tue, 7 Nov 2023 23:56:59 +0300 Subject: [PATCH 8/9] remove dipdup from logging service name --- docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 762a69b4..4fa679f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} depends_on: - db - logging: &celestia-dipdup-logging + logging: &celestia-logging options: max-size: 10m max-file: "5" @@ -30,7 +30,7 @@ services: - db ports: - "127.0.0.1:9876:9876" - logging: *celestia-dipdup-logging + logging: *celestia-logging db: command: @@ -52,6 +52,6 @@ services: interval: 10s timeout: 5s retries: 5 - logging: *celestia-dipdup-logging + logging: *celestia-logging volumes: db: \ No newline at end of file From 321dd7fa9952e2cacb0524c1ff31eb29ed53e6ac Mon Sep 17 00:00:00 2001 From: Lavysh Alexander Date: Wed, 8 Nov 2023 00:15:39 +0300 Subject: [PATCH 9/9] fixed format of env vars in readme --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4766db6c..13f632e7 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ This is an indexing layer for Celestia DA written in Golang that operates on top **Prerequisites:** -- Git for cloning the repository -- [Docker](https://docs.docker.com/engine/install/) must be installed on your machine -- [Go 1.21.2](https://go.dev/doc/install) programming language installed (for development and testing purposes) +- Git +- [Docker](https://docs.docker.com/engine/install/) +- [Go 1.21.2](https://go.dev/doc/install) (for development and testing) ### Local run ### @@ -34,11 +34,11 @@ vim .env > **Required environment variables:** > -> `CELESTIA_DAL_API_URL` - uri for [Celestia Full Storage Node](https://docs.celestia.org/nodes/full-storage-node) -> `CELESTIA_NODE_AUTH_TOKEN` - token with read access level for full storage node. You can get it from your running node instance by command `celestia full auth read` -> `CELESTIA_NODE_URL` - uri to [Celestia Consensus Node](https://docs.celestia.org/nodes/consensus-node) -> `POSTGRES_USER` - username for Postgres -> `POSTGRES_PASSWORD` - password for Postgres +> - `CELESTIA_DAL_API_URL` - uri for [Celestia Full Storage Node](https://docs.celestia.org/nodes/full-storage-node) +> - `CELESTIA_NODE_AUTH_TOKEN` - token with read access level for full storage node. You can get it from your running node instance by command `celestia full auth read` +> - `CELESTIA_NODE_URL` - uri to [Celestia Consensus Node](https://docs.celestia.org/nodes/consensus-node) +> - `POSTGRES_USER` - username for Postgres +> - `POSTGRES_PASSWORD` - password for Postgres > Build the Docker images for the indexer and API: