Four items from client feedback:
1. Stuck 'Initial Indexing' status. Root cause (by design in Onyx):
docprocessing/utils.py never runs a classic index attempt for INGESTION_API
connectors — documents are pushed via the API, not polled — so
last_finished_status stays null and the badge is stuck even though the docs
are indexed and searchable (also why it's safe: no risk of re-index deleting
the pushed docs). Two-part fix:
- Connector now sets each cc_pair ACTIVE after provisioning (set_cc_pair_active),
which fixes the connector detail page + 'Active Connectors' count.
- Frontend overlay (branding/smb/smb-ui.patch): the Ingestion table shows the
real cc_pair_status for ingestion_api connectors instead of forcing
'Initial Indexing'. Verified live: new cc_pair comes up ACTIVE.
2. Connector name now configurable: ONYX_CONNECTOR_NAME_PREFIX (default 'AIDO SMB').
3. HTTP timeout now configurable: ONYX_HTTP_TIMEOUT (default 60), for large embeds.
4. (Phase 2 already delivered in
|
||
|---|---|---|
| .. | ||
| app | ||
| .env.example | ||
| docker-compose.smb.yml | ||
| Dockerfile | ||
| entrypoint.sh | ||
| README.md | ||
| requirements.txt | ||
AIDO SMB → Onyx Connector (Phase 1)
Syncs files from one or more SMB/CIFS shares into Onyx via the public Ingestion API, with full production behaviour the POC was missing:
- Update & delete sync — changed files are re-indexed in place; files removed from a share are deleted from Onyx (reconciled every cycle).
- Self-provisioning — creates/reuses the Onyx API key and one connector (cc_pair) per source automatically; idempotent across restarts.
- Multi-source via Docker config — any number of shares, defined purely in env.
- Logical path mapping — each document is labelled with the path users
recognise (
\\company\share\…), mapped from the local mount via config.
It runs as a sidecar container and touches no Onyx source code — only the public ingestion + admin APIs — so it survives Onyx upgrades.
Phase 2 (separate) hides the broken file-preview for these SMB documents in the Onyx UI and shows the logical path instead, via the white-label overlay.
How it works
SMB share ──(read-only mount)──▶ smb_connector ──ingestion API──▶ Onyx
│
manifest.json (path → document_id + content hash)
Each cycle, per source:
- Walk the share, hash each eligible file.
- new / changed (hash differs) →
POST /onyx-api/ingestion(upsert by stable id). - gone (in manifest, not on disk) →
DELETE /onyx-api/ingestion/{id}. - Reconcile against Onyx's own doc list so deletes still happen if the manifest is lost.
Document ids are stable (smb::<source>::<hash of relative path>), so re-indexing
a changed file updates it rather than duplicating.
Setup
cd smb-connector
cp .env.example .env
# set ONYX_API_KEY (or ONYX_ADMIN_EMAIL/PASSWORD to auto-create one)
# define your shares in SMB_SOURCES (JSON) or SMB_SOURCE_1_* vars
Then bring it up (same onyx-network):
docker compose -f docker-compose.yml -f smb-connector/docker-compose.smb.yml up -d --build smb_connector
docker compose logs -f smb_connector
SMB mount — two modes
A. In-container mount (recommended, no host mount). The connector mounts each CIFS share itself; you just give it the share + credentials via env:
SMB_SOURCE_1_NAME=Finance
SMB_SOURCE_1_UNC=//nas.company.local/finance # or _SERVER + _SHARE
SMB_SOURCE_1_MOUNT=/mnt/smb/finance # where to mount it in the container
SMB_SOURCE_1_LOGICAL=\\company\finance # path shown in Onyx
SMB_SOURCE_1_USERNAME=svc_onyx
SMB_SOURCE_1_PASSWORD=… # kept in a 0600 creds file, never in the process list
SMB_SOURCE_1_DOMAIN=COMPANY # optional
# SMB_SOURCE_1_VERS=3.0 # SMB dialect, default 3.0
This needs two Linux capabilities on the container (already set in
docker-compose.smb.yml): cap_add: [SYS_ADMIN, DAC_READ_SEARCH] +
security_opt: [apparmor:unconfined] (or privileged: true if your host is
stricter). The host kernel must have the cifs module (standard on Linux). The
share is mounted read-only and unmounted cleanly on container stop.
B. Host mount (legacy). Mount the share on the host and bind-mount it into the
container, and omit the _UNC/_SERVER vars for that source so it isn't
CIFS-mounted a second time — _MOUNT then just points at the bind-mounted path.
Configuration
| Var | Purpose |
|---|---|
ONYX_API_URL |
Onyx API base (e.g. http://api_server:8080) |
ONYX_API_KEY |
API key; if empty, auto-created from admin creds and cached |
ONYX_ADMIN_EMAIL / ONYX_ADMIN_PASSWORD |
Bootstrap creds to auto-create the key + connectors |
SMB_SOURCES |
JSON list of {name, mount, logical, cc_pair_id?} |
SMB_SOURCE_<N>_NAME/_MOUNT/_LOGICAL/_CC_PAIR_ID |
Indexed alternative to SMB_SOURCES |
SMB_SOURCE_<N>_UNC (or _SERVER+_SHARE) |
In-container CIFS mount: the share to mount at _MOUNT |
SMB_SOURCE_<N>_USERNAME/_PASSWORD/_DOMAIN/_VERS |
CIFS credentials + dialect (default 3.0); omit user for guest |
INGESTION_INTERVAL_SECONDS |
Reconcile interval (default 300) |
INCLUDE_EXTENSIONS |
File types to ingest (default pdf,docx,txt,md,csv,xlsx,html) |
MAX_FILE_MB |
Skip files larger than this (default 50) |
State (manifest + cached key/cc_pair) lives in the mounted /app/state volume.
Notes / scope
- Extraction is the light set (PDF, DOCX, XLSX, CSV, TXT/MD, HTML). Legacy
.doc/.xlsand scanned-image PDFs are skipped (no OCR) — Phase-1 scope. - Auth for provisioning: creating the API key/connectors needs one admin credential the first time. At steady state only the cached API key is used.
- API-key auto-creation requires
LICENSE_ENFORCEMENT_ENABLED=falseon the Onyx deployment (verified against v4.5.2): the/admin/api-keyendpoint is EE-tier-gated and returns HTTP 402 when enforcement is on (the default). CE/white-label deployments run with it off, so this is fine — and if you'd rather not rely on it, just supply a pre-madeONYX_API_KEY. Connector/cc_pair creation and the ingestion API itself are not tier-gated and work on plain CE. - Document ids are URL-safe (
smb_<source>_<hash>), matching how Onyx stores/returns them, so update and delete reconcile reliably (verified end-to-end). smb://links can't open from a browser; the logical path is stored for display (Phase 2 surfaces it in the UI and hides the dead preview).