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:
10
README.md
10
README.md
@@ -128,6 +128,7 @@ Based on Co-op Cloud with quality scoring:
|
|||||||
- `recipes` - Show complete Co-op Cloud catalog
|
- `recipes` - Show complete Co-op Cloud catalog
|
||||||
- `deploy <app>` - Deploy locally with tab completion
|
- `deploy <app>` - Deploy locally with tab completion
|
||||||
- `browser [app]` - Launch Firefox [to specific app]
|
- `browser [app]` - Launch Firefox [to specific app]
|
||||||
|
- `install` - Repair abra installation if needed
|
||||||
|
|
||||||
- `desktop` - Start GUI session
|
- `desktop` - Start GUI session
|
||||||
- `help` - Show all commands and debug info
|
- `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)
|
# Check WiFi connection (should connect automatically)
|
||||||
nmcli connection show --active
|
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
|
# Check DNS resolution
|
||||||
dig @127.0.0.1 test.workshop.local
|
dig @127.0.0.1 test.workshop.local
|
||||||
|
|
||||||
|
|||||||
103
common.nix
103
common.nix
@@ -489,12 +489,12 @@ isoConfig
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Abra Installation Service (System-wide)
|
# Abra Installation Service (System-wide) with Enhanced Verification
|
||||||
systemd.services.workshop-abra-install = {
|
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" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "workshop-system-setup.service" ];
|
after = [ "network-online.target" ];
|
||||||
wants = [ "workshop-system-setup.service" ];
|
wants = [ "network-online.target" ];
|
||||||
path = with pkgs; [
|
path = with pkgs; [
|
||||||
bash
|
bash
|
||||||
wget
|
wget
|
||||||
@@ -509,38 +509,69 @@ isoConfig
|
|||||||
];
|
];
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
# Set proper environment
|
# Enhanced installation with proper verification
|
||||||
export TERM=xterm-256color
|
export TERM=xterm-256color
|
||||||
export HOME=/root
|
export HOME=/root
|
||||||
|
|
||||||
# Check if abra is already installed
|
# Check if abra is already properly installed (CORRECTED VERIFICATION)
|
||||||
if [ -x "/root/.local/bin/abra" ]; then
|
if sudo abra --version >/dev/null 2>&1; then
|
||||||
echo "✅ abra already installed"
|
echo "✅ abra already installed and functional"
|
||||||
/root/.local/bin/abra --version
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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)
|
# Attempt installation with retry logic
|
||||||
curl -fsSL https://install.abra.coopcloud.tech | bash
|
for attempt in {1..3}; do
|
||||||
|
echo "🚀 Installing abra (attempt $attempt/3)..."
|
||||||
|
|
||||||
# Add to bashrc only once
|
if curl -fsSL https://install.abra.coopcloud.tech | bash; then
|
||||||
if ! grep -q "/root/.local/bin" /root/.bashrc 2>/dev/null; then
|
# Verify installation success using CORRECT check method
|
||||||
echo 'export PATH="$PATH:/root/.local/bin"' >> /root/.bashrc
|
if sudo abra --version >/dev/null 2>&1; then
|
||||||
echo "✅ Added /root/.local/bin to PATH in /root/.bashrc"
|
echo "✅ abra installed successfully"
|
||||||
fi
|
|
||||||
|
|
||||||
# Verify
|
# Add to bashrc only once
|
||||||
if [ -x "/root/.local/bin/abra" ]; then
|
if ! grep -q "/root/.local/bin" /root/.bashrc 2>/dev/null; then
|
||||||
echo "✅ abra installed to /root/.local/bin/abra"
|
echo 'export PATH="$PATH:/root/.local/bin"' >> /root/.bashrc
|
||||||
fi
|
echo "✅ Added /root/.local/bin to PATH in /root/.bashrc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
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 = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
User = "root";
|
User = "root";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "30s";
|
||||||
Environment = [
|
Environment = [
|
||||||
"TERM=xterm-256color"
|
"TERM=xterm-256color"
|
||||||
"HOME=/root"
|
"HOME=/root"
|
||||||
@@ -1172,9 +1203,35 @@ isoConfig
|
|||||||
echo "❌ No GUI session. Run 'desktop' first"
|
echo "❌ No GUI session. Run 'desktop' first"
|
||||||
echo "🌐 Target was: $target_url"
|
echo "🌐 Target was: $target_url"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
recipes() {
|
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 "📚 Complete Co-op Cloud Recipe Catalog:"
|
||||||
echo ""
|
echo ""
|
||||||
echo "⭐ Tier 1 - Production Ready: gitea mealie nextcloud"
|
echo "⭐ Tier 1 - Production Ready: gitea mealie nextcloud"
|
||||||
|
|||||||
@@ -119,8 +119,15 @@ When internet is not available during workshop setup:
|
|||||||
|
|
||||||
3. **Manual abra Installation** (if needed)
|
3. **Manual abra Installation** (if needed)
|
||||||
```bash
|
```bash
|
||||||
# Download abra binary manually on another machine and transfer via USB
|
# Use the install command (preferred)
|
||||||
# Or use a local package repository
|
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**
|
4. **Deploy Local Services**
|
||||||
@@ -223,11 +230,14 @@ ping 8.8.8.8
|
|||||||
# Test DNS
|
# Test DNS
|
||||||
nslookup google.com
|
nslookup google.com
|
||||||
|
|
||||||
# Test workshop services
|
# Test abra installation
|
||||||
curl http://traefik.workshop.local
|
sudo abra --version
|
||||||
|
|
||||||
# Test abra connectivity
|
# Test abra connectivity
|
||||||
sudo abra server ls
|
sudo abra server ls
|
||||||
|
|
||||||
|
# Test workshop services
|
||||||
|
curl http://traefik.workshop.local
|
||||||
```
|
```
|
||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ setup
|
|||||||
# See available app recipes
|
# See available app recipes
|
||||||
recipes
|
recipes
|
||||||
|
|
||||||
|
# If abra installation failed (rare case)
|
||||||
|
install
|
||||||
|
|
||||||
# Get help
|
# Get help
|
||||||
help
|
help
|
||||||
```
|
```
|
||||||
@@ -120,3 +123,7 @@ Name: Android, Password: (ask facilitator)
|
|||||||
→ WiFi should connect automatically to "CODE_CRISPIES"
|
→ WiFi should connect automatically to "CODE_CRISPIES"
|
||||||
→ If not, use mobile hotspot as backup
|
→ If not, use mobile hotspot as backup
|
||||||
→ Check: nmcli connection show --active
|
→ Check: nmcli connection show --active
|
||||||
|
|
||||||
|
**Abra not working**
|
||||||
|
→ Run: install
|
||||||
|
→ Check: sudo systemctl status workshop-abra-install
|
||||||
|
|||||||
Reference in New Issue
Block a user