How iesgn/hosting-proyecto works
Project type and purpose
• This is an automated hosting platform (“AutoHosting”) that provisions and configures servers for Drupal, MediaWiki, PrestaShop and a custom management panel.
• It leverages Terraform (0.12.0) for infrastructure provisioning and Ansible (2.2.1.0) for configuration management.
• It also includes two Python WSGI web applications (“hosting” and “panel”) that provide user-facing interfaces to trigger and monitor the automation.
High-level architecture components
a. Terraform layer
• Responsible for creating cloud resources (VM instances, network, security groups).
b. Ansible controller
• Executes playbooks and roles against the freshly provisioned servers.
• Roles are split into “install_*” (installing software: Apache, PHP, CMS prerequisites) and “hosting_*” (configuring virtual hosts, templates, site files).
• A “common” role manages baseline tasks (user accounts, firewall).
c. Cloud provider
• Hosts the VMs for:
– CMS servers (Drupal, MediaWiki, PrestaShop)
– Panel application server
– (Optional) Database server (“database_hosting”)
d. Web applications
• hosting.py WSGI app – allows users to request new CMS hosting, which under the hood invokes Terraform & Ansible.
• panel.py WSGI app – management panel to view logs, software lists, CMS status.
e. Data stores / external services
• Underlying database for user accounts and server metadata.
• File system storage for CMS assets and logs.
Component interactions and data flows
1. User → hosting.py (WSGI)
• Initiates a “create server” request.
2. hosting.py → Terraform CLI
• Calls Terraform to provision a new VM.
3. Terraform → Cloud API
• Creates the VM and returns its IP.
4. hosting.py (or orchestrator) → Ansible Controller
• Invokes Ansible playbook (e.g., site_drupal.yml) against the new VM.
5. Ansible Controller → VM via SSH
• Runs “common”, “install_drupal”, and “hosting_drupal” roles in sequence.
6. CMS server → Database server
• CMS connects to its database backend.
7. User → panel.py (WSGI)
• Retrieves logs/status by Ansible ad-hoc commands or by reading log files directly on CMS servers.
Architectural patterns and design principles
• Infrastructure as Code (Terraform)
• Configuration as Code (Ansible roles/playbooks)
• Modular roles: “install_*” vs “hosting_*” to separate software installation from host-specific configuration
• Micro-services style separation: dedicated VMs for different CMS types + management panel
• MVC for Python WSGI apps (templates under Aplicaciones/*/html, logic in .py)
Relevant technologies and frameworks
• Terraform 0.12.0
• Ansible 2.2.1.0 with:
• group_vars/all for global variables
• roles/common, roles/install_*, roles/hosting_*
• Python (WSGI apps)
• Jinja2 templating (Ansible + web apps)
• HTML/CSS for frontend templates
• Optional DB (MySQL/PostgreSQL) for CMS and user metadata