Skip to content

Commit 46ac92a

Browse files
committed
feat: [#12] complete VM integration testing with MySQL x86-64-v2 CPU fix
- Updated VM CPU model to host-model for x86-64-v2 instruction set support - Completed VM integration testing phase of MySQL migration - Fixed bash quoting in integration testing guide to avoid history expansion - Documented MySQL CPU requirement issue and technical solution - Verified all services running and healthy on VM with MySQL backend - Smoke tested tracker API endpoints successfully
1 parent 69090dc commit 46ac92a

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

docs/guides/integration-testing-guide.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ echo "=== Verifying Clean State ==="
9393

9494
# Check VMs
9595
virsh list --all | grep torrust-tracker-demo && \
96-
echo "❌ VM still exists!" || echo "✅ No VM conflicts"
96+
echo '❌ VM still exists!' || echo '✅ No VM conflicts'
9797

9898
# Check volumes in user-default pool
9999
virsh vol-list user-default 2>/dev/null | grep torrust-tracker-demo && \
100-
echo "❌ Volumes still exist!" || echo "✅ No volume conflicts"
100+
echo '❌ Volumes still exist!' || echo '✅ No volume conflicts'
101101

102102
# Check OpenTofu state
103103
ls infrastructure/terraform/terraform.tfstate* 2>/dev/null && \
104-
echo "❌ State files still exist!" || echo "✅ No state file conflicts"
104+
echo '❌ State files still exist!' || echo '✅ No state file conflicts'
105105
```
106106

107107
**Expected Output**: All checks should show "✅" (no conflicts).
@@ -120,7 +120,7 @@ virsh vol-delete torrust-tracker-demo.qcow2 user-default
120120

121121
# Verify cleanup
122122
virsh vol-list user-default 2>/dev/null | grep torrust-tracker-demo && \
123-
echo "❌ Volumes still exist!" || echo "✅ No volume conflicts"
123+
echo '❌ Volumes still exist!' || echo '✅ No volume conflicts'
124124
```
125125

126126
**Expected Output**: Should show "✅ No volume conflicts" after manual cleanup.
@@ -392,8 +392,8 @@ while true; do
392392
echo "$(date): Testing SSH to $VM_IP..."
393393
if timeout 10 ssh -o StrictHostKeyChecking=no \
394394
-o ConnectTimeout=10 torrust@$VM_IP \
395-
"echo 'SSH works!'" 2>/dev/null; then
396-
echo "✅ SSH connection successful!"
395+
'echo "SSH works!"' 2>/dev/null; then
396+
echo '✅ SSH connection successful!'
397397
break
398398
fi
399399
echo "⏳ Cloud-init still running... waiting 30 seconds"

docs/issues/12-use-mysql-instead-of-sqlite-by-default.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,11 @@ cd application/
235235

236236
4. **VM Integration Testing**:
237237

238-
- **Status**: **Pending**
238+
- **Status**: **Completed** (2025-07-08)
239239
- **Description**: Deploy the complete stack on a local VM to test the full
240240
infrastructure integration.
241+
- **Solution**: MySQL 8.0 x86-64-v2 CPU requirement resolved by configuring VM with
242+
`host-model` CPU mode to enable modern instruction sets.
241243

242244
```bash
243245
# From the repository root
@@ -246,6 +248,19 @@ cd application/
246248
# Run smoke tests from the smoke testing guide
247249
```
248250

251+
**Results**:
252+
253+
- ✅ All Docker containers running successfully
254+
- ✅ MySQL container: `Up 48 minutes (healthy)` - no more restart loops
255+
- ✅ Tracker container: `Up 48 minutes (healthy)` - connected to MySQL
256+
- ✅ All services responding to health checks
257+
258+
**Technical Solution**:
259+
260+
- **Issue**: MySQL 8.0 Docker image requires x86-64-v2 CPU instruction set
261+
- **Fix**: Updated `infrastructure/terraform/main.tf` to use `host-model` CPU mode
262+
- **Result**: VM CPU now supports x86-64-v2 instructions required by MySQL 8.0
263+
249264
### Phase 2: Documentation and Cleanup
250265

251266
**Status**: ⬜ **Pending**
@@ -269,7 +284,7 @@ remove any outdated SQLite references.
269284
- [x] Docker Compose service dependencies updated
270285
- [x] Local functionality testing passed
271286
- [x] Local data persistence testing passed
272-
- [ ] VM integration testing passed
287+
- [x] VM integration testing passed
273288
- [ ] All documentation updated
274289
- [ ] Old SQLite configurations removed or documented as legacy
275290
- [ ] Final PR reviewed and approved

infrastructure/terraform/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ resource "libvirt_domain" "vm" {
106106

107107
cloudinit = libvirt_cloudinit_disk.commoninit.id
108108

109-
109+
# CPU configuration - use a modern CPU model that supports x86-64-v2
110+
# Enable modern CPU model for x86-64-v2 instruction set support (required by MySQL 8.0)
111+
# Reference: https://github.com/docker-library/mysql/issues/1055
112+
cpu {
113+
mode = "host-model"
114+
}
110115

111116
disk {
112117
volume_id = libvirt_volume.vm_disk.id

0 commit comments

Comments
 (0)