# HomeAudit Infrastructure Migration Summary
## Executive Overview

**Analysis Date:** 2025-08-24  
**Scope:** 7 devices, 53 containerized services  
**Migration Readiness:** Comprehensive inventory complete

This document provides actionable migration specifications derived from comprehensive infrastructure discovery across your home lab environment.

## Infrastructure Inventory

### Device Summary
| Device | Role | OS | Architecture | Migration Priority | Complexity |
|--------|------|----|--------------|--------------------|------------|
| **omv800.local** | Primary Storage/Media Server | Debian 12 | x86_64 | 1 (Critical) | Very High |
| **jonathan-2518f5u** | Home Automation Hub | Ubuntu 24.04 | x86_64 | 2 (Critical) | High |
| **fedora** | Development Workstation | Fedora 42 | x86_64 | 4 (Medium) | Medium |
| **lenovo420** | Auxiliary Services | Ubuntu 24.04 | x86_64 | 5 (Low) | Medium |
| **surface** | AppFlowy Development | Ubuntu 24.04 | x86_64 | 6 (Low) | Medium |
| **audrey** | Monitoring/Utilities | Ubuntu 24.04 | x86_64 | 7 (Low) | Low |
| **raspberrypi** | Minimal Services | Debian 12 | aarch64 | 8 (Low) | Low |

### Critical Infrastructure Specifications

#### OMV800.local (Primary Migration Target)
- **CPU:** Intel Core i5-6400 @ 2.70GHz (4 cores/4 threads)
- **Memory:** 32GB (31Gi available)
- **Total Storage:** ~20.8TB across 5 drives
- **Key Storage Pools:**
  - `/srv/mergerfs/DataPool` - Unified storage pool (Movies, TV, Photos, Nextcloud)
  - `/srv/mergerfs/presscloud` - Additional unified pool
- **Network:** Gigabit ethernet, multiple container networks
- **Services:** 17 containers (highest density)

## Service Categorization & Migration Matrix

### Phase 1: Critical Infrastructure (Priority 1-2)
**Estimated Downtime:** 2-4 hours per service  
**Prerequisites:** Target infrastructure ready, network configured

| Service | Device | Function | Migration Complexity | Critical Dependencies |
|---------|--------|----------|---------------------|---------------------|
| **AdGuard Home** | omv800.local | DNS Filtering | Medium | Network configuration |
| **Unbound** | omv800.local | DNS Resolution | Medium | DNS infrastructure |
| **Home Assistant** | jonathan-2518f5u | Automation Hub | High | Device integrations, database |

**Validation Criteria:**
- [ ] DNS resolution functional across network
- [ ] Home automation devices responding
- [ ] Network services accessible

### Phase 2: Media & Cloud Storage (Priority 2-3)
**Estimated Duration:** 3-7 days (data transfer intensive)

| Service | Device | Data Volume | Migration Strategy |
|---------|--------|-------------|------------------|
| **Jellyfin** | omv800.local | Very Large (TB) | Rsync + config migration |
| **Nextcloud** | omv800.local | Large + Database | Database dump + file sync |
| **Immich** | omv800.local | Large + ML Models | PostgreSQL + file migration |

**Critical Bind Mounts:**
```yaml
jellyfin:
  - "/srv/mergerfs/DataPool/Movies:/media/movies"
  - "/srv/mergerfs/DataPool/tv_shows:/media/tv_shows"

nextcloud:
  - "/srv/mergerfs/DataPool/nextcloud/data:/var/www/html"
  - "/srv/mergerfs/DataPool/nextcloud/config:/var/www/html/config"

immich:
  - Large PostgreSQL database with vector search
  - ML model cache requires GPU access
```

### Phase 3: Development & Productivity
**Complexity:** Medium to High

| Service Stack | Components | Dependencies |
|--------------|------------|--------------|
| **AppFlowy Cloud** | 9 containers | postgres + redis + minio + nginx |
| **Gitea** | Single container | Git repository data |
| **Paperless-NGX** | 3 containers | Database + Redis + Document processing |

### Phase 4: Monitoring & Management
**Complexity:** Low (final cleanup)

- Portainer agents (6 instances)
- Watchtower auto-updaters
- Uptime Kuma monitoring
- Log aggregation (Dozzle)

## Critical Data Migration Map

### High-Priority Data Requiring Backup
| Path | Service | Estimated Size | Backup Strategy |
|------|---------|----------------|----------------|
| `/srv/mergerfs/DataPool/nextcloud/` | Nextcloud | Large | Database dump + rsync |
| `/srv/mergerfs/DataPool/Movies/` | Jellyfin | Very Large | Direct transfer/mounting |
| `/srv/mergerfs/DataPool/tv_shows/` | Jellyfin | Very Large | Direct transfer/mounting |
| Home Assistant config | Home Assistant | Small | Critical config backup |
| PostgreSQL databases | Multiple | Medium | pg_dump before migration |

### Docker Volume Inventory
**Named Volumes Requiring Migration:**
- `jellyfin-config` - Jellyfin configuration
- `jellyfin-cache` - Transcoding cache (can rebuild)
- `immich_model-cache` - ML models (large, can redownload)
- `paperless_pgdata` - Document database
- `vikunja-db` - Task management database

