Skip to content

preflight - System Readiness Checks

The preflight command runs comprehensive system checks to ensure your environment is properly configured for Nixopus installation and operation.

Quick Start

bash
# Run full system check
nixopus preflight check

# Check specific ports
nixopus preflight ports 80 443 8080

# Verify dependencies
nixopus preflight deps docker git

Overview

The preflight command performs system readiness checks including port availability and dependency verification.

Subcommands

check - Comprehensive System Check

Runs port availability checks based on configuration. This is the default command when running preflight without subcommands.

bash
nixopus preflight check [OPTIONS]
nixopus preflight [OPTIONS]  # same as check
OptionShortDescriptionDefault
--verbose-vShow detailed logging informationfalse
--output-oOutput format (text, json)text
--timeout-tOperation timeout in seconds10

Examples:

bash
# Basic system check
nixopus preflight check

# Detailed check with verbose output
nixopus preflight check --verbose

What it does:

  • Reads required ports from the configuration file
  • Checks if those ports are available on localhost
  • Reports success if all configured ports are free

ports - Port Availability Check

Verify specific ports are available for Nixopus services.

bash
nixopus preflight ports [PORT...] [OPTIONS]

Arguments:

  • PORT... - List of ports to check (required)
OptionShortDescriptionDefault
--host-hHost to checklocalhost
--verbose-vShow detailed loggingfalse
--output-oOutput format (text, json)text
--timeout-tOperation timeout in seconds10

Examples:

bash
# Check standard web ports
nixopus preflight ports 80 443

# Check ports on remote host
nixopus preflight ports 80 443 --host production.server.com

# Get JSON output
nixopus preflight ports 80 443 8080 --output json

Output: The command outputs a formatted table or JSON showing port availability status for each port checked.

deps - Dependency Verification

Check if required system dependencies are installed and accessible.

bash
nixopus preflight deps [DEPENDENCY...] [OPTIONS]

Arguments:

  • DEPENDENCY... - List of dependencies to check (required)
OptionShortDescriptionDefault
--verbose-vShow detailed loggingfalse
--output-oOutput format (text, json)text
--timeout-tOperation timeout in seconds10

Common Dependencies:

  • docker - Docker container runtime
  • docker-compose - Docker Compose orchestration
  • git - Git version control
  • curl - HTTP client utility
  • ssh - SSH client

Examples:

bash
# Check core dependencies
nixopus preflight deps docker git

# Check with verbose output
nixopus preflight deps docker git --verbose

# Get JSON output
nixopus preflight deps docker git --output json

Output: The command outputs a formatted table showing dependency availability. Uses shutil.which() to check if commands are available in the system PATH.

Configuration

The preflight command reads configuration values from the built-in config.prod.yaml file to determine which ports and dependencies to check.

Default Configuration Values

SettingDefault ValueConfiguration PathDescription
Ports[2019, 80, 443, 7443, 8443, 6379, 5432]portsPorts checked by default
Timeout10 secondsN/AOperation timeout (hardcoded default)

Configuration Source

Configuration is loaded from the built-in config.prod.yaml:

yaml
# Built-in configuration
ports: [2019, 80, 443, 7443, 8443, 6379, 5432]

deps:
  curl:           { package: "curl",           command: "curl" }
  python3:        { package: "python3",        command: "python3" }
  python3-venv:   { package: "python3-venv",   command: "" }
  git:            { package: "git",            command: "git" }
  docker.io:      { package: "docker.io",      command: "docker" }
  openssl:        { package: "openssl",        command: "openssl" }
  openssh-client: { package: "openssh-client", command: "ssh" }
  openssh-server: { package: "openssh-server", command: "sshd" }

Port Descriptions

PortServicePurpose
2019CaddyAdmin API port
80HTTPWeb traffic
443HTTPSSecure web traffic
7443ViewFrontend service
8443APIBackend service
6379RedisCache/session store
5432PostgreSQLDatabase

Available Dependencies

CommandPackagePurpose
curlcurlHTTP client utility
python3python3Python runtime
gitgitVersion control
dockerdocker.ioContainer runtime
opensslopensslSSL/TLS toolkit
sshopenssh-clientSSH client
sshdopenssh-serverSSH server

Error Handling

Common error scenarios and solutions:

ErrorCauseSolution
Port already in useService running on checked portStop conflicting service or use different ports
Command not foundDependency not installedInstall required package using system package manager
Permission deniedDocker requires elevated privilegesAdd user to docker group or use sudo
Connection timeoutNetwork issues or slow systemIncrease timeout with --timeout option
Invalid port numberPort outside valid rangeUse port numbers between 1-65535

Permission Issues

If you encounter permission errors, especially with Docker:

bash
# Check if docker requires sudo
docker ps
# If this fails with permission denied:

# Add user to docker group
sudo usermod -aG docker $USER

# Restart shell session
newgrp docker

# Test without sudo
docker ps

# Or use sudo for preflight checks
sudo nixopus preflight deps docker

Note: When using sudo, ensure the command can access the same configuration files.

Made with love
Released under the Functional Source License (FSL)