# techiescamp/devops-projects architecture

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

- Interactive diagram: https://gitdiagram.com/techiescamp/devops-projects
- Repository: https://github.com/techiescamp/devops-projects

## Overview

##### Project Type and Purpose
- Notice that each top-level directory (e.g., “01-jenkins-setup”, “02-consul-sevice-discovery”, “03-scalable-java-app”, etc.) represents a stand-alone project. Each project is focused on provisioning and automating different infrastructure elements using technologies such as Ansible, Terraform, Packer, Docker-Compose, etc.
- For example, “01-jenkins-setup” focuses on building a High-Availability Jenkins infrastructure that includes controller and agent setup, “02-consul-sevice-discovery” demonstrates setting up Consul-based service discovery (plus load balancing), and “03-scalable-java-app” covers a scalable app deployment with CI/CD (Jenkinsfile) integration.

##### File Structure and Architectural Choices
- Each project directory is structured with clear separation between automation scripts (Ansible), infrastructure provisioning (Terraform), and image building (Packer files for Jenkins, Java app, or Prometheus components).
- In “01-jenkins-setup”, for example, the “ansible” folder includes roles for different components (controller and agent), while the “terraform” folder is broken down into modules (ec2, efs, iam, lb-asg). Similar separation is seen in other project directories.
- The projects use templating (Jinja2 templates in Ansible roles) and configuration modules to define infrastructure resources consistently. This hints at a modular design philosophy.

##### Main Components and Their Interactions
○ Jenkins Controller: Represented by its Packer build file (jenkins-controller.pkr.hcl) and Ansible playbooks/roles (jenkins-controller tasks and templates).
○ Jenkins Agent: Shown with its respective Packer file, Ansible roles (including tasks for Java, SSH, and tools installation), and connectivity to the controller.
○ Infrastructure Provisioning: Terraform modules for EC2 (instances), EFS (file storage), IAM (permissions), and LB-ASG (load balancer and autoscaling group). These modules indicate the AWS resources provisioned to support Jenkins.
○ Automation Tools: Ansible (used for configuration management and installation tasks) and Packer (for creating application machine images).
- For “02-consul-sevice-discovery”:
○ Consul Server: Deployed via Ansible roles with its configuration templates.
○ Backends and Load Balancer: Represented through additional roles and templating, including Nginx configurations.
○ Terraform provisioning: A more straightforward Terraform file (provision.tf, variable.tf) for resource creation.
- Similarly, for “03-scalable-java-app”, add elements for:
○ The Java Application itself.
○ The Jenkins pipeline (Jenkinsfile) that automates builds and deployments.
○ Integration with AWS RDS and ALB/ASG infrastructure (illustrated by Terraform modules).

##### Important Architectural Patterns and Design Principles
- Modularity: Each service or component (controller, agent, load balancer, database, etc.) is encapsulated in its own Terraform module or Ansible role.
- Automation and IaC (Infrastructure-as-Code): The heavy use of Terraform and Ansible indicates a design centered on reproducibility and automated deployments.
- Template Driven Configuration: Use of templating (Jinja2 .j2 files) indicates dynamic configuration management based on environment variables or parameters.
- Scalability & High-Availability: Projects like “01-jenkins-setup” and “03-scalable-java-app” emphasize HA (via autoscaling groups and load balancers) and separation of concerns (controller vs. agent, web app vs. database layers).

##### Technologies, Frameworks, and Tools to Highlight
- Ansible: For configuration management and automation scripts.
- Terraform: For provisioning AWS resources (EC2, EFS, IAM, VPCs, ALB/ASG, RDS, etc.)
- Packer: For creating machine images used by Jenkins and other services.
- Docker Compose: In “04-prometheus-observability-stack”, which uses Docker for container orchestration of Prometheus and Alertmanager.
- Various templates and configuration management practices using Jinja2.

