How sahsanu/hestiacp works
Main Components
• User Interfaces:
– Web Interface: Represented by the “web” directory (the PHP/HTML/CSS/JS UI, including login, dashboard, and all user-facing pages).
– Command-Line Interface: The “bin” directory scripts (e.g., v-add-*, v-change-*, v-list-* commands) that allow administrators to perform system management tasks.
• Core Application Logic:
– PHP Application Engine: Located in “web/src/app/…”, which contains the core classes, business logic, and the command routing mechanism used by the control panel.
– API Endpoints: Files in “web/api” and the various “install/common/api” modules which expose programmatic ways to interact with billing, mail, and DNS endpoints.
• Deployment and Installation:
– Installer & Upgrade Scripts: Found under “install” (including subdirectories for different Linux distributions and package definitions) and upgrade versions in “install/upgrade” to perform installation, configuration, and updates.
– Packaging Components: “src/deb” and “install/deb” hold the Debian packaging/control files to integrate with OS-native service managers.
• Underlying Server Services (External/OS components):
– Web Servers: Apache2 and NGINX (with configuration files under “install/deb/apache2”, “install/deb/nginx”).
– Database Servers: MariaDB/MySQL and PostgreSQL (config files under “install/deb/mysql” and “install/deb/postgresql”).
– DNS Service: Bind, with clustering capabilities (configs under “install/deb/bind” and DNS templates in “install/common/templates/dns”).
– Mail Services: Dovecot, Exim, Roundcube, ClamAV, SpamAssassin (found in “install/common/dovecot”, “install/deb/exim”, “install/deb/roundcube” respectively).
– Firewall and Security: Integration of iptables/ipset, fail2ban, and additional security scripts.
– SSL and Certificate Management: Let’s Encrypt integration, as seen from scripts like “v-add-letsencrypt-domain” and configuration templates.
• Infrastructure for CI/Testing & Documentation:
– CI/CD Configuration: GitHub workflows, Drone pipelines, linting, and test scripts (directories like “.github”, “.drone.yml”, “test”).
– Documentation: Extensive documentation and guides under “docs” that explain deployment, usage, and administration.
Relationships and Interactions
• The Control Panel’s Frontend (Web UI) communicates with its backend PHP engine and API endpoints to display system status, manage configurations, and trigger server-side processes.
• The core engine, implemented in PHP and complemented with CLI scripts, orchestrates changes across the underlying server services. When an administrator triggers an action (for example, adding a domain or configuring a database), the control panel calls the corresponding command-line script (located in “bin”) and may update configuration files/templates.
• The installation/upgrade modules ensure that the control panel’s code and configuration are properly integrated with the underlying services on the target operating system (Debian/Ubuntu).
• External services (web server, DNS, mail, database, firewall) are managed through configuration files and service controllers/templates, with the control panel communicating with them (often via file modifications, service commands, or API calls).
• CI/CD pipelines and test suites are run during development and integration to ensure code quality.
Important Architectural Patterns and Design Principles
• Modularity: Each service (web, DNS, mail, database, firewall) has its own set of configuration and management scripts, allowing for isolated updates.
• Separation of Concerns: The clear division between the Web UI, backend business logic, command-line administrative tools, and installation/packaging components.
• Template-driven Deployment: Use of installation templates (for Apache, NGINX, mail, and DNS) to ensure consistency across deployments.
• Integration with Operating System Services: The project appears to embrace a “control and configure” approach rather than reimplementing server software; it leverages existing OS-level daemons and simply manages their configuration.