Files
HomeAudit/fix_jellyfin_duplication.sh
admin 45363040f3 feat: Complete infrastructure cleanup phase documentation and status updates
## Major Infrastructure Milestones Achieved

###  Service Migrations Completed
- Jellyfin: Successfully migrated to Docker Swarm with latest version
- Vaultwarden: Running in Docker Swarm on OMV800 (eliminated duplicate)
- Nextcloud: Operational with database optimization and cron setup
- Paperless services: Both NGX and AI running successfully

### 🚨 Duplicate Service Analysis Complete
- Identified MariaDB conflict (OMV800 Swarm vs lenovo410 standalone)
- Identified Vaultwarden duplication (now resolved)
- Documented PostgreSQL and Redis consolidation opportunities
- Mapped monitoring stack optimization needs

### 🏗️ Infrastructure Status Documentation
- Updated README with current cleanup phase status
- Enhanced Service Analysis with duplicate service inventory
- Updated Quick Start guide with immediate action items
- Documented current container distribution across 6 nodes

### 📋 Action Plan Documentation
- Phase 1: Immediate service conflict resolution (this week)
- Phase 2: Service migration and load balancing (next 2 weeks)
- Phase 3: Database consolidation and optimization (future)

### 🔧 Current Infrastructure Health
- Docker Swarm: All 6 nodes operational and healthy
- Caddy Reverse Proxy: Fully operational with SSL certificates
- Storage: MergerFS healthy, local storage for databases
- Monitoring: Prometheus + Grafana + Uptime Kuma operational

### 📊 Container Distribution Status
- OMV800: 25+ containers (needs load balancing)
- lenovo410: 9 containers (cleanup in progress)
- fedora: 1 container (ready for additional services)
- audrey: 4 containers (well-balanced, monitoring hub)
- lenovo420: 7 containers (balanced, can assist)
- surface: 9 containers (specialized, reverse proxy)

### 🎯 Next Steps
1. Remove lenovo410 MariaDB (eliminate port 3306 conflict)
2. Clean up lenovo410 Vaultwarden (256MB space savings)
3. Verify no service conflicts exist
4. Begin service migration from OMV800 to fedora/audrey

Status: Infrastructure 99% complete, entering cleanup and optimization phase
2025-09-01 16:50:37 -04:00

124 lines
4.1 KiB
Bash
Executable File

#!/bin/bash
# Fix Jellyfin Duplication Script
# Removes the failing Docker Swarm service and keeps the working standalone container
# Created: $(date)
set -e
echo "=== Fixing Jellyfin Duplication Issue ==="
echo ""
echo "Current Jellyfin instances:"
echo "1. Docker Swarm service (failing): jellyfin_jellyfin"
echo "2. Standalone container (working): jellyfin"
echo ""
# Check Docker Swarm service status
echo "Checking Docker Swarm service status..."
SWARM_STATUS=$(ssh root@omv800 "docker service ls | grep jellyfin")
echo "Swarm service: $SWARM_STATUS"
# Check standalone container status
echo ""
echo "Checking standalone container status..."
STANDALONE_STATUS=$(ssh root@omv800 "docker ps | grep jellyfin | grep -v jellyfin_jellyfin")
echo "Standalone container: $STANDALONE_STATUS"
# Check for port conflicts
echo ""
echo "Checking port usage..."
PORT_USAGE=$(ssh root@omv800 "netstat -tlnp | grep :8096")
echo "Port 8096 usage: $PORT_USAGE"
# Check storage paths
echo ""
echo "Checking storage paths..."
echo "Docker Swarm service paths (from config):"
echo " - /export/jellyfin:/config"
echo " - /export/media:/media/movies:ro"
echo " - /export/tv_shows:/media/tv:ro"
echo ""
echo "Standalone container paths:"
ssh root@omv800 "docker inspect jellyfin --format='{{range .Mounts}}{{.Type}} {{.Source}} -> {{.Destination}}{{.RW}}{{end}}' | tr 'true' '\n'"
# Decision and action
echo ""
echo "=== RECOMMENDED ACTION ==="
echo "The standalone Jellyfin container is working properly and has been running for 24+ hours."
echo "The Docker Swarm service is failing due to storage path conflicts and SQLite I/O errors."
echo ""
echo "Recommended solution: Remove the failing Docker Swarm service and keep the working standalone container."
echo ""
read -p "Do you want to remove the failing Docker Swarm service? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Operation cancelled. You can manually remove the service later with:"
echo " ssh root@omv800 'docker service rm jellyfin_jellyfin'"
exit 0
fi
# Remove the failing Docker Swarm service
echo ""
echo "Removing failing Docker Swarm service..."
ssh root@omv800 "docker service rm jellyfin_jellyfin"
# Wait for service removal
echo "Waiting for service removal..."
sleep 10
# Verify service removal
echo ""
echo "Verifying service removal..."
if ssh root@omv800 "docker service ls | grep -q jellyfin"; then
echo "❌ Service still exists"
else
echo "✅ Docker Swarm service removed successfully"
fi
# Check that standalone container is still working
echo ""
echo "Verifying standalone container is still working..."
if ssh root@omv800 "docker ps | grep -q jellyfin"; then
echo "✅ Standalone Jellyfin container is still running"
# Check health status
HEALTH=$(ssh root@omv800 "docker inspect jellyfin --format='{{.State.Health.Status}}'")
echo "Container health: $HEALTH"
# Check if it's accessible
echo "Testing accessibility..."
if ssh root@omv800 "curl -s -o /dev/null -w '%{http_code}' http://localhost:8096" | grep -q "200\|302"; then
echo "✅ Jellyfin is accessible on port 8096"
else
echo "⚠️ Jellyfin may not be accessible on port 8096"
fi
else
echo "❌ Standalone container not found"
fi
# Update Caddy configuration if needed
echo ""
echo "=== CADDY CONFIGURATION ==="
echo "Note: The standalone Jellyfin container is not managed by Docker Swarm, so Caddy labels won't work."
echo "You may need to update your Caddy configuration to point directly to OMV800:8096"
echo ""
echo "Current Caddy routing: jellyfin.pressmess.duckdns.org → 192.168.50.229:8096 (OMV800)"
echo "This should continue to work as long as the standalone container is running."
echo ""
echo "=== CLEANUP COMPLETE ==="
echo "✅ Failing Docker Swarm service removed"
echo "✅ Working standalone container preserved"
echo "✅ Port conflict resolved"
echo ""
echo "To monitor Jellyfin status:"
echo " ssh root@omv800 'docker ps | grep jellyfin'"
echo ""
echo "To view Jellyfin logs:"
echo " ssh root@omv800 'docker logs jellyfin --tail 50'"
echo ""
echo "To restart Jellyfin if needed:"
echo " ssh root@omv800 'docker restart jellyfin'"