# Manual Docker Testing Scripts This directory contains scripts for manually testing NUPST installation and migration in Docker containers with systemd support. ## Prerequisites - Docker installed and running - Privileged access (for systemd in container) - Linux host (systemd container requirements) ## Test Scripts ### 1. `01-setup-v3-container.sh` Creates a Docker container with systemd and installs NUPST v3. **What it does:** - Creates Ubuntu 22.04 container with systemd enabled - Installs NUPST v3 from commit `806f81c6` (last v3 version) - Enables and starts the systemd service - Leaves container running for testing **Usage:** ```bash chmod +x 01-setup-v3-container.sh ./01-setup-v3-container.sh ``` **Container name:** `nupst-test-v3` ### 2. `02-test-v3-to-v4-migration.sh` Tests the migration from v3 to v4. **What it does:** - Checks current v3 installation - Pulls v4 code from `migration/deno-v4` branch - Runs install.sh (should auto-detect and migrate) - Verifies service is running with v4 - Tests basic commands **Usage:** ```bash chmod +x 02-test-v3-to-v4-migration.sh ./02-test-v3-to-v4-migration.sh ``` **Prerequisites:** Must run `01-setup-v3-container.sh` first ### 3. `03-cleanup.sh` Removes the test container. **Usage:** ```bash chmod +x 03-cleanup.sh ./03-cleanup.sh ``` ## Manual Testing Workflow ### Full Migration Test 1. **Set up v3 environment:** ```bash ./01-setup-v3-container.sh ``` 2. **Verify v3 is working:** ```bash docker exec nupst-test-v3 nupst --version docker exec nupst-test-v3 systemctl status nupst ``` 3. **Test migration to v4:** ```bash ./02-test-v3-to-v4-migration.sh ``` 4. **Manual verification:** ```bash # Enter container docker exec -it nupst-test-v3 bash # Inside container: nupst --version # Should show v4.0.0 nupst service status # Should show running service cat /etc/nupst/config.json # Config should be preserved systemctl status nupst # Service should be active ``` 5. **Cleanup:** ```bash ./03-cleanup.sh ``` ## Useful Docker Commands ```bash # Enter container shell docker exec -it nupst-test-v3 bash # Check service status docker exec nupst-test-v3 systemctl status nupst # View service logs docker exec nupst-test-v3 journalctl -u nupst -n 50 # Check NUPST version docker exec nupst-test-v3 nupst --version # Run NUPST commands docker exec nupst-test-v3 nupst service status docker exec nupst-test-v3 nupst ups list # Stop container docker stop nupst-test-v3 # Start container docker start nupst-test-v3 # Remove container docker rm -f nupst-test-v3 ``` ## Notes - The container runs with `--privileged` flag for systemd support - Container uses Ubuntu 22.04 as base image - v3 installation is from commit `806f81c6a057a2a5da586b96a231d391f12eb1bb` - v4 migration pulls from `migration/deno-v4` branch - All scripts are designed to be idempotent where possible ## Troubleshooting ### Container won't start - Ensure Docker daemon is running - Check you have privileged access - Try: `docker logs nupst-test-v3` ### Systemd not working in container - Requires Linux host (not macOS/Windows) - Needs `--privileged` and cgroup volume mounts - Check: `docker exec nupst-test-v3 systemctl --version` ### Migration fails - Check logs: `docker exec nupst-test-v3 journalctl -xe` - Verify install.sh ran: `docker exec nupst-test-v3 ls -la /opt/nupst/` - Check service: `docker exec nupst-test-v3 systemctl status nupst`