bh2smith / dune-sync

2 stars 1 forks source link

Dune Sync V2

Usage

Create a configuration file

Configuration is provided in a single YAML file. Refer to the existing config.yaml for an overview. The configuration file consists of three main sections:

Source Definitions

Sources are defined as a list of configurations, each containing:

Destination Definitions

Destinations are defined similarly to sources:

Job Parameters

Each job in the jobs list should contain:

Source Configuration

For Dune sources (ref: Dune1):

For Postgres sources (ref: Postgres):

Destination Configuration

For Dune destinations (ref: Dune):

For Postgres destinations (ref: Postgres):

Define environment

Copy .env.sample to .env and fill out the two required variables

Mount the config and .env files into the container and run the script

You can download the image from GitHub Container Registry:

docker pull ghcr.io/bh2smith/dune-sync:latest

Or build it yourself:

export IMAGE_NAME=dune-sync # (or ghcr.io image above)
docker build -t ${IMAGE_NAME} .

# Base docker command (using config.yaml mounted at /app/config.yaml)
docker run --rm \
    -v "$(pwd)/config.yaml:/app/config.yaml" \
    --env-file .env \
    ${IMAGE_NAME}

# Optional additions:
# - Mount custom config file (requires --config flag)
    -v "$(pwd)/my-config.yaml:/app/my-config.yaml" \
# - Mount queries directory (if using SQL file paths)
    -v "$(pwd)/queries:/app/queries" \
    --config /app/my-config.yaml

Note that postgres queries can also be file paths (they would also need to be mounted into the container).

Local Development

Fill out the empty fields in Sample Env (e.g. DUNE_API_KEY and DB_URL)

docker-compose up -d # Starts postgres container (in the background)
python -m src.main --config config.yaml