Skip to content

Conversation

@mdlmarkham
Copy link
Owner

Complete rewrite of installation system with separation of concerns, comprehensive error handling, and platform-specific optimizations.

New Architecture

  • Modular design: Separate library modules for common functions
  • Platform-aware: Auto-detection with optimized installers for:
    • ProxMox LXC containers
    • EC2/Cloud instances (AWS, GCP, Azure, DigitalOcean)
    • Standalone/bare metal systems
  • Universal dispatcher: Automatically selects appropriate installer

Library Modules (scripts/install/lib/)

  • common.sh: Core utilities, logging, error handling, rollback
  • platform-detect.sh: Platform/OS/cloud/resource detection
  • preflight.sh: Comprehensive pre-installation validation
  • auth-setup.sh: Authentication configuration (OIDC/token/none)
  • validation.sh: Post-installation testing and health checks

Platform-Specific Installers

  • install.sh: Main dispatcher with auto-detection
  • install-standalone.sh: Universal installer, works anywhere
  • install-proxmox.sh: ProxMox LXC optimizations
    • Container feature checks (nesting, TUN device)
    • Network configuration
    • Custom MOTD
    • Container-specific systemd optimizations
  • install-ec2.sh: Cloud environment optimizations
    • Metadata detection (AWS, GCP, Azure)
    • Firewall guidance
    • Cloud-specific security notes

Key Features

Robustness

  • Complete error handling with rollback on failure
  • State tracking for cleanup
  • Idempotent execution (safe to run multiple times)
  • Automatic backup of existing configuration
  • Graceful upgrade path for existing installations

Pre-flight Validation

  • Resource checks (memory, disk, CPU)
  • Network connectivity and DNS
  • Port availability with conflict resolution
  • OS compatibility validation
  • Existing installation detection
  • Platform-specific requirement checks

Post-installation Validation

  • Service status and health checks
  • Port listening confirmation
  • Local connectivity tests
  • File integrity validation
  • Python environment verification
  • Authentication configuration validation
  • Integration testing

Flexibility

  • Interactive or non-interactive modes
  • Configuration file support
  • Environment variable overrides
  • Custom installation paths and ports
  • Skip optional components (Docker)
  • Multiple authentication modes

Configuration Templates (scripts/install/templates/)

  • install.conf.example: General template with all options
  • proxmox-lxc.conf: ProxMox LXC with Tailscale OAuth
  • ec2-cloud.conf: Cloud environments with security notes
  • development.conf: Development setup (no auth)

Usage Examples

# Auto-detect and install
sudo bash install.sh

# Check system before installing
sudo bash install.sh --check

# Platform-specific
sudo bash install.sh --platform proxmox

# Non-interactive with config file
sudo bash install.sh --config /path/to/config.conf

# Non-interactive with env vars
sudo SYSTEMMANAGER_AUTH_MODE=token \
     NON_INTERACTIVE=true \
     bash install.sh

Integration

Updated root install.sh and ct/install.sh to use new modular system while maintaining backward compatibility with ProxMox build system.

Documentation

  • Comprehensive README in scripts/install/
  • Detailed templates README with examples
  • Inline documentation in all modules
  • Troubleshooting guide
  • Development guidelines

Improvements Over Previous Scripts

  1. Error Handling: Automatic rollback vs none
  2. Validation: Comprehensive pre/post checks vs basic checks
  3. Platform Support: Optimized for 3 platforms vs generic
  4. Idempotency: Safe re-runs vs potential failures
  5. Flexibility: Config files + env vars vs hardcoded
  6. Maintenance: Modular libraries vs monolithic scripts
  7. Testing: Built-in validation vs manual verification
  8. Documentation: Comprehensive vs minimal

Addresses: Improved robustness, efficiency, and support for ProxMox LXC and arbitrary cloud/VM scenarios.

Complete rewrite of installation system with separation of concerns,
comprehensive error handling, and platform-specific optimizations.

## New Architecture

