homelab infrastructure services

VM Testing Plan for Machine Setup#

Test Environments#

1. Local Ubuntu VM#

  • Fresh Ubuntu 22.04 VM
  • Regular user with sudo access
  • Network access to your Synology NAS

2. Test Sequence#

Phase 1: Function Testing#

# Test basic functions without system changes
./scripts/validate_functions.sh
./scripts/validate_dry_run.sh

Phase 2: Partial Testing#

# Test user creation only (no NFS mount)
sudo useradd -u 11110 -s /bin/bash -m gazette-test
id gazette-test  # Should show UID 11110

# Test NFS connectivity (without permanent mount)
sudo mount -t nfs DS412plus:/volume1/topsheet/gazette/test /tmp/test-mount
ls -la /tmp/test-mount
sudo umount /tmp/test-mount

Phase 3: Full Service Setup#

# Run complete setup
./setup.sh gazette test DS412plus

# Verify results
sudo -u gazette-test -i
docker --version
ls -la /mnt/gazette-test/
ls -la ~/.local/state/dynamicalsystem/

Phase 4: Service Deployment Test#

# Switch to service user
sudo -u gazette-test -i

# Create test docker-compose.yml
cd /mnt/gazette-test
mkdir -p service/test-app
cat > service/test-app/docker-compose.yml << 'EOF'
services:
  test:
    image: nginx:alpine
    ports:
      - "8080:80"
    volumes:
      - ../data:/usr/share/nginx/html:ro
    user: "11010:11010"
EOF

# Test deployment
cd service/test-app
docker compose up -d
docker compose ps
curl http://localhost:8080

Rollback Plan#

If testing breaks anything:

# Stop containers
sudo -u gazette-test -i bash -c 'docker stop $(docker ps -q)' || true

# Remove user
sudo pkill -u gazette-test || true
sudo userdel -r gazette-test

# Unmount NFS
sudo umount /mnt/gazette-test || true

# Clean up directories
sudo rm -rf /mnt/gazette-test
rm -rf ~/.local/state/dynamicalsystem/@gazette
rm -rf ~/.local/share/dynamicalsystem/@gazette  
rm -rf ~/.config/dynamicalsystem/@gazette

Success Criteria#

  • UID calculation works correctly
  • Service user created with right UID
  • NFS mount succeeds and shows correct permissions
  • XDG symlinks point to mounted directories
  • Rootless Docker installs and starts
  • Privileged ports work (test with port 80)
  • Container can write to NFS mount
  • Service survives reboot (if testing persistence)

Test Variations#

  1. Different Services: Test with gazette prod
  2. Network Issues: Test behavior when NAS is unreachable
  3. Existing Users: Test when service user already exists
  4. Permission Issues: Test with non-sudo user
  5. Partial Failures: Test recovery from interrupted setup