homelab infrastructure services
1# VM Testing Plan for Machine Setup
2
3## Test Environments
4
5### 1. Local Ubuntu VM
6- Fresh Ubuntu 22.04 VM
7- Regular user with sudo access
8- Network access to your Synology NAS
9
10### 2. Test Sequence
11
12#### Phase 1: Function Testing
13```bash
14# Test basic functions without system changes
15./scripts/validate_functions.sh
16./scripts/validate_dry_run.sh
17```
18
19#### Phase 2: Partial Testing
20```bash
21# Test user creation only (no NFS mount)
22sudo useradd -u 11110 -s /bin/bash -m gazette-test
23id gazette-test # Should show UID 11110
24
25# Test NFS connectivity (without permanent mount)
26sudo mount -t nfs DS412plus:/volume1/topsheet/gazette/test /tmp/test-mount
27ls -la /tmp/test-mount
28sudo umount /tmp/test-mount
29```
30
31#### Phase 3: Full Service Setup
32```bash
33# Run complete setup
34./setup.sh gazette test DS412plus
35
36# Verify results
37sudo -u gazette-test -i
38docker --version
39ls -la /mnt/gazette-test/
40ls -la ~/.local/state/dynamicalsystem/
41```
42
43#### Phase 4: Service Deployment Test
44```bash
45# Switch to service user
46sudo -u gazette-test -i
47
48# Create test docker-compose.yml
49cd /mnt/gazette-test
50mkdir -p service/test-app
51cat > service/test-app/docker-compose.yml << 'EOF'
52services:
53 test:
54 image: nginx:alpine
55 ports:
56 - "8080:80"
57 volumes:
58 - ../data:/usr/share/nginx/html:ro
59 user: "11010:11010"
60EOF
61
62# Test deployment
63cd service/test-app
64docker compose up -d
65docker compose ps
66curl http://localhost:8080
67```
68
69## Rollback Plan
70
71If testing breaks anything:
72
73```bash
74# Stop containers
75sudo -u gazette-test -i bash -c 'docker stop $(docker ps -q)' || true
76
77# Remove user
78sudo pkill -u gazette-test || true
79sudo userdel -r gazette-test
80
81# Unmount NFS
82sudo umount /mnt/gazette-test || true
83
84# Clean up directories
85sudo rm -rf /mnt/gazette-test
86rm -rf ~/.local/state/dynamicalsystem/@gazette
87rm -rf ~/.local/share/dynamicalsystem/@gazette
88rm -rf ~/.config/dynamicalsystem/@gazette
89```
90
91## Success Criteria
92
93- [ ] UID calculation works correctly
94- [ ] Service user created with right UID
95- [ ] NFS mount succeeds and shows correct permissions
96- [ ] XDG symlinks point to mounted directories
97- [ ] Rootless Docker installs and starts
98- [ ] Privileged ports work (test with port 80)
99- [ ] Container can write to NFS mount
100- [ ] Service survives reboot (if testing persistence)
101
102## Test Variations
103
1041. **Different Services**: Test with `gazette prod`
1052. **Network Issues**: Test behavior when NAS is unreachable
1063. **Existing Users**: Test when service user already exists
1074. **Permission Issues**: Test with non-sudo user
1085. **Partial Failures**: Test recovery from interrupted setup