mirror of https://github.com/Nezreka/SoulSync.git
Introduces Docker deployment files (.dockerignore, Dockerfile, docker-compose.yml, docker-setup.sh, requirements-webui.txt, and README-Docker.md) for SoulSync WebUI. Refactors core/database_update_worker.py and core/media_scan_manager.py to support headless operation without PyQt6, enabling signal/callback compatibility for both GUI and non-GUI environments. Removes logs/app.log file.pull/15/head
parent
4e30e90777
commit
287d2fd2ec
@ -0,0 +1,70 @@
|
||||
# Docker ignore file for SoulSync WebUI
|
||||
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
.gitattributes
|
||||
|
||||
# IDE and editor files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
*.egg-info/
|
||||
dist/
|
||||
build/
|
||||
|
||||
# Virtual environments
|
||||
venv/
|
||||
env/
|
||||
ENV/
|
||||
|
||||
# Data directories (will be mounted as volumes)
|
||||
logs/*
|
||||
!logs/.gitkeep
|
||||
database/*.db
|
||||
database/*.db-shm
|
||||
database/*.db-wal
|
||||
config/config.json
|
||||
downloads/*
|
||||
!downloads/.gitkeep
|
||||
Transfer/*
|
||||
!Transfer/.gitkeep
|
||||
Storage/*
|
||||
cache/*
|
||||
Stream/*
|
||||
Incomplete/*
|
||||
|
||||
# Temporary files
|
||||
artist_bubble_snapshots.json
|
||||
.spotify_cache
|
||||
|
||||
# Documentation
|
||||
*.md
|
||||
README.md
|
||||
headless.md
|
||||
multi-server-database-plan.md
|
||||
server-source.md
|
||||
plans.md
|
||||
|
||||
# GUI-specific files
|
||||
main.py
|
||||
ui/
|
||||
requirements.txt
|
||||
|
||||
# OS generated files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
@ -0,0 +1,52 @@
|
||||
# SoulSync WebUI Dockerfile
|
||||
# Multi-architecture support for AMD64 and ARM64
|
||||
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
libc6-dev \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create non-root user for security
|
||||
RUN useradd --create-home --shell /bin/bash --uid 1000 soulsync
|
||||
|
||||
# Copy requirements and install Python dependencies
|
||||
COPY requirements-webui.txt .
|
||||
RUN pip install --no-cache-dir --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements-webui.txt
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
|
||||
# Create necessary directories with proper permissions
|
||||
RUN mkdir -p /app/config /app/database /app/logs /app/downloads /app/Transfer && \
|
||||
chown -R soulsync:soulsync /app
|
||||
|
||||
# Create volume mount points
|
||||
VOLUME ["/app/config", "/app/database", "/app/logs", "/app/downloads", "/app/Transfer"]
|
||||
|
||||
# Switch to non-root user
|
||||
USER soulsync
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8008
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD curl -f http://localhost:8008/ || exit 1
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONPATH=/app
|
||||
ENV FLASK_APP=web_server.py
|
||||
ENV FLASK_ENV=production
|
||||
|
||||
# Run the web server
|
||||
CMD ["python", "web_server.py"]
|
||||
@ -0,0 +1,271 @@
|
||||
# SoulSync WebUI - Docker Deployment Guide
|
||||
|
||||
## 🐳 Quick Start
|
||||
|
||||
### Prerequisites
|
||||
- Docker Engine 20.10+
|
||||
- Docker Compose 1.29+
|
||||
- At least 2GB RAM and 10GB free disk space
|
||||
|
||||
### 1. Setup
|
||||
```bash
|
||||
# Clone or download the repository
|
||||
git clone <your-repo-url>
|
||||
cd newmusic
|
||||
|
||||
# Run setup script
|
||||
chmod +x docker-setup.sh
|
||||
./docker-setup.sh
|
||||
```
|
||||
|
||||
### 2. Configure
|
||||
Edit `config/config.json` with your API keys and server settings:
|
||||
```json
|
||||
{
|
||||
"spotify": {
|
||||
"client_id": "your_spotify_client_id",
|
||||
"client_secret": "your_spotify_client_secret"
|
||||
},
|
||||
"plex": {
|
||||
"url": "http://your-plex-server:32400",
|
||||
"token": "your_plex_token"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Deploy
|
||||
```bash
|
||||
# Start SoulSync
|
||||
docker-compose up -d
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f
|
||||
|
||||
# Access the web interface
|
||||
open http://localhost:8008
|
||||
```
|
||||
|
||||
## 📁 Volume Mounts
|
||||
|
||||
SoulSync requires persistent storage for:
|
||||
|
||||
- **`./config`** → `/app/config` - Configuration files
|
||||
- **`./database`** → `/app/database` - SQLite database files
|
||||
- **`./logs`** → `/app/logs` - Application logs
|
||||
- **`./downloads`** → `/app/downloads` - Downloaded music files
|
||||
- **`./Transfer`** → `/app/Transfer` - Processed/matched music files
|
||||
|
||||
## 🔧 Configuration Options
|
||||
|
||||
### Environment Variables
|
||||
```yaml
|
||||
environment:
|
||||
- FLASK_ENV=production # Flask environment
|
||||
- PYTHONPATH=/app # Python path
|
||||
- SOULSYNC_CONFIG_PATH=/app/config/config.json # Config file location
|
||||
- TZ=America/New_York # Timezone
|
||||
```
|
||||
|
||||
### Port Configuration
|
||||
Default port is `8008`. To change:
|
||||
```yaml
|
||||
ports:
|
||||
- "9999:8008" # Access on port 9999
|
||||
```
|
||||
|
||||
### Resource Limits
|
||||
Adjust based on your system:
|
||||
```yaml
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4.0' # Max CPU cores
|
||||
memory: 4G # Max RAM
|
||||
reservations:
|
||||
cpus: '1.0' # Minimum CPU
|
||||
memory: 1G # Minimum RAM
|
||||
```
|
||||
|
||||
## 🚀 Advanced Setup
|
||||
|
||||
### Multi-Architecture Support
|
||||
The Docker image supports both AMD64 and ARM64:
|
||||
```bash
|
||||
# Build for specific architecture
|
||||
docker buildx build --platform linux/amd64,linux/arm64 -t soulsync-webui .
|
||||
```
|
||||
|
||||
### Custom Network
|
||||
For integration with other containers:
|
||||
```yaml
|
||||
networks:
|
||||
media:
|
||||
external: true
|
||||
```
|
||||
|
||||
### External Services
|
||||
Connect to external Plex/Jellyfin servers:
|
||||
```yaml
|
||||
extra_hosts:
|
||||
- "plex.local:192.168.1.100"
|
||||
- "jellyfin.local:192.168.1.101"
|
||||
```
|
||||
|
||||
## 🔍 Troubleshooting
|
||||
|
||||
### Check Container Status
|
||||
```bash
|
||||
docker-compose ps
|
||||
docker-compose logs soulsync
|
||||
```
|
||||
|
||||
### Common Issues
|
||||
|
||||
**Permission Denied**
|
||||
```bash
|
||||
sudo chown -R 1000:1000 config database logs downloads Transfer
|
||||
```
|
||||
|
||||
**Port Already in Use**
|
||||
```bash
|
||||
# Check what's using port 8888
|
||||
sudo lsof -i :8888
|
||||
# Change port in docker-compose.yml
|
||||
```
|
||||
|
||||
**Out of Memory**
|
||||
```bash
|
||||
# Increase memory limits in docker-compose.yml
|
||||
# Or free up system memory
|
||||
```
|
||||
|
||||
### Health Check
|
||||
The container includes health checks:
|
||||
```bash
|
||||
docker inspect --format='{{.State.Health.Status}}' soulsync-webui
|
||||
```
|
||||
|
||||
## 📊 Monitoring
|
||||
|
||||
### View Real-time Logs
|
||||
```bash
|
||||
docker-compose logs -f --tail=100
|
||||
```
|
||||
|
||||
### Container Stats
|
||||
```bash
|
||||
docker stats soulsync-webui
|
||||
```
|
||||
|
||||
### Database Size
|
||||
```bash
|
||||
du -sh database/
|
||||
```
|
||||
|
||||
## 🔄 Updates
|
||||
|
||||
### Pull Latest Image
|
||||
```bash
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Backup Before Update
|
||||
```bash
|
||||
# Backup data
|
||||
tar -czf soulsync-backup-$(date +%Y%m%d).tar.gz config/ database/ logs/
|
||||
|
||||
# Update
|
||||
docker-compose pull && docker-compose up -d
|
||||
```
|
||||
|
||||
## 🛠️ Development
|
||||
|
||||
### Build Local Image
|
||||
```bash
|
||||
docker build -t soulsync-webui .
|
||||
```
|
||||
|
||||
### Development Mode
|
||||
```yaml
|
||||
# In docker-compose.yml
|
||||
environment:
|
||||
- FLASK_ENV=development
|
||||
volumes:
|
||||
- .:/app # Mount source code for live reload
|
||||
```
|
||||
|
||||
## 🔐 Security
|
||||
|
||||
### Non-Root User
|
||||
The container runs as user `soulsync` (UID 1000) for security.
|
||||
|
||||
### Network Security
|
||||
```yaml
|
||||
# Restrict to localhost only
|
||||
ports:
|
||||
- "127.0.0.1:8888:8888"
|
||||
```
|
||||
|
||||
### Firewall
|
||||
```bash
|
||||
# Allow only local access
|
||||
sudo ufw allow from 192.168.1.0/24 to any port 8888
|
||||
```
|
||||
|
||||
## 📋 Complete Example
|
||||
|
||||
Here's a complete `docker-compose.yml` for production:
|
||||
|
||||
```yaml
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
soulsync:
|
||||
build: .
|
||||
container_name: soulsync-webui
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8888:8888"
|
||||
volumes:
|
||||
- ./config:/app/config
|
||||
- ./database:/app/database
|
||||
- ./logs:/app/logs
|
||||
- ./downloads:/app/downloads
|
||||
- ./Transfer:/app/Transfer
|
||||
- /mnt/music:/music:ro # Your music library
|
||||
environment:
|
||||
- FLASK_ENV=production
|
||||
- TZ=America/New_York
|
||||
- PYTHONPATH=/app
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.0'
|
||||
memory: 2G
|
||||
reservations:
|
||||
cpus: '0.5'
|
||||
memory: 512M
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8888/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
```
|
||||
|
||||
## 🎯 Production Checklist
|
||||
|
||||
- [ ] Configure proper API keys in `config/config.json`
|
||||
- [ ] Set appropriate resource limits
|
||||
- [ ] Configure proper volume mounts
|
||||
- [ ] Set up log rotation
|
||||
- [ ] Configure firewall rules
|
||||
- [ ] Set up backup strategy
|
||||
- [ ] Test health checks
|
||||
- [ ] Verify external service connectivity
|
||||
@ -0,0 +1,46 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
soulsync:
|
||||
build: .
|
||||
container_name: soulsync-webui
|
||||
ports:
|
||||
- "8008:8008"
|
||||
volumes:
|
||||
# Persistent data volumes
|
||||
- ./config:/app/config
|
||||
- ./database:/app/database
|
||||
- ./logs:/app/logs
|
||||
- ./downloads:/app/downloads
|
||||
- ./Transfer:/app/Transfer
|
||||
# Optional: Mount your music library for Plex/Jellyfin access
|
||||
- /path/to/your/music:/music:ro
|
||||
environment:
|
||||
# Web server configuration
|
||||
- FLASK_ENV=production
|
||||
- PYTHONPATH=/app
|
||||
# Optional: Configure through environment variables
|
||||
- SOULSYNC_CONFIG_PATH=/app/config/config.json
|
||||
# Set timezone
|
||||
- TZ=America/New_York
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8888/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
# Resource limits (adjust as needed)
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2.0'
|
||||
memory: 2G
|
||||
reservations:
|
||||
cpus: '0.5'
|
||||
memory: 512M
|
||||
|
||||
# Optional: Add external network for communication with other containers
|
||||
networks:
|
||||
default:
|
||||
name: soulsync-network
|
||||
@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SoulSync Docker Setup Script
|
||||
# This script helps set up the Docker environment for SoulSync WebUI
|
||||
|
||||
set -e
|
||||
|
||||
echo "🎵 SoulSync WebUI Docker Setup"
|
||||
echo "==============================="
|
||||
|
||||
# Create necessary directories
|
||||
echo "📁 Creating directory structure..."
|
||||
mkdir -p config database logs downloads Transfer
|
||||
|
||||
# Create .gitkeep files for empty directories
|
||||
touch downloads/.gitkeep Transfer/.gitkeep logs/.gitkeep
|
||||
|
||||
# Copy example config if config.json doesn't exist
|
||||
if [ ! -f "config/config.json" ]; then
|
||||
if [ -f "config/config.example.json" ]; then
|
||||
echo "📋 Copying example configuration..."
|
||||
cp config/config.example.json config/config.json
|
||||
echo "⚙️ Please edit config/config.json with your API keys and settings"
|
||||
else
|
||||
echo "⚠️ Warning: No example config found. You'll need to create config/config.json manually"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set proper permissions
|
||||
echo "🔐 Setting permissions..."
|
||||
chmod -R 755 config database logs downloads Transfer
|
||||
chown -R $USER:$USER config database logs downloads Transfer
|
||||
|
||||
# Check if Docker is installed
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo "❌ Docker is not installed. Please install Docker first."
|
||||
echo " Visit: https://docs.docker.com/get-docker/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Docker Compose is installed
|
||||
if ! command -v docker-compose &> /dev/null; then
|
||||
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
|
||||
echo " Visit: https://docs.docker.com/compose/install/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Setup complete!"
|
||||
echo ""
|
||||
echo "📝 Next steps:"
|
||||
echo "1. Edit config/config.json with your API keys and server settings"
|
||||
echo "2. Run: docker-compose up -d"
|
||||
echo "3. Access SoulSync at http://localhost:8888"
|
||||
echo ""
|
||||
echo "🔧 Useful commands:"
|
||||
echo " docker-compose up -d # Start in background"
|
||||
echo " docker-compose logs -f # View logs"
|
||||
echo " docker-compose down # Stop container"
|
||||
echo " docker-compose pull # Update image"
|
||||
echo " docker-compose restart # Restart container"
|
||||
echo ""
|
||||
echo "📂 Data locations:"
|
||||
echo " - Configuration: ./config/"
|
||||
echo " - Database: ./database/"
|
||||
echo " - Logs: ./logs/"
|
||||
echo " - Downloads: ./downloads/"
|
||||
echo " - Transfer: ./Transfer/"
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,32 @@
|
||||
# SoulSync WebUI Requirements
|
||||
# Docker-compatible requirements without PyQt6 dependencies
|
||||
|
||||
# Core web framework
|
||||
Flask>=3.0.0
|
||||
|
||||
# Music service APIs
|
||||
spotipy>=2.23.0
|
||||
PlexAPI>=4.17.0
|
||||
|
||||
# HTTP and async support
|
||||
requests>=2.31.0
|
||||
aiohttp>=3.9.0
|
||||
|
||||
# Configuration management
|
||||
python-dotenv>=1.0.0
|
||||
|
||||
# Security and encryption
|
||||
cryptography>=41.0.0
|
||||
|
||||
# Media metadata handling
|
||||
mutagen>=1.47.0
|
||||
Pillow>=10.0.0
|
||||
|
||||
# Text processing
|
||||
unidecode>=1.3.8
|
||||
|
||||
# YouTube support
|
||||
yt-dlp>=2024.12.13
|
||||
|
||||
# Optional: MQTT support (for future features)
|
||||
asyncio-mqtt>=0.16.0
|
||||
Loading…
Reference in new issue