Sari la conținut

Agnostic OS Installer - Deployment Guide

Overview

The Agnostic OS Installer can be deployed in several ways:

  1. Local CLI Tool - Direct command-line usage
  2. Docker Container - Isolated containerized environment
  3. Web API Service - REST API for remote building
  4. Kubernetes/Cloud - Scalable cloud deployment

Quick Deployment Options

# Build and run the container
git clone <repository>
cd agnostic-os-installer
docker build -t agnostic-installer .
docker run -p 8000:8000 -v $(pwd)/builds:/builds agnostic-installer

# Or use docker-compose
docker-compose up -d

The web API will be available at http://localhost:8000/docs

Option 2: Local Installation

# Requires Python 3.9+ and system dependencies
pip install -r requirements.txt
python3 -m core.engine_cli --help

Option 3: Direct Web Service

# Install dependencies
pip install fastapi uvicorn

# Run the API server
python3 core/engine_server.py --port 8000

Web API Usage

Submit Build Request

# Using curl with config file upload
curl -X POST "http://localhost:8000/build" \
     -F "config_file=@myapp.yml" \
     -F "platforms=linux,windows,macos"

# Using curl with inline config
curl -X POST "http://localhost:8000/build" \
     -H "Content-Type: application/json" \
     -d '{
       "platforms": ["linux", "windows"],
       "config_content": "package:\n  name: myapp\n  version: 1.0.0\n..."
     }'

Monitor Build Status

# Check build status
curl "http://localhost:8000/build/$BUILD_ID"

# Response example:
{
  "build_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "completed",
  "platforms": ["linux", "windows"],
  "artifacts": {
    "linux": "/build/550e8400-e29b-41d4-a716-446655440000/download/linux",
    "windows": "/build/550e8400-e29b-41d4-a716-446655440000/download/windows"
  },
  "logs": {
    "linux": "/build/550e8400-e29b-41d4-a716-446655440000/logs/linux",
    "windows": "/build/550e8400-e29b-41d4-a716-446655440000/logs/windows"
  },
  "created_at": "2025-10-12T00:54:07Z",
  "updated_at": "2025-10-12T00:56:07Z"
}

Download Artifacts

# Download Linux binary
curl -O "http://localhost:8000/build/$BUILD_ID/download/linux"

# Download build logs
curl -O "http://localhost:8000/build/$BUILD_ID/logs/linux"

Input/Output Handling

Configuration Input

Option 1: File Upload - Upload YAML config file via HTTP multipart - Server processes the file immediately - No persistence needed on client

Option 2: Inline Config - Send YAML content as JSON string - Useful for programmatic integration - Smaller payload for simple configs

Output Storage

Local Container Approach:

# docker-compose.yml
volumes:
  - ./builds:/builds:rw  # Mount host directory

  • Builds stored on host system
  • Persistent across container restarts
  • Easy backup and management

Internal Container Storage: - Builds stored inside container - Requires volume mapping to extract - Better isolation

Security Considerations

Container Security

  • Non-root user (builder:builder)
  • Limited system access
  • Process isolation

File Access Control

# Restrict build directory permissions
chmod 700 builds/
chown builder:builder builds/

Network Security

  • Bind to localhost/internal network only
  • Use HTTPS in production
  • API authentication (future enhancement)

Deployment Scenarios

Development Setup

# Clone and setup
git clone <repository>
cd agnostic-os-installer

# Install for development
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Run API locally
python3 core/engine_server.py --port 8000 --workspace ./dev-builds

Production Container Deployment

# Build production image
docker build -t agnostic-installer:latest .

# Run with persistent storage
docker run -d \
  --name agnostic-builder \
  --restart unless-stopped \
  -p 8000:8000 \
  -v /opt/agnostic-builds:/builds \
  agnostic-installer:latest

Kubernetes Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: agnostic-installer
spec:
  replicas: 1
  selector:
    matchLabels:
      app: agnostic-installer
  template:
    metadata:
      labels:
        app: agnostic-installer
    spec:
      containers:
      - name: api
        image: agnostic-installer:latest
        ports:
        - containerPort: 8000
        volumeMounts:
        - name: builds-storage
          mountPath: /builds
        env:
        - name: PYTHONPATH
          value: "/workspace"
      volumes:
      - name: builds-storage
        persistentVolumeClaim:
          claimName: builds-pvc

Load Balancing (Future)

# Multiple builder instances behind load balancer
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: agnostic-ingress
spec:
  rules:
  - host: builder.yourdomain.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: agnostic-service
            port:
              number: 80

Monitoring and Maintenance

Health Checks

The API includes built-in health checks:

# Health check endpoint
curl http://localhost:8000/

# Docker health check
docker ps  # Shows health status

Logs and Monitoring

# Container logs
docker logs agnostic-builder

# Application logs (inside container)
docker exec agnostic-builder tail -f /tmp/build.log

# Build-specific logs via API
curl http://localhost:8000/build/$BUILD_ID/logs/linux

Cleanup and Maintenance

# Remove old builds (manual)
docker exec agnostic-builder find /builds -mtime +7 -delete

# Backup builds
tar czf builds-backup-$(date +%Y%m%d).tar.gz builds/

# Update container
docker pull agnostic-installer:latest
docker-compose down && docker-compose up -d

Troubleshooting Deployment

Common Issues

Permission Errors

# Fix build directory permissions
sudo chown -R 1000:1000 ./builds

# Or run container as current user
docker run --user $(id -u):$(id -g) ...

Port Conflicts

# Find conflicting process
lsof -i :8000

# Use different port
docker run -p 8080:8000 agnostic-installer

Build Failures

# Check build logs via API
curl http://localhost:8000/build/$BUILD_ID/logs/linux

# Debug inside container
docker exec -it agnostic-builder bash
# cd /workspace && python3 -m core.engine_cli build config.yml --verbose

Storage Issues

# Check available space
df -h ./builds

# Clear old builds
find ./builds -type d -mtime +30 -exec rm -rf {} +

Resource Requirements

Minimum Requirements

  • CPU: 1 core
  • RAM: 1GB
  • Disk: 5GB for builds
  • Network: Stable internet for dependencies
  • CPU: 2+ cores
  • RAM: 2GB+
  • Disk: 50GB+ SSD for builds
  • Network: High-speed internet

Scaling Considerations

For high-volume usage: 1. Increase max_concurrent_builds limit 2. Add Redis for session management (future) 3. Implement build queuing 4. Use load balancer with multiple instances

Backup and Recovery

Backup Strategy

# Automated backup script
#!/bin/bash
BACKUP_DIR="/opt/backups"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)

# Backup builds
tar czf "$BACKUP_DIR/agnostic-builds-$TIMESTAMP.tar.gz" /opt/agnostic-builds

# Keep only last 7 backups
cd "$BACKUP_DIR" && ls -t *.tar.gz | tail -n +8 | xargs rm -f

Disaster Recovery

  1. Container Failure: Restart with docker-compose restart
  2. Data Loss: Restore from backups
  3. Host Failure: Rebuild container on new host, restore data
  4. Corrupted Builds: Clean workspace, rebuild from source

This deployment approach provides a secure, scalable way to operate the Agnostic OS Installer in various environments—from local development to production cloud deployments.