feat: enhance abra installation with proper verification and user commands

- Replace incorrect file-based abra verification with functional testing
- Add network connectivity monitoring to abra installer service
- Implement retry logic with proper error handling
- Add user-friendly 'install' command for manual abra repair
- Update documentation to include install command and troubleshooting
- Fix false positive detection in abra installation verification

The enhanced service now:
- Uses 'sudo abra --version' for reliable verification
- Waits for internet connectivity before attempting installation
- Retries up to 3 times with proper backoff
- Provides clear success/failure reporting
- Includes automatic service restart on failure

User can now run 'install' command as fallback when abra installation fails.
This commit is contained in:
2025-09-17 09:20:17 +02:00
parent 4dacf94c67
commit 112b896e61
4 changed files with 112 additions and 28 deletions

View File

@@ -128,6 +128,7 @@ Based on Co-op Cloud with quality scoring:
- `recipes` - Show complete Co-op Cloud catalog
- `deploy <app>` - Deploy locally with tab completion
- `browser [app]` - Launch Firefox [to specific app]
- `install` - Repair abra installation if needed
- `desktop` - Start GUI session
- `help` - Show all commands and debug info
@@ -175,6 +176,15 @@ make clean # Clean build artifacts (./build/ and ./result/)
# Check WiFi connection (should connect automatically)
nmcli connection show --active
# Check abra installation
sudo abra --version
# Repair abra installation
install
# Check abra service status
sudo systemctl status workshop-abra-install
# Check DNS resolution
dig @127.0.0.1 test.workshop.local

View File

@@ -489,12 +489,12 @@ isoConfig
};
};
# Abra Installation Service (System-wide)
# Abra Installation Service (System-wide) with Enhanced Verification
systemd.services.workshop-abra-install = {
description = "Install abra CLI system-wide";
description = "Install abra CLI system-wide with retry logic and proper verification";
wantedBy = [ "multi-user.target" ];
after = [ "workshop-system-setup.service" ];
wants = [ "workshop-system-setup.service" ];
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
path = with pkgs; [
bash
wget
@@ -509,21 +509,38 @@ isoConfig
];
script = ''
# Set proper environment
# Enhanced installation with proper verification
export TERM=xterm-256color
export HOME=/root
# Check if abra is already installed
if [ -x "/root/.local/bin/abra" ]; then
echo " abra already installed"
/root/.local/bin/abra --version
# Check if abra is already properly installed (CORRECTED VERIFICATION)
if sudo abra --version >/dev/null 2>&1; then
echo " abra already installed and functional"
exit 0
fi
echo "🚀 Installing abra system-wide..."
# Wait for actual internet connectivity
echo "🌐 Waiting for internet connectivity..."
for i in {1..30}; do
if curl -s --max-time 5 https://abra.coopcloud.tech >/dev/null 2>&1; then
echo " Internet connectivity confirmed"
break
fi
if [ $i -eq 30 ]; then
echo " No internet connectivity after 60 seconds"
exit 1
fi
sleep 2
done
# Install to /usr/local/bin (default behavior)
curl -fsSL https://install.abra.coopcloud.tech | bash
# Attempt installation with retry logic
for attempt in {1..3}; do
echo "🚀 Installing abra (attempt $attempt/3)..."
if curl -fsSL https://install.abra.coopcloud.tech | bash; then
# Verify installation success using CORRECT check method
if sudo abra --version >/dev/null 2>&1; then
echo " abra installed successfully"
# Add to bashrc only once
if ! grep -q "/root/.local/bin" /root/.bashrc 2>/dev/null; then
@@ -531,16 +548,30 @@ isoConfig
echo " Added /root/.local/bin to PATH in /root/.bashrc"
fi
# Verify
if [ -x "/root/.local/bin/abra" ]; then
echo " abra installed to /root/.local/bin/abra"
exit 0
else
echo " Installation script completed but abra not functional"
fi
else
echo " Installation attempt $attempt failed"
fi
if [ $attempt -lt 3 ]; then
echo " Retrying in 10 seconds..."
sleep 10
fi
done
echo " abra installation failed after 3 attempts"
exit 1
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
User = "root";
Restart = "on-failure";
RestartSec = "30s";
Environment = [
"TERM=xterm-256color"
"HOME=/root"
@@ -1174,6 +1205,32 @@ isoConfig
fi
}
install() {
echo "🔄 Checking and repairing abra installation..."
# Use the CORRECT check method (matches service verification)
if sudo abra --version >/dev/null 2>&1; then
echo " abra is already installed and functional"
return 0
fi
echo "🔄 Restarting abra installation service..."
sudo systemctl restart workshop-abra-install
# Monitor installation progress
echo "📊 Monitoring installation..."
for i in {1..30}; do
if sudo abra --version >/dev/null 2>&1; then
echo " abra installation completed successfully!"
return 0
fi
sleep 2
done
echo " Installation still not complete. Check status:"
echo " sudo systemctl status workshop-abra-install"
}
recipes() {
echo "📚 Complete Co-op Cloud Recipe Catalog:"
echo ""

View File

@@ -119,8 +119,15 @@ When internet is not available during workshop setup:
3. **Manual abra Installation** (if needed)
```bash
# Download abra binary manually on another machine and transfer via USB
# Or use a local package repository
# Use the install command (preferred)
install
# Or manually restart the service
sudo systemctl restart workshop-abra-install
# Check installation status
sudo systemctl status workshop-abra-install
sudo abra --version
```
4. **Deploy Local Services**
@@ -223,11 +230,14 @@ ping 8.8.8.8
# Test DNS
nslookup google.com
# Test workshop services
curl http://traefik.workshop.local
# Test abra installation
sudo abra --version
# Test abra connectivity
sudo abra server ls
# Test workshop services
curl http://traefik.workshop.local
```
## Getting Help

View File

@@ -78,6 +78,9 @@ setup
# See available app recipes
recipes
# If abra installation failed (rare case)
install
# Get help
help
```
@@ -120,3 +123,7 @@ Name: Android, Password: (ask facilitator)
→ WiFi should connect automatically to "CODE_CRISPIES"
→ If not, use mobile hotspot as backup
→ Check: nmcli connection show --active
**Abra not working**
→ Run: install
→ Check: sudo systemctl status workshop-abra-install