Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLS 85 instructions for self deployment #34

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@ LOG_LEVEL=debug
INDEXER_NAME=celestia_indexer
INDEXER_START_LEVEL=1
INDEXER_BLOCK_PERIOD=15 # seconds
CELESTIA_DAL_API_URL=<TODO_INSERT_DAL_NODE_URL> # REQUIRED
CELESTIA_DAL_API_URL=<TODO_INSERT_DAL_NODE_URL> # REQUIRED
CELESTIA_DAL_API_TIMEOUT=30 # seconds
CELESTIA_DAL_API_RPS=10
CELESTIA_NODE_AUTH_TOKEN=<TODO_INSERT_RPC_TOKEN> # REQUIRED FOR DAL API
CELESTIA_NODE_URL=<TODO_INSERT_NODE_URL> # REQUIRED
CELESTIA_NODE_AUTH_TOKEN=<TODO_INSERT_RPC_TOKEN> # REQUIRED FOR DAL API
CELESTIA_NODE_URL=<TODO_INSERT_NODE_URL> # REQUIRED
CELESTIA_NODE_RPS=5
CELESTIA_NODE_TIMEOUT=10 # seconds
INDEXER_THREADS_COUNT=10
POSTGRES_HOST=db
POSTGRES_PORT=5432
POSTGRES_USER=<TODO_INSERT_DB_USER> # REQUIRED
POSTGRES_PASSWORD=<TODO_INSERT_DB_PASSWORD> # REQUIRED
POSTGRES_USER=<TODO_INSERT_DB_USER> # REQUIRED
POSTGRES_PASSWORD=<TODO_INSERT_DB_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=<TODO_INSERT_SENTRY_DSN>
CELENIUM_ENV=production
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- [Docker](https://docs.docker.com/engine/install/)
- [Go 1.21.2](https://go.dev/doc/install) (for development and testing)

### 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
Expand Down
27 changes: 15 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
Expand All @@ -13,14 +13,14 @@ services:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
depends_on:
- db
logging: &celestia-dipdup-logging
logging: &celestia-logging
options:
max-size: 10m
max-file: "5"

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
Expand All @@ -29,26 +29,29 @@ services:
depends_on:
- db
ports:
- 127.0.0.1:9876:9876
logging: *celestia-dipdup-logging
- "127.0.0.1:9876:9876"
logging: *celestia-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/postgres/data
- 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:-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
logging: *celestia-dipdup-logging
logging: *celestia-logging
volumes:
db:
4 changes: 0 additions & 4 deletions pkg/indexer/decode/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading