# manuelromerovega/vagrant-ansible-provisioning architecture

> Architecture diagram of the GitHub repository manuelromerovega/vagrant-ansible-provisioning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manuelromerovega/vagrant-ansible-provisioning
- Repository: https://github.com/manuelromerovega/vagrant-ansible-provisioning

## Overview

##### Project type and purpose
- This is a full-stack Java web application (Spring MVC) with integrated DevOps provisioning.
- The primary purpose is to provide user-account management features—registration, login, file upload—backed by MySQL, RabbitMQ, Memcached and ElasticSearch.
- The ansible/ and vagrant/ folders plus Jenkinsfile indicate automated VM provisioning (Vagrant/Ansible) and a CI/CD pipeline (Jenkins).

##### File structure
- Top-level:
- Jenkinsfile (CI pipeline)
- pom.xml (Maven build)
- ansible/ (playbooks, templates for service files)
- vagrant/ (automated & manual VM setups)
- src/main/java/com/visualpathit/account (controllers, services, repositories, utils)
- src/main/webapp (JSP views, web.xml, Spring XML configs)
- src/main/resources (application.properties, logging, DB backup)
- src/test (JUnit tests)
- Architectural pattern: layered MVC monolith with Spring controllers → services → repositories, plus utility clients for RabbitMQ, Memcached, ElasticSearch.
- DevOps: Ansible roles/playbooks to configure Tomcat, MySQL, RabbitMQ, Memcached on Vagrant VMs.

##### Key README insights
- “Provision de VMs automatizada / manual” for DevOps.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CI/CD Layer
    subgraph "CI/CD Pipeline" 
        Jenkins["Jenkins"]:::ci
        Maven["Maven Build"]:::build
    end
    Jenkins -->|trigger build| Maven
    click Jenkins "https://github.com/manuelromerovega/vagrant-ansible-provisioning/tree/main/Jenkinsfile"
    click Maven "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/pom.xml"

    %% Provisioning Layer
    subgraph "Provisioning Layer" 
        Vagrant["Vagrant"]:::infra
        Ansible["Ansible"]:::infra
    end
    Maven -->|invoke| Vagrant
    Maven -->|invoke| Ansible
    Vagrant -->|provision VMs| Ansible
    click Ansible "https://github.com/manuelromerovega/vagrant-ansible-provisioning/tree/main/ansible/"
    click Vagrant "https://github.com/manuelromerovega/vagrant-ansible-provisioning/tree/main/vagrant/Automated_provisioning/Vagrantfile"
    click Vagrant "https://github.com/manuelromerovega/vagrant-ansible-provisioning/tree/main/vagrant/Manual_provisioning/Vagrantfile"

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        subgraph "App VM"
            Tomcat["Tomcat + Spring MVC App"]:::app
            Tomcat -->|deploy WAR| SpringApp["Application Layer"] 
        end
        subgraph "DB VM"
            MySQL[(MySQL DB)]:::db
        end
        subgraph "Messaging VM"
            RabbitMQ[(RabbitMQ)]:::mq
        end
        subgraph "Cache VM"
            Memcached[(Memcached)]:::cache
        end
        subgraph "Search VM"
            ES[(ElasticSearch)]:::search
        end
    end
    Ansible -->|configure| Tomcat
    Ansible -->|configure| MySQL
    Ansible -->|configure| RabbitMQ
    Ansible -->|configure| Memcached
    Ansible -->|configure| ES

    %% Application Layer
    subgraph "Application Layer"
        subgraph "Presentation Layer"
            Browser["Web Browser"]:::external
            Views["JSP Views"]:::frontend
            Static["Static Resources"]:::frontend
            Browser -->|HTTP| Tomcat
            Tomcat -->|renders| Views
            Tomcat -->|serves| Static
        end
        subgraph "Controller Layer"
            UserCtrl["UserController"]:::backend
            FileCtrl["FileUploadController"]:::backend
            ESCtrl["ElasticSearchController"]:::backend
        end
        subgraph "Service Layer"
            UserSvc["UserService"]:::backend
            SecSvc["SecurityService"]:::backend
            ProdSvc["ProducerService"]:::backend
            ConsSvc["ConsumerService"]:::backend
        end
        subgraph "Repository Layer"
            UserRepo["UserRepository"]:::backend
            RoleRepo["RoleRepository"]:::backend
        end
        subgraph "Utilities"
            RabbitUtil["RabbitMqUtil"]:::util
            MemUtil["MemcachedUtils"]:::util
            ESUtil["ElasticsearchUtil"]:::util
        end
        subgraph "Config & Resources"
            AppProps["application.properties"]:::config
            LogConfig["logback.xml"]:::config
            DBBackup["db_backup.sql"]:::config
        end

        %% Data flows
        Views -->|form submit| UserCtrl
        FileCtrl -->|upload| UserSvc
        ESCtrl -->|search req| ESUtil
        UserCtrl -->|calls| UserSvc
        UserSvc -->|JDBC| UserRepo
        SecSvc -->|auth| UserRepo
        ProdSvc -->|AMQP| RabbitUtil
        ConsSvc -->|AMQP| RabbitUtil
        RabbitUtil -->|AMQP| RabbitMQ
        MemUtil -->|cache get/set| Memcached
        ESUtil -->|HTTP| ES
    end

    %% Click events
    click Views "https://github.com/manuelromerovega/vagrant-ansible-provisioning/tree/main/src/main/webapp/WEB-INF/views/"
    click Static "https://github.com/manuelromerovega/vagrant-ansible-provisioning/tree/main/src/main/webapp/resources/"
    click UserCtrl "https://github.com/manuelromerovega/vagrant-ansible-provisioning/tree/main/src/main/java/com/visualpathit/account/controller/"
    click FileCtrl "https://github.com/manuelromerovega/vagrant-ansible-provisioning/tree/main/src/main/java/com/visualpathit/account/controller/"
    click ESCtrl "https://github.com/manuelromerovega/vagrant-ansible-provisioning/tree/main/src/main/java/com/visualpathit/account/controller/"
    click UserSvc "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/java/com/visualpathit/account/service/UserService.java"
    click SecSvc "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/java/com/visualpathit/account/service/SecurityService.java"
    click ProdSvc "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/java/com/visualpathit/account/service/ProducerService.java"
    click ConsSvc "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/java/com/visualpathit/account/service/ConsumerService.java"
    click UserRepo "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/java/com/visualpathit/account/repository/UserRepository.java"
    click RoleRepo "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/java/com/visualpathit/account/repository/RoleRepository.java"
    click RabbitUtil "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/java/com/visualpathit/account/utils/RabbitMqUtil.java"
    click MemUtil "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/java/com/visualpathit/account/utils/MemcachedUtils.java"
    click ESUtil "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/java/com/visualpathit/account/utils/ElasticsearchUtil.java"
    click AppProps "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/resources/application.properties"
    click LogConfig "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/resources/logback.xml"
    click DBBackup "https://github.com/manuelromerovega/vagrant-ansible-provisioning/blob/main/src/main/resources/db_backup.sql"

    %% Styles
    classDef ci fill:#f9f,stroke:#333,stroke-width:1px
    classDef build fill:#bbf,stroke:#333,stroke-width:1px
    classDef infra fill:#fcf,stroke:#333,stroke-width:1px
    classDef app fill:#cfc,stroke:#333,stroke-width:1px
    classDef external fill:#eef,stroke:#333,stroke-width:1px
    classDef frontend fill:#def,stroke:#333,stroke-width:1px
    classDef backend fill:#fed,stroke:#333,stroke-width:1px
    classDef db fill:#ffb,stroke:#333,stroke-width:1px
    classDef mq fill:#fbf,stroke:#333,stroke-width:1px
    classDef cache fill:#bff,stroke:#333,stroke-width:1px
    classDef search fill:#ffdfba,stroke:#333,stroke-width:1px
    classDef util fill:#ddf,stroke:#333,stroke-width:1px
    classDef config fill:#ffd,stroke:#333,stroke-width:1px
```
