# ๐Ÿš€ Deployment Scripts Guide ## ๐Ÿ“ Deployment Tools To support quick local deployment of async_context_compression and other Filter plugins, we've added the following files: ### File Inventory ``` scripts/ โ”œโ”€โ”€ install_all_plugins.py โœจ Batch install Action/Filter/Pipe/Tool plugins โ”œโ”€โ”€ deploy_filter.py โœจ Generic Filter deployment tool โ”œโ”€โ”€ deploy_tool.py โœจ Tool plugin deployment tool โ”œโ”€โ”€ deploy_async_context_compression.py โœจ Async Context Compression quick deploy โ”œโ”€โ”€ deploy_pipe.py (existing) Pipe deployment tool โ”œโ”€โ”€ DEPLOYMENT_GUIDE.md โœจ Complete deployment guide โ”œโ”€โ”€ DEPLOYMENT_SUMMARY.md โœจ Deploy feature summary โ”œโ”€โ”€ QUICK_START.md โœจ Quick reference card โ”œโ”€โ”€ .env (create as needed) API key configuration โ””โ”€โ”€ ...other existing scripts ``` ## โšก Quick Start (30 seconds) ### Step 1: Prepare Your API Key ```bash cd scripts # Get your OpenWebUI API key: # 1. Open OpenWebUI โ†’ User menu โ†’ Settings # 2. Find the "API Keys" section # 3. Copy your key (starts with sk-) # Create .env file cat > .env <<'EOF' api_key=sk-your-key-here url=http://localhost:3000 EOF ``` ### Step 2a: Install All Plugins (Recommended) ```bash python install_all_plugins.py ``` ### Step 2b: Or Deploy Individual Plugins ```bash # Easiest way - dedicated script python deploy_async_context_compression.py # Or use generic script python deploy_filter.py # Or specify plugin name python deploy_filter.py async-context-compression # Or deploy a Tool python deploy_tool.py ``` ## ๐Ÿ“‹ Deployment Tools Detailed ### 1๏ธโƒฃ `deploy_async_context_compression.py` โ€” Dedicated Deployment Script **The simplest way to deploy!** ```bash cd scripts python deploy_async_context_compression.py ``` **Features**: - โœ… Optimized specifically for async_context_compression - โœ… Clear deployment steps and confirmation - โœ… Friendly error messages - โœ… Shows next steps after successful deployment **Sample Output**: ``` ====================================================================== ๐Ÿš€ Deploying Async Context Compression Filter Plugin ====================================================================== ๐Ÿ“ฆ Deploying filter 'Async Context Compression' (version 1.3.0)... File: /path/to/async_context_compression.py โœ… Successfully updated 'Async Context Compression' filter! ====================================================================== โœ… Deployment successful! ====================================================================== Next steps: 1. Open OpenWebUI in your browser: http://localhost:3000 2. Go to Settings โ†’ Filters 3. Enable 'Async Context Compression' 4. Configure Valves as needed 5. Start using the filter in conversations ``` ### 2๏ธโƒฃ `deploy_filter.py` โ€” Generic Filter Deployment Tool **Supports all Filter plugins!** ```bash # Deploy default async_context_compression python deploy_filter.py # Deploy other Filters python deploy_filter.py folder-memory python deploy_filter.py context_enhancement_filter # List all available Filters python deploy_filter.py --list ``` **Features**: - โœ… Generic Filter deployment tool - โœ… Supports multiple plugins - โœ… Auto metadata extraction - โœ… Smart update/create logic - โœ… Complete error diagnostics ### 3๏ธโƒฃ `deploy_pipe.py` โ€” Pipe Deployment Tool ```bash python deploy_pipe.py ``` Used to deploy Pipe-type plugins (like GitHub Copilot SDK). ### 3๏ธโƒฃ+ `deploy_tool.py` โ€” Tool Deployment Tool ```bash # Deploy default Tool python deploy_tool.py # Or specify a specific Tool python deploy_tool.py openwebui-skills-manager ``` **Features**: - โœ… Supports Tools plugin deployment - โœ… Auto-detects `Tools` class definition - โœ… Smart update/create logic - โœ… Complete error diagnostics **Use Case**: Deploy or reinstall a specific Tool individually, or deploy only Tools without running full batch installation. The script now calls OpenWebUI's native `/api/v1/tools/*` endpoints. ### 4๏ธโƒฃ `install_all_plugins.py` โ€” Batch Installation Script One-command installation of all repository plugins that meet these criteria: - Located in `plugins/actions`, `plugins/filters`, `plugins/pipes`, `plugins/tools` - Plugin header contains `openwebui_id` - Filename is not in Chinese characters - Filename does not end with `_cn.py` ```bash # Check which plugins will be installed python install_all_plugins.py --list # Dry-run without calling API python install_all_plugins.py --dry-run # Actually install all supported types (including Action/Filter/Pipe/Tool) python install_all_plugins.py # Install only specific types python install_all_plugins.py --types pipe action ``` The script prioritizes updating existing plugins and automatically creates new ones. **Tool Integration**: Tool-type plugins now automatically use OpenWebUI's native `/api/v1/tools/create` and `/api/v1/tools/id/{id}/update` endpoints, no longer reusing the `functions` endpoint. ## ๐Ÿ”ง How It Works ``` Your code changes โ†“ Run deployment script โ†“ Script reads the corresponding plugin file โ†“ Auto-extracts metadata from code (title, version, author, etc.) โ†“ Builds API request โ†“ Sends to local OpenWebUI โ†“ OpenWebUI updates or creates plugin โ†“ Takes effect immediately! (no restart needed) ``` ## ๐Ÿ“Š Available Filter List Use `python deploy_filter.py --list` to see all available Filters: | Filter Name | Python File | Description | |-----------|-----------|------| | **async-context-compression** | async_context_compression.py | Async context compression | | chat-session-mapping-filter | chat_session_mapping_filter.py | Chat session mapping | | context_enhancement_filter | context_enhancement_filter.py | Context enhancement | | folder-memory | folder_memory.py | Folder memory | | github_copilot_sdk_files_filter | github_copilot_sdk_files_filter.py | Copilot SDK Files | | markdown_normalizer | markdown_normalizer.py | Markdown normalization | | web_gemini_multimodel_filter | web_gemini_multimodel_filter.py | Gemini multimodal | ## ๐ŸŽฏ Common Use Cases ### Scenario 1: Deploy After Feature Development ```bash # 1. Modify code vim ../plugins/filters/async-context-compression/async_context_compression.py # 2. Update version number (optional) # version: 1.3.0 โ†’ 1.3.1 # 3. Deploy python deploy_async_context_compression.py # 4. Test in OpenWebUI # โ†’ No restart needed, takes effect immediately! # 5. Continue development and repeat ``` ### Scenario 2: Fix Bug and Verify Quickly ```bash # 1. Find and fix bug vim ../plugins/filters/async-context-compression/async_context_compression.py # 2. Quick deploy to verify python deploy_async_context_compression.py # 3. Test bug fix in OpenWebUI # One-command deploy, instant feedback! ``` ### Scenario 3: Deploy Multiple Filters ```bash # Deploy all Filters that need updates python deploy_filter.py async-context-compression python deploy_filter.py folder-memory python deploy_filter.py context_enhancement_filter ``` ## ๐Ÿ” Security Tips ### Manage API Keys ```bash # 1. Create .env (local only) echo "api_key=sk-your-key" > .env # 2. Add to .gitignore (prevent commit) echo "scripts/.env" >> ../.gitignore # 3. Verify it won't be committed git status # should not show .env # 4. Rotate keys regularly # โ†’ Generate new key in OpenWebUI Settings # โ†’ Update .env file ``` ### โœ… Security Checklist - [ ] `.env` file is in `.gitignore` - [ ] Never hardcode API keys in code - [ ] Rotate API keys periodically - [ ] Use only on trusted networks - [ ] Use CI/CD secret management in production ## โŒ Troubleshooting ### Issue 1: "Connection error" ``` โŒ Connection error: Could not reach OpenWebUI at localhost:3000 Make sure OpenWebUI is running and accessible. ``` **Solution**: ```bash # 1. Check if OpenWebUI is running curl http://localhost:3000 # 2. If port is different, edit URL in script # Default: http://localhost:3000 # Location: "localhost:3000" in deploy_filter.py # 3. Check firewall settings ``` ### Issue 2: ".env file not found" ``` โŒ [ERROR] .env file not found at .env Please create it with: api_key=sk-xxxxxxxxxxxx ``` **Solution**: ```bash echo "api_key=sk-your-api-key" > .env cat .env # verify file created ``` ### Issue 3: "Filter not found" ``` โŒ [ERROR] Filter 'xxx' not found in .../plugins/filters ``` **Solution**: ```bash # List all available Filters python deploy_filter.py --list # Retry with correct name python deploy_filter.py async-context-compression ``` ### Issue 4: "Status 401" (Unauthorized) ``` โŒ Failed to update or create. Status: 401 Error: {"error": "Unauthorized"} ``` **Solution**: ```bash # 1. Verify API key is correct grep "api_key=" .env # 2. Check if key is still valid in OpenWebUI # Settings โ†’ API Keys โ†’ Check # 3. Generate new key and update .env echo "api_key=sk-new-key" > .env ``` ## ๐Ÿ“– Documentation Navigation | Document | Description | |------|------| | **README.md** (this file) | Quick reference and FAQs | | [QUICK_START.md](QUICK_START.md) | One-page cheat sheet | | [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md) | Complete detailed guide | | [DEPLOYMENT_SUMMARY.md](DEPLOYMENT_SUMMARY.md) | Technical architecture | ## ๐Ÿงช Verify Deployment Success ### Method 1: Check Script Output ```bash python deploy_async_context_compression.py # Success indicator: โœ… Successfully updated 'Async Context Compression' filter! ``` ### Method 2: Verify in OpenWebUI 1. Open OpenWebUI: 2. Go to Settings โ†’ Filters 3. Check if 'Async Context Compression' is listed 4. Verify version number is correct (should be latest) ### Method 3: Test Plugin Functionality 1. Open a new conversation 2. Enable 'Async Context Compression' Filter 3. Have multiple-turn conversation and verify compression/summarization works ## ๐Ÿ’ก Advanced Usage ### Automated Deploy & Test ```bash #!/bin/bash # deploy_and_test.sh echo "Deploying plugin..." python scripts/deploy_async_context_compression.py if [ $? -eq 0 ]; then echo "โœ… Deploy successful, running tests..." python -m pytest tests/plugins/filters/async-context-compression/ -v else echo "โŒ Deploy failed" exit 1 fi ``` ### CI/CD Integration ```yaml # .github/workflows/deploy.yml name: Deploy on Push on: [push] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 - name: Deploy Async Context Compression run: python scripts/deploy_async_context_compression.py env: api_key: ${{ secrets.OPENWEBUI_API_KEY }} ``` ## ๐Ÿ“ž Getting Help ### Check Script Status ```bash # List all available scripts ls -la scripts/*.py # Check if deployment scripts exist ls -la scripts/deploy_*.py ``` ### View Script Help ```bash # View help (if supported) python scripts/deploy_filter.py --help # if supported python scripts/deploy_async_context_compression.py --help ``` ### Debug Mode ```bash # Save output to log file python scripts/deploy_async_context_compression.py | tee deploy.log # Check log cat deploy.log ``` --- ## ๐Ÿ“ File Checklist Newly created deployment-related files: ``` โœจ scripts/deploy_filter.py (new) ~300 lines โœจ scripts/deploy_async_context_compression.py (new) ~70 lines โœจ scripts/DEPLOYMENT_GUIDE.md (new) complete guide โœจ scripts/DEPLOYMENT_SUMMARY.md (new) technical summary โœจ scripts/QUICK_START.md (new) quick reference ๐Ÿ“„ tests/scripts/test_deploy_filter.py (new) 10 unit tests โœ… โœ… All files created and tested successfully! ``` --- **Last Updated**: 2026-03-09 **Script Status**: โœ… Ready for production **Test Coverage**: 10/10 passed โœ