Skip to content

Latest commit

 

History

History
90 lines (63 loc) · 3.04 KB

File metadata and controls

90 lines (63 loc) · 3.04 KB

DEX.DO-indexer

Writer-side service. It ingests Acki Nacki chain data, decodes DEX events, and maintains the Postgres read-model served by services/api.

Specifications

Implementation details belong in the tech specs above, not in this README.

Configuration

Config file: config/indexer.<env>.yaml. Local default: config/indexer.local.yaml. Override with APP_CONFIG=/path/to/file.yaml.

Config sections:

  • app: environment name and log level.
  • database: Postgres URL and pool settings.
  • graphql: gateway endpoint, page size, request timeout.
  • indexer: polling/reconciliation/reprojection intervals and ignored addresses.

Logging is configured by environment variables, not YAML: RUST_LOG sets the filter (default info), and LOG_DIR (optional) makes the service additionally write daily-rotated indexer.log.<date> files into that directory, retaining LOG_MAX_FILES of them (default 14). See docs/deployment.md.

Database

The indexer applies SQL migrations from migrations/ on startup. Column and table semantics live in docs/tech-specs/data-schema.md.

On a fresh Supabase project, grant the application role permissions on public before the first run:

grant usage, create on schema public to indexer;
grant all privileges on all tables    in schema public to indexer;
grant all privileges on all sequences in schema public to indexer;
alter default privileges in schema public grant all on tables    to indexer;
alter default privileges in schema public grant all on sequences to indexer;

Replace indexer with the role name from the pooler username.

Running

cargo run -p dodex-indexer

Reload config in a running process:

kill -USR1 <pid>

Restart the process for changes that are documented as startup-pinned in the indexer tech spec.

Tests

Unit tests:

cargo test -p dodex-infrastructure --lib

DB-backed indexer/infrastructure tests:

docker compose -f docker-compose.test.yml up -d --wait
export TEST_DATABASE_URL=postgres://dodex:dodex@localhost:55432/dodex_test
cargo test -p dodex-infrastructure --tests
docker compose -f docker-compose.test.yml down

The test database role must own public because the test suite runs migrations on connect.

Deployment

Self-hosting the service (Docker Compose, own GraphQL + Postgres/Supabase) is covered in docs/deployment.md; the repository-level entry point is README.md.