Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 2.29 KB

File metadata and controls

71 lines (50 loc) · 2.29 KB

Domus Crawler

A dedicated CLI tool driven by @domus/sync to orchestrate data synchronization between the central DUK system and a local parish database. Designed to be deployed on a mini PC within the parish network.

🚀 Overview

The crawler performs four main tasks:

  1. Seed: Populates local regional data (Provinces, Regencies, Districts, Villages) from BPS sources.
  2. Scrape: Fetches reference data and parishioner records from DUK into a staging area.
  3. Transform: Processes staged data into production-ready tables in the local database.
  4. Sync-Back: Pushes local updates (made in Domus) back to the DUK system.

⚙️ Configuration

The crawler requires the following environment variables. Create a .env file in this directory or pass them to Docker.

Variable Description Example
DATABASE_URL Local PostgreSQL connection string. postgresql://user:pass@localhost:5432/domus
SYNC_TARGET_URL Base URL of the DUK system. https://duk-target.com
SYNC_USERNAME Username for DUK system login. parish_admin
SYNC_PASSWORD Password for DUK system login. ********

🛠️ Usage

Local Development

Running from the monorepo root:

# Show help
pnpm --filter @domus/crawler start help

# Run full pipeline
pnpm --filter @domus/crawler start crawl

# Individual commands
pnpm --filter @domus/crawler start seed
pnpm --filter @domus/crawler start scrape
pnpm --filter @domus/crawler start transform
pnpm --filter @domus/crawler start syncback

Docker Deployment

For production deployment on a mini PC:

  1. Build the image (run from monorepo root):

    docker build -t domus-crawler -f apps/crawler/Dockerfile .
  2. Run the container:

    docker run --rm --env-file .env domus-crawler [command]

    Example: Run full crawl

    docker run --rm --env-file .env domus-crawler crawl

🏗️ Docker Details

The Dockerfile uses a multi-stage build:

  • Base: Installs all monorepo dependencies.
  • Run: Uses tsx to execute the TypeScript source directly, ensuring full compatibility with the monorepo's ESM structure without complex build-time transpilation issues.

Built with ❤️ for Kristus Raja Barong Tongkok Parish.