## Service Dependencies & Orchestration

### Critical Dependency Chains
```mermaid
graph TD
    A[Nextcloud] --> B[nextcloud-db]
    A --> C[nextcloud-redis]
    D[Home Assistant] --> E[MariaDB]
    F[Immich] --> G[immich_postgres]
    F --> H[immich_redis]
    I[Paperless-NGX] --> J[paperless-db]
    I --> K[paperless-broker]
```

### Network Architecture
- Multiple Docker networks per service stack
- Custom networks: `nextcloud_nextcloud-internal`
- Bridge networks for most services
- Host networking for some system services

## Migration Automation Specifications

### Container Recreation Templates
```yaml
# Example for high-complexity services
jellyfin:
  image: "jellyfin/jellyfin:latest"
  ports:
    - "8096:8096"
  volumes:
    - "jellyfin-config:/config"
    - "jellyfin-cache:/cache"
  bind_mounts:
    - "{{media_path}}/Movies:/media/movies"
    - "{{media_path}}/tv_shows:/media/tv_shows"
  environment:
    - "NVIDIA_VISIBLE_DEVICES=all"
    - "NVIDIA_DRIVER_CAPABILITIES=compute,video,utility"
  restart: "unless-stopped"
  health_check:
    test: ["CMD-SHELL", "curl --noproxy 'localhost' -Lk -fsS http://localhost:8096/health"]
    interval: "30s"
```

### Migration Validation Checklist

#### Per-Service Validation
- [ ] Container health checks passing
- [ ] Port accessibility verified
- [ ] Volume mounts correct
- [ ] Network connectivity confirmed
- [ ] Service-specific functionality tested

#### System-Level Validation
- [ ] DNS resolution working (AdGuard/Unbound)
- [ ] Media streaming functional (Jellyfin)
- [ ] File sync operational (Nextcloud)
- [ ] Home automation responsive (Home Assistant)
- [ ] Photo AI processing working (Immich)
- [ ] Document management operational (Paperless-NGX)

## Resource Requirements

### Target Infrastructure Minimum Specs
- **CPU:** 8+ cores (for containerized workload)
- **Memory:** 32GB+ (databases + media processing)
- **Storage:** 
  - NVMe SSD for databases and hot data
  - Bulk storage for media files (20TB+)
  - Network-attached storage capability
- **Network:** Gigabit ethernet minimum, 10Gbit preferred
- **GPU:** Optional but recommended for Jellyfin transcoding

### Container Resource Allocation
```yaml
resource_tiers:
  high_resource:
    - immich_machine_learning (GPU acceleration)
    - jellyfin (transcoding)
    - nextcloud (file processing)
    - home_assistant (many integrations)
  
  medium_resource:
    - database_containers (postgres, mariadb, redis)
    - appflowy_stack (development environment)
  
  low_resource:
    - monitoring_containers (portainer, watchtower)
    - dns_services (adguard, unbound)
```

## Migration Risk Assessment

### High-Risk Services
1. **Home Assistant** - Critical for home automation, device dependencies
2. **Nextcloud** - Large user data, database dependencies
3. **DNS Services** - Network-wide impact if misconfigured

### Medium-Risk Services
1. **Jellyfin** - Large media libraries, transcoding setup
2. **Immich** - Complex ML pipeline, large photo libraries
3. **AppFlowy Stack** - Multiple interdependent containers

### Low-Risk Services
1. **Monitoring tools** - Can be rebuilt easily
2. **Development containers** - Non-production workloads

## Automation Recommendations

### Migration Script Structure
```bash
#!/bin/bash
# migration_orchestrator.sh

# Phase 1: Critical Infrastructure
migrate_dns_services
validate_dns_functionality
migrate_home_assistant
validate_automation_systems

# Phase 2: Data-Heavy Services  
backup_databases
migrate_jellyfin_media
migrate_nextcloud_stack
migrate_immich_photos

# Phase 3: Development Services
migrate_appflowy_stack
migrate_gitea
migrate_paperless

# Phase 4: Monitoring
migrate_monitoring_stack
```

### Rollback Strategy
- Keep original services running during migration
- Validate each service before decommissioning source
- Database backups before any database migration
- Configuration snapshots for quick recovery

## Success Metrics

### Technical Metrics
- [ ] 100% service availability post-migration
- [ ] <5% performance degradation
- [ ] All data integrity checks passed
- [ ] Network latency within acceptable ranges

### Business Metrics
- [ ] Home automation fully functional
- [ ] Media streaming without interruption
- [ ] File access and sync operational
- [ ] Development workflow uninterrupted

---

## Files Generated
1. `consolidated_migration_summary.yaml` - Detailed infrastructure specifications
2. `detailed_container_inventory.yaml` - Complete container analysis
3. `migration_priority_summary.yaml` - Service prioritization matrix
4. `extract_container_data.py` - Analysis automation script

This summary provides the foundation for automated migration tooling and manual verification procedures. Each service has been categorized, dependencies mapped, and migration complexity assessed to enable systematic infrastructure migration planning.