##### Specific Elements
- External services such as DNS, external APIs, or monitoring systems (e.g., Prometheus, Grafana) as needed.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Global Project Node
    dp("DevOps Projects"):::header

    %% 01-Jenkins-Setup Subgraph
    subgraph "01-Jenkins-Setup"
        jcP("Jenkins Controller (Packer Build)"):::automation
        jcA("Jenkins Controller (Ansible Role)"):::automation
        jaP("Jenkins Agent (Packer Build)"):::automation
        jaA("Jenkins Agent (Ansible Role)"):::automation
        tfEC2("Terraform: AWS EC2"):::infrastructure
        tfEFS("Terraform: AWS EFS"):::infrastructure
        tfIAM("Terraform: AWS IAM"):::infrastructure
        tfLB("Terraform: LB & ASG"):::infrastructure
    end

    %% 02-Consul-Service Discovery Subgraph
    subgraph "02-Consul-Service Discovery"
        consul("Consul Server (Ansible Role)"):::automation
        lbConsul("Load Balancer (Ansible Role)"):::automation
        tfConsul("Terraform Provisioning"):::infrastructure
    end

    %% 03-Scalable-Java-App Subgraph
    subgraph "03-Scalable-Java-App"
        jPipeline("Jenkins Pipeline (Jenkinsfile)"):::automation
        javaRole("Java Application (Ansible Role)"):::automation
        javaPkr("Java Application (Packer Build)"):::automation
        tfALB("Terraform: ALB-ASG"):::infrastructure
        tfRDS("Terraform: RDS"):::infrastructure
    end

    %% 04-Prometheus-Observability Subgraph
    subgraph "04-Prometheus-Observability"
        promConfig("Prometheus Configuration"):::automation
        dockerC("Docker Compose Setup"):::automation
        tfProm("Terraform: AWS Modules for Prometheus"):::infrastructure
    end

    %% Connections from Global Node to Projects
    dp -->|"triggers"| jcP
    dp -->|"triggers"| consul
    dp -->|"triggers"| jPipeline
    dp -->|"triggers"| promConfig

    %% 01-Jenkins-Setup Relationships
    jcP -->|"configured"| jcA
    jaP -->|"configured"| jaA
    jcA -->|"deploys"| tfEC2
    jaA -->|"deploys"| tfEC2
    tfEC2 -->|"integrates"| tfEFS
    tfEC2 -->|"integrates"| tfIAM
    tfEC2 -->|"integrates"| tfLB

    %% 02-Consul-Service Discovery Relationships
    consul -->|"routes to"| lbConsul
    lbConsul -->|"provisions"| tfConsul

    %% 03-Scalable-Java-App Relationships
    jPipeline -->|"initiates"| javaRole
    jPipeline -->|"initiates"| javaPkr
    javaRole -->|"provisions"| tfALB
    tfALB -->|"supports"| tfRDS

    %% 04-Prometheus-Observability Relationships
    promConfig -->|"orchestrates"| tfProm
    dockerC -->|"orchestrates"| tfProm

    %% Click Events for 01-Jenkins-Setup
    click jcP "https://github.com/techiescamp/devops-projects/blob/main/01-jenkins-setup/jenkins-controller.pkr.hcl"
    click jcA "https://github.com/techiescamp/devops-projects/tree/main/01-jenkins-setup/ansible/roles/jenkins-controller"
    click jaP "https://github.com/techiescamp/devops-projects/blob/main/01-jenkins-setup/jenkins-agent.pkr.hcl"
    click jaA "https://github.com/techiescamp/devops-projects/tree/main/01-jenkins-setup/ansible/roles/jenkins-agent"
    click tfEC2 "https://github.com/techiescamp/devops-projects/tree/main/01-jenkins-setup/terraform/modules/ec2"
    click tfEFS "https://github.com/techiescamp/devops-projects/tree/main/01-jenkins-setup/terraform/modules/efs"
    click tfIAM "https://github.com/techiescamp/devops-projects/tree/main/01-jenkins-setup/terraform/modules/iam"
    click tfLB "https://github.com/techiescamp/devops-projects/tree/main/01-jenkins-setup/terraform/modules/lb-asg"

    %% Click Events for 02-Consul-Service Discovery
    click consul "https://github.com/techiescamp/devops-projects/tree/main/02-consul-sevice-discovery/ansible/roles/consul"
    click lbConsul "https://github.com/techiescamp/devops-projects/tree/main/02-consul-sevice-discovery/ansible/roles/load-balancer"
    click tfConsul "https://github.com/techiescamp/devops-projects/tree/main/02-consul-sevice-discovery/terraform"

    %% Click Events for 03-Scalable-Java-App
    click jPipeline "https://github.com/techiescamp/devops-projects/tree/main/03-scalable-java-app/Jenkinsfile"
    click javaRole "https://github.com/techiescamp/devops-projects/tree/main/03-scalable-java-app/ansible/roles/java"
    click javaPkr "https://github.com/techiescamp/devops-projects/blob/main/03-scalable-java-app/ansible/java-app.pkr.hcl"
    click tfALB "https://github.com/techiescamp/devops-projects/tree/main/03-scalable-java-app/terraform/modules/alb-asg"
    click tfRDS "https://github.com/techiescamp/devops-projects/tree/main/03-scalable-java-app/terraform/modules/rds"

    %% Click Events for 04-Prometheus-Observability
    click promConfig "https://github.com/techiescamp/devops-projects/tree/main/04-prometheus-observability-stack/prometheus"
    click dockerC "https://github.com/techiescamp/devops-projects/blob/main/04-prometheus-observability-stack/docker-compose.yml"
    click tfProm "https://github.com/techiescamp/devops-projects/tree/main/04-prometheus-observability-stack/terraform-aws"

    %% Class Styles
    classDef header fill:#D3D3FF,stroke:#00008B,stroke-width:2px;
    classDef automation fill:#C1F0C1,stroke:#2E8B57,stroke-width:2px;
    classDef infrastructure fill:#F0E68C,stroke:#B8860B,stroke-width:2px;
```
