Production SMB->Onyx sync sidecar (public ingestion + admin APIs only; no Onyx source changes; upgrade-safe). Verified end-to-end against a live Onyx v4.5.2. Core (app/sync.py): per-cycle reconcile — upsert new/changed (stable url-safe document ids so updates replace in place), delete files removed from the share, plus manifest-independent reconcile against Onyx's own doc list. Content-hash change detection; per-source + per-file failure isolation. Self-provisioning (app/onyx_client.py): create/cache API key (admin bootstrap) and one connector/cc_pair per source via connector-with-mock-credential; idempotent reuse via the grouped indexing-status lookup. Multi-source (app/config.py): JSON SMB_SOURCES or indexed SMB_SOURCE_N_*; logical path mapping (mount -> \\company\share) shown in citations. Extraction (app/extract.py): pdf/docx/xlsx/csv/txt/md/html, light deps. State manifest (atomic), entrypoint loop w/ graceful shutdown + retry/backoff. Dockerfile, compose snippet, .env.example, README. Bugs caught + fixed during live E2E (missed by code review + stub tests): - Onyx URL-encodes document ids -> switched to url-safe ids + store Onyx's returned canonical id, so delete/reconcile match. - connector listing endpoint + provision-response parsing corrected (indexing-status is grouped by source; StatusResponse.data = cc_pair_id). - Documented: auto API-key creation needs LICENSE_ENFORCEMENT_ENABLED=false (the /admin/api-key endpoint is EE-tier-gated); ingestion + connector creation are not. E2E results (live Onyx): ingest 2 docs w/ logical paths; change->update-in-place with stable ids; remove->delete synced; auto-provision create + idempotent reuse; multi- source config both styles.
38 lines
2 KiB
Text
38 lines
2 KiB
Text
# ─────────────────────────────────────────────────────────────────────────────
|
|
# AIDO SMB → Onyx sync connector (Phase 1)
|
|
# Copy to .env and adjust. The connector runs as a sidecar next to Onyx.
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
|
|
# Onyx API base (in-compose service name; no trailing /api needed).
|
|
ONYX_API_URL=http://api_server:8080
|
|
|
|
# Auth — provide ONE of:
|
|
# (a) a pre-created API key (simplest), or
|
|
# (b) admin credentials so the connector creates + caches its own key on first boot.
|
|
ONYX_API_KEY=
|
|
# ONYX_ADMIN_EMAIL=admin@example.com
|
|
# ONYX_ADMIN_PASSWORD=change-me
|
|
|
|
# How often to reconcile each share (seconds).
|
|
INGESTION_INTERVAL_SECONDS=300
|
|
|
|
# File selection.
|
|
INCLUDE_EXTENSIONS=pdf,docx,txt,md,csv,xlsx,html,htm
|
|
MAX_FILE_MB=50
|
|
LOG_LEVEL=INFO
|
|
|
|
# ── Sources ──────────────────────────────────────────────────────────────────
|
|
# Preferred: one JSON list (scales to any number of shares, no code changes).
|
|
# 'mount' = local path where the SMB share is mounted (read-only) in this container
|
|
# 'logical' = the path users recognise; shown in Onyx's citation view
|
|
# 'cc_pair_id' (optional) = use a specific connector; auto-provisioned if omitted.
|
|
SMB_SOURCES=[{"name":"Finance","mount":"/shares/finance","logical":"\\\\company\\finance"},{"name":"Legal","mount":"/shares/legal","logical":"\\\\company\\legal"}]
|
|
|
|
# …or the indexed style instead of SMB_SOURCES:
|
|
# SMB_SOURCE_1_NAME=Finance
|
|
# SMB_SOURCE_1_MOUNT=/shares/finance
|
|
# SMB_SOURCE_1_LOGICAL=\\company\finance
|
|
# SMB_SOURCE_1_CC_PAIR_ID=
|
|
# SMB_SOURCE_2_NAME=Legal
|
|
# SMB_SOURCE_2_MOUNT=/shares/legal
|
|
# SMB_SOURCE_2_LOGICAL=\\company\legal
|