- **Modular design**: Separate library modules for common functions
- **Platform-aware**: Auto-detection with optimized installers for:
  - ProxMox LXC containers
  - EC2/Cloud instances (AWS, GCP, Azure, DigitalOcean)
  - Standalone/bare metal systems
- **Universal dispatcher**: Automatically selects appropriate installer

## Library Modules (scripts/install/lib/)

- `common.sh`: Core utilities, logging, error handling, rollback
- `platform-detect.sh`: Platform/OS/cloud/resource detection
- `preflight.sh`: Comprehensive pre-installation validation
- `auth-setup.sh`: Authentication configuration (OIDC/token/none)
- `validation.sh`: Post-installation testing and health checks

## Platform-Specific Installers

- `install.sh`: Main dispatcher with auto-detection
- `install-standalone.sh`: Universal installer, works anywhere
- `install-proxmox.sh`: ProxMox LXC optimizations
  - Container feature checks (nesting, TUN device)
  - Network configuration
  - Custom MOTD
  - Container-specific systemd optimizations
- `install-ec2.sh`: Cloud environment optimizations
  - Metadata detection (AWS, GCP, Azure)
  - Firewall guidance
  - Cloud-specific security notes

## Key Features

### Robustness
- Complete error handling with rollback on failure
- State tracking for cleanup
- Idempotent execution (safe to run multiple times)
- Automatic backup of existing configuration
- Graceful upgrade path for existing installations

### Pre-flight Validation
- Resource checks (memory, disk, CPU)
- Network connectivity and DNS
- Port availability with conflict resolution
- OS compatibility validation
- Existing installation detection
- Platform-specific requirement checks

### Post-installation Validation
- Service status and health checks
- Port listening confirmation
- Local connectivity tests
- File integrity validation
- Python environment verification
- Authentication configuration validation
- Integration testing

### Flexibility
- Interactive or non-interactive modes
- Configuration file support
- Environment variable overrides
- Custom installation paths and ports
- Skip optional components (Docker)
- Multiple authentication modes

## Configuration Templates (scripts/install/templates/)

- `install.conf.example`: General template with all options
- `proxmox-lxc.conf`: ProxMox LXC with Tailscale OAuth
- `ec2-cloud.conf`: Cloud environments with security notes
- `development.conf`: Development setup (no auth)

## Usage Examples

```bash
# Auto-detect and install
sudo bash install.sh

# Check system before installing
sudo bash install.sh --check

# Platform-specific
sudo bash install.sh --platform proxmox

# Non-interactive with config file
sudo bash install.sh --config /path/to/config.conf

# Non-interactive with env vars
sudo SYSTEMMANAGER_AUTH_MODE=token \
     NON_INTERACTIVE=true \
     bash install.sh
```

## Integration

Updated root `install.sh` and `ct/install.sh` to use new modular
system while maintaining backward compatibility with ProxMox build
system.

## Documentation

- Comprehensive README in scripts/install/
- Detailed templates README with examples
- Inline documentation in all modules
- Troubleshooting guide
- Development guidelines

## Improvements Over Previous Scripts

1. **Error Handling**: Automatic rollback vs none
2. **Validation**: Comprehensive pre/post checks vs basic checks
3. **Platform Support**: Optimized for 3 platforms vs generic
4. **Idempotency**: Safe re-runs vs potential failures
5. **Flexibility**: Config files + env vars vs hardcoded
6. **Maintenance**: Modular libraries vs monolithic scripts
7. **Testing**: Built-in validation vs manual verification
8. **Documentation**: Comprehensive vs minimal

Addresses: Improved robustness, efficiency, and support for
ProxMox LXC and arbitrary cloud/VM scenarios.
@mdlmarkham mdlmarkham self-assigned this Nov 18, 2025
@mdlmarkham mdlmarkham merged commit 57861f6 into master Nov 18, 2025
1 check failed
@mdlmarkham mdlmarkham deleted the claude/improve-install-scripts-01Pvwn8B6oT1gpYsqfEA6MPF branch November 18, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants