How hoojinguyen/airo works
Based on our analysis of the file tree and README, Airo is a command-line deployment tool written in Go that simplifies deploying Dockerized services to a self-hosted production server. Its primary purpose is to allow developers to build, push, and deploy containerized applications without the overhead of setting up complex CI/CD pipelines or using managed platforms.
Main Components
• CLI Interface & Command Engine: Represented by the main executable (src/main.go) that accepts commands such as “deploy”, “compose”, and “caddy”.
• Configuration Module: Located in src/lib/config.go, which reads and interprets the deployment environment files (env.yml) and service definitions (compose.yml). These configuration files are essential for defining server details and service parameters.
• Remote Deployment Engine: The part of the tool that handles SSH connections (as indicated by the README) to update the configurations and Docker containers on the self-hosted server.
• Reverse Proxy & HTTPS Manager: This is achieved via handling the Caddy configuration (example/Caddyfile) for automatically setting up HTTPS and reverse proxy rules on the production server.
• Auxiliary/Example Configuration: The “example” directory contains sample files (Caddyfile, compose.yml, env.yml) that illustrate how services should be set up, helping users understand what to expect and configure.
Relationships and Interactions
• The CLI receives user commands which, through the Go-based command engine, trigger different workflows (deploy, compose, caddy).
• The configuration component reads from env.yml and compose.yml to obtain deployment and service definitions.
• Upon a deployment command, the tool will trigger routines to:
a. Build Docker images based on provided Dockerfiles.
b. Push these images to a specified registry.
c. Use SSH to connect to the target production server.
d. Deploy or update running containers.
• For reverse proxy and HTTPS updates, the tool uses the Caddyfile configuration to reconfigure the server’s reverse proxy via a specific subcommand.
• Data flows from the local machine (where commands are issued and Docker operations happen) toward the production server (receiving the deployment updates).
Architectural Patterns and Design Principles
• Modular Design: The separation into distinct modules (command interface, configuration parsing, deployment logic) helps in maintaining and extending the tool.
• Single Command Deployment: Emphasizes simplicity by abstracting multiple steps (build, push, deploy) into simple command-line operations.
• Decoupling: The tool is designed so that services (defined in compose.yml) and server settings (in env.yml) are decoupled from the application logic.