aido-onyx/smb-connector/.env.example
Naeem Dosh afac2c42ae SMB connector: mount CIFS shares inside the container (like Lobehub)
Client asked to mount the SMB share in Docker rather than on the host. Added an
opt-in in-container CIFS mount:
- entrypoint.sh mounts each source's share (mount -t cifs) from env
  (SMB_SOURCE_<N>_UNC or _SERVER+_SHARE, _USERNAME/_PASSWORD/_DOMAIN/_VERS),
  read-only, credentials via a 0600 file (never in the process list), then drops
  from root to the unprivileged app user via gosu and execs the sync app;
  unmounts cleanly on stop.
- Dockerfile installs cifs-utils + gosu, runs the mount entrypoint.
- docker-compose.smb.yml adds cap_add [SYS_ADMIN, DAC_READ_SEARCH] +
  apparmor:unconfined (privileged fallback noted).
- .env.example + README document in-container mode; legacy host-bind-mount mode
  still works (omit _UNC/_SERVER for that source).

Entrypoint logic validated (POSIX sh check + mocked dry-run: correct mount args,
guest fallback, creds file, privilege drop). Live CIFS round-trip to be run
against a real SMB server; the sync engine is already E2E-verified.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-08 23:14:46 +05:00

58 lines
2.8 KiB
Text

# ─────────────────────────────────────────────────────────────────────────────
# AIDO SMB → Onyx sync connector
# 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: SMB mounted INSIDE the container (recommended) ──────────────────
# Give each share its SMB connection details and the connector mounts it itself
# (CIFS) — no host mount required. Uses the indexed style so each source can carry
# credentials. Requires the cap_add + apparmor lines in docker-compose.smb.yml.
#
# _MOUNT = where to mount it inside the container (any path)
# _UNC = //server/share (or set _SERVER + _SHARE)
# _LOGICAL = the path users recognise; shown in Onyx's citation view
# _USERNAME/_PASSWORD/_DOMAIN = CIFS credentials (omit user for guest)
# _VERS = SMB dialect, default 3.0
# _CC_PAIR_ID (optional) = use a specific connector; auto-provisioned if omitted
SMB_SOURCE_1_NAME=Finance
SMB_SOURCE_1_UNC=//nas.company.local/finance
SMB_SOURCE_1_MOUNT=/mnt/smb/finance
SMB_SOURCE_1_LOGICAL=\\company\finance
SMB_SOURCE_1_USERNAME=svc_onyx
SMB_SOURCE_1_PASSWORD=change-me
SMB_SOURCE_1_DOMAIN=COMPANY
# SMB_SOURCE_1_VERS=3.0
# SMB_SOURCE_2_NAME=Legal
# SMB_SOURCE_2_SERVER=nas.company.local
# SMB_SOURCE_2_SHARE=legal
# SMB_SOURCE_2_MOUNT=/mnt/smb/legal
# SMB_SOURCE_2_LOGICAL=\\company\legal
# SMB_SOURCE_2_USERNAME=svc_onyx
# SMB_SOURCE_2_PASSWORD=change-me
# SMB_SOURCE_2_DOMAIN=COMPANY
# ── Legacy: host-mounted shares (still supported) ────────────────────────────
# If you'd rather mount on the host and bind-mount into the container, OMIT the
# _UNC/_SERVER lines for that source (so it isn't CIFS-mounted here) and point
# _MOUNT at the bind-mounted path. You can also use the JSON form:
# SMB_SOURCES=[{"name":"Finance","mount":"/mnt/smb/finance","logical":"\\\\company\\finance"}]