Sign inSign up

panarican/openwebui-knowledge-sync

By panarican

•Updated 5 months ago

Image
0

3.0K

panarican/openwebui-knowledge-sync repository overview

⁠OpenWebUI Knowledge Sync

Syncs knowledge sources (Google Drive, Git repos) to OpenWebUI⁠ knowledge bases on a configurable schedule.

⁠Quick Start

  1. Create a docker-compose.yml:
services:
  openwebui-knowledge-sync:
    image: panarican/openwebui-knowledge-sync:latest
    container_name: openwebui-knowledge-sync
    restart: unless-stopped
    env_file:
      - .env
    volumes:
      - ./config.yml:/app/config.yml:ro
      - ./keys:/app/keys:ro
      - ./data:/app/data
      - ./logs:/var/log/openwebui-knowledge-sync
  1. Create a .env file:
# Required
OPENWEBUI_BASE_URL=https://your-openwebui-instance.com
OPENWEBUI_API_KEY=sk-your-api-key-here

# Optional
SYNC_CRON=0 3 * * *
TZ=America/New_York
  1. Create a config.yml (see Configuration section below)

  2. Run:

docker-compose up -d
⁠Docker Run
docker run -d \
  --name openwebui-knowledge-sync \
  --env-file .env \
  -v $(pwd)/config.yml:/app/config.yml:ro \
  -v $(pwd)/keys:/app/keys:ro \
  -v $(pwd)/data:/app/data \
  -v $(pwd)/logs:/var/log/openwebui-knowledge-sync \
  --restart unless-stopped \
  panarican/openwebui-knowledge-sync:latest

⁠Environment Variables

VariableRequiredDefaultDescription
OPENWEBUI_BASE_URL✅-OpenWebUI instance URL
OPENWEBUI_API_KEY✅-OpenWebUI API key
SYNC_CRON❌0 3 * * *Cron schedule (default: daily 3 AM)
TZ❌America/New_YorkTimezone for cron
CONFIG_PATH❌./config.ymlPath to config file
RESET_KNOWLEDGE_BASES❌trueClear KB before sync
DELETE_ORPHAN_FILES❌trueDelete removed files
DRY_RUN❌falsePreview without changes
PARALLEL_SYNC❌falseSync sources in parallel
MAX_RETRIES❌3Max retry attempts
⁠Cron Schedule Examples
SYNC_CRON=0 3 * * *       # Daily at 3 AM
SYNC_CRON=0 */6 * * *     # Every 6 hours
SYNC_CRON=0 9,17 * * 1-5  # 9 AM and 5 PM weekdays
SYNC_CRON=*/30 * * * *    # Every 30 minutes

⁠Configuration (config.yml)

knowledgeBases:
  # Google Drive source
  - name: "My Google Docs"
    description: "Documentation from Google Drive"
    source:
      type: google-drive
      folderId: "your-google-drive-folder-id"
      keyFile: "./keys/google-service-account.json"
    outputDir: "./data/knowledge-base/Google-Docs"

  # Git repository source
  - name: "My Wiki"
    description: "GitLab wiki content"
    source:
      type: git
      repo: "[email protected]:your-org/your-project.wiki.git"
      keyFile: "./keys/id_gitlab"
      shallow: true
    outputDir: "./data/knowledge-base/My-Wiki"

⁠Volume Mounts

PathDescription
/app/config.ymlKnowledge base configuration
/app/dataSynced content (persistent)
/app/keysService account & SSH keys
/var/log/openwebui-knowledge-syncSync logs

⁠Manual Sync

Run a sync manually (outside of cron schedule):

docker exec openwebui-knowledge-sync npm run sync

⁠View Logs

# Container logs
docker logs -f openwebui-knowledge-sync

# Sync logs
docker exec openwebui-knowledge-sync cat /var/log/openwebui-knowledge-sync/sync.log

Tag summary

Content type

Image

Digest

sha256:61265ff84…

Size

416.9 MB

Last updated

5 months ago

docker pull panarican/openwebui-knowledge-sync