CoolFace
Apppublic

hftestx/52c75d7a

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
USAGE.md143 linesDownload Raw Back to docs
1# Usage Guide2 3Quick reference for configuring and using the Universal HF Docker Template.4 5## Environment Variables6 7### Core Configuration8| Variable | Default | Description |9|----------|---------|-------------|10| `SERVICE_PORT` | `7860` | Port for your core service |11| `MODEL_NAME` | - | Hugging Face model name to load |12| `SERVICE_TITLE` | `My HF Model Service` | Title for your service interface |13| `HF_TOKEN` | - | Hugging Face API token |14| `DEBUG_MODE` | `false` | Enable debug logging |15 16### Optional Services17| Variable | Default | Description |18|----------|---------|-------------|19| `FILEBROWSER_ENABLED` | `false` | Enable web-based file management |20| `WEBDAV_ENABLED` | `false` | Enable WebDAV file synchronization service |21| `PERSISTENCE_ENABLED` | `false` | Enable automatic backup/restore |22| `RESTIC_ENABLED` | `false` | Enable restic backup service |23| `CLOUDFLARED_ENABLED` | `false` | Enable Cloudflare tunnel |24| `FRPC_ENABLED` | `false` | Enable frpc reverse proxy |25 26⚠️ **Important**: `PERSISTENCE_ENABLED` and `RESTIC_ENABLED` cannot both be `true` at the same time, you can only choose one backup service.27 28### Service-Specific Configuration29| Variable | Default | Description |30|----------|---------|-------------|31| `DATASET_ID` | - | Dataset ID for backups (`username/dataset-name`) |32| `SYNC_INTERVAL` | `7200` | Backup interval in seconds |33| `WEBDAV_HOST` | `0.0.0.0` | WebDAV server host address |34| `WEBDAV_PORT` | `8081` | WebDAV server port |35| `WEBDAV_USERNAME` | `webdav` | WebDAV authentication username |36| `WEBDAV_PASSWORD` | `webdav123` | WebDAV authentication password |37| `WEBDAV_ROOT_DIR` | `/home/user/webdav` | WebDAV root directory |38| `WEBDAV_ENABLE_UI` | `true` | Enable WebDAV web interface |39| `CLOUDFLARED_TUNNEL_TOKEN` | - | Cloudflare tunnel token |40| `FRPC_SERVER_ADDR` | - | frp server address |41| `FRPC_AUTH_TOKEN` | - | frp authentication token |42 43## Configuration Examples44 45### Basic Development Setup46```bash47# Minimal configuration for testing48SERVICE_PORT=786049MODEL_NAME=distilbert-base-uncased50DEBUG_MODE=true51FILEBROWSER_ENABLED=true52WEBDAV_ENABLED=true53```54 55### Production Gradio Service56```bash57# Core service58SERVICE_PORT=786059MODEL_NAME=microsoft/DialoGPT-medium60SERVICE_TITLE="My Chat Bot"61HF_TOKEN=your_hf_token62 63# Infrastructure64FILEBROWSER_ENABLED=true65WEBDAV_ENABLED=true66WEBDAV_PASSWORD=secure_password_12367PERSISTENCE_ENABLED=true68DATASET_ID=username/dataset69CLOUDFLARED_ENABLED=true70CLOUDFLARED_TUNNEL_TOKEN=your_tunnel_token71```72 73### Custom Service with Persistence74```bash75# Your custom service configuration76SERVICE_PORT=786077HF_TOKEN=your_token78 79# Data persistence80PERSISTENCE_ENABLED=true81DATASET_ID=username/dataset82SYNC_INTERVAL=360083 84# File management85FILEBROWSER_ENABLED=true86```87 88## Port Configuration89 90The template uses these ports by default:91 92| Port | Service | Description |93|------|---------|-------------|94| `7860` | Core Service | HuggingFace Spaces standard port |95| `8080` | File Browser | Web-based file management |96| `8081` | WebDAV | File synchronization protocol |97| `9000` | Minio API | S3-compatible object storage |98| `9001` | Minio Console | Web management interface |99 100Configure `SERVICE_PORT` to change the core service port if needed. Individual services can be configured with their respective environment variables.101 102## Troubleshooting103 104| Problem | Solution |105|---------|----------|106| Service won't start | Check `scripts/start/core-service-start.sh` exists and is executable |107| Permission denied | Verify file ownership: `chown user:user /home/user/script/start/*` |108| Service not starting | Check `*_ENABLED=true` and required environment variables |109| Cloudflared fails | Verify `CLOUDFLARED_TUNNEL_TOKEN` is valid |110| File Browser inaccessible | Ensure `FILEBROWSER_ENABLED=true` and port is available |111| WebDAV not working | Check `WEBDAV_ENABLED=true` and verify credentials |112| WebDAV access denied | Verify `WEBDAV_USERNAME` and `WEBDAV_PASSWORD` are correct |113| Backup fails | Verify `HF_TOKEN` has write access to `DATASET_ID` |114| Variables not set | Check Hugging Face Spaces settings |115| Boolean values | Use lowercase `true`/`false` |116 117### Debugging Commands118```bash119# Check running processes120ps aux | grep -E "(python|cloudflared|frpc|filebrowser|flydav)"121 122# Check environment variables123env | grep -E "(SERVICE_|MODEL_|ENABLED|TOKEN|WEBDAV_)"124 125# Check service logs126tail -f /tmp/*.log127 128# Test network connectivity129curl -I http://localhost:7860    # Core service130curl -I http://localhost:8080    # File Browser131curl -I http://localhost:8081    # WebDAV132 133# Test WebDAV connectivity (with authentication)134curl -I -u username:password http://localhost:8081/webdav135```136 137## Best Practices138 139- Use Hugging Face Spaces secrets for sensitive tokens140- Test configuration locally before deploying141- Monitor resource usage and adjust `SYNC_INTERVAL` accordingly142- Document custom environment variables for your service143