--- title: OpenWebUI emoji: 🤖 colorFrom: blue colorTo: purple sdk: docker pinned: true app_port: 8080 suggested_hardware: cpu-basic suggested_storage: medium short_description: OpenWebUI with automated GitHub data sync tags: - openwebui - chat - llm - ai - docker - data-sync - backup --- # OpenWebUI with Data Synchronization A self-hosted OpenWebUI instance with automated data backup and synchronization to GitHub. ## Features - 🤖 **Full OpenWebUI**: Chat interface for AI models - 🔄 **Auto Sync**: Backs up `webui.db`, `uploads/`, `vector_db/` to GitHub - 🛡️ **Safe Backups**: SQLite hot backups prevent corruption - 📦 **Git LFS**: Handles large files in uploads/vector_db - ⏰ **Configurable**: Custom sync intervals and timezone - 🌐 **WebDAV Support**: Optional secondary backup location ## Environment Variables Set these in your Space's **Repository Secrets**: ### Required | Variable | Description | Example | |----------|-------------|---------| | `G_NAME` | GitHub repo | `username/openwebui-db` | | `G_TOKEN` | GitHub PAT | `github_pat_xxx...` | ### Optional | Variable | Description | Default | |----------|-------------|---------| | `SYNC_INTERVAL` | Sync frequency (seconds) | `3600` | | `SYNC_TIMEZONE` | Timezone for logs | `Asia/Kolkata` | | `GIT_USER_NAME` | Commit author | `AutoSync Bot` | | `GIT_USER_EMAIL` | Commit email | `autosync@bot.com` | | `WEBDAV_URL` | WebDAV server URL | - | | `WEBDAV_USERNAME` | WebDAV user | - | | `WEBDAV_PASSWORD` | WebDAV password | - | ## GitHub Token Setup 1. Go to [GitHub Token Settings](https://github.com/settings/tokens) 2. Create a **Fine-grained token** 3. Select your backup repository 4. Grant **Contents**: Read and Write ## Setup 1. Create a private GitHub repository for backups 2. Generate a GitHub Personal Access Token 3. Add `G_NAME` and `G_TOKEN` to Space secrets 4. Deploy and enjoy persistent storage! ## How It Works 1. **Startup**: Clones your GitHub repo and restores data 2. **Runtime**: Syncs every `SYNC_INTERVAL` seconds 3. **Backup**: Creates SQLite hot backup, syncs uploads/vector_db 4. **Push**: Commits and pushes changes to GitHub 5. **WebDAV**: Optionally uploads timestamped backup to WebDAV Check out the [configuration reference](https://huggingface.co/docs/hub/spaces-config-reference) for more details.