# remla25-team21/operation architecture

> Architecture diagram of the GitHub repository remla25-team21/operation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/remla25-team21/operation
- Repository: https://github.com/remla25-team21/operation

## Overview

##### Project type and purpose
- This is an “operations” or orchestration repository for a full-stack, microservice-based sentiment-analysis application.
- It coordinates several independent components (model-training, lib-ml, model-service, lib-version, app) and provides both a Docker-Compose development setup and an automated Kubernetes cluster provisioning (via Vagrant + Ansible).

##### File structure
- Top-level files:
- README.md, ACTIVITY.md, .gitignore → documentation
- Vagrantfile, setup_cluster.sh → VM and cluster setup automation
- ansible/
- files/kube-flannel.yml → CNI plugin manifest
- inventory/hosts & inventory.cfg → host definitions
- playbooks/*.yaml → provisioning steps (controller, node, finalization)
- kubernetes/docker-compose.yml → Docker-Compose definition for microservices
- ssh_keys/ → public keys for Vagrant user accounts

##### README for additional insights
- Describes application flow: user → frontend → backend → model-service → ML model
- Lists external repos to be pulled by Compose
- Documents two deployment modes:
a. Docker-Compose (local dev)
b. Kubernetes cluster (Vagrant + Ansible + Dashboard + Ingress + MetalLB)

##### Detail without over-complicating
- Distinct component from the repo: Vagrant, Ansible playbooks, Docker-Compose, Kubernetes entities, microservices, libraries
- Both development mode (Compose) and production mode (K8s) if space allows—use side-by-side panels or layered views

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% User Interaction
  User["End-User<br/>(Browser)"]:::external
  User -->|"HTTP"| Frontend

  %% Application Components
  subgraph "Application Layer"
    direction TB
    Frontend["Frontend<br/>(React UI)"]:::app
    AppService["App Service<br/>(REST API)"]:::app
    ModelService["Model Service<br/>(ML Serving)"]:::app
    MLModel["ML Model Artifact"]:::artifact
    LibML["lib-ml<br/>(Preprocessing)"]:::artifact
    LibVersion["lib-version<br/>(Metadata)"]:::artifact

    Frontend -->|"REST API"| AppService
    AppService -->|"HTTP"| ModelService
    ModelService -->|"loads model & calls"| MLModel
    ModelService -->|"uses"| LibML
    ModelService -->|"reads version"| LibVersion
    ModelService -->|"prediction"| AppService
    AppService -->|"response"| Frontend
  end

  %% Development Mode
  subgraph "Development Mode<br/>(Docker-Compose)" 
    direction TB
    Compose["Docker-Compose<br/>Network"]:::infra
    Compose --> Frontend
    Compose --> AppService
    Compose --> ModelService
  end

  %% Production Mode Infrastructure
  subgraph "Infrastructure Layer"
    direction TB

    VagrantNode["Vagrant VMs"]:::infra
    SSHKeys["SSH Keys"]:::infra
    Vagrantfile["Vagrantfile"]:::infra
    SetupScript["setup_cluster.sh"]:::infra

    subgraph "Ansible Provisioning"
      direction TB
      InventoryHosts["ansible/inventory/hosts"]:::infra
      InventoryCfg["ansible/inventory/inventory.cfg"]:::infra
      CNIManifest["ansible/files/kube-flannel.yml"]:::infra
      PlaybookGeneral["ansible/playbooks/general.yaml"]:::infra
      PlaybookController["ansible/playbooks/ctrl.yaml"]:::infra
      PlaybookNode["ansible/playbooks/node.yaml"]:::infra
      PlaybookFinal["ansible/playbooks/finalization.yml"]:::infra
    end

    Vagrantfile -->|provisions| VagrantNode
    SetupScript -->|runs| VagrantNode
    VagrantNode -->|configured by| InventoryHosts
    VagrantNode -->|configured by| InventoryCfg
    VagrantNode -->|applies| PlaybookGeneral
    VagrantNode -->|applies| PlaybookController
    VagrantNode -->|applies| PlaybookNode
    VagrantNode -->|applies| CNIManifest
    VagrantNode -->|applies| PlaybookFinal
    VagrantNode -->|uses| SSHKeys

    subgraph "Kubernetes Cluster"
      direction TB
      K8sIngress["Ingress"]:::infra
      K8sService["Services"]:::infra
      K8sDeploy["Deployments/Pods"]:::infra
      MetalLB["MetalLB"]:::infra
      Dashboard["Kubernetes Dashboard"]:::infra

      K8sIngress --> K8sService
      K8sService --> K8sDeploy
      VagrantNode --> K8sDeploy
      VagrantNode --> MetalLB
      VagrantNode --> Dashboard
    end
  end

  %% Click Events
  click README.md "https://github.com/remla25-team21/operation/blob/main/README.md"
  click ACTIVITY.md "https://github.com/remla25-team21/operation/blob/main/ACTIVITY.md"
  click Vagrantfile "https://github.com/remla25-team21/operation/tree/main/Vagrantfile"
  click SetupScript "https://github.com/remla25-team21/operation/blob/main/setup_cluster.sh"
  click InventoryHosts "https://github.com/remla25-team21/operation/tree/main/ansible/inventory/hosts"
  click InventoryCfg "https://github.com/remla25-team21/operation/blob/main/ansible/inventory/inventory.cfg"
  click CNIManifest "https://github.com/remla25-team21/operation/blob/main/ansible/files/kube-flannel.yml"
  click PlaybookController "https://github.com/remla25-team21/operation/blob/main/ansible/playbooks/ctrl.yaml"
  click PlaybookNode "https://github.com/remla25-team21/operation/blob/main/ansible/playbooks/node.yaml"
  click PlaybookGeneral "https://github.com/remla25-team21/operation/blob/main/ansible/playbooks/general.yaml"
  click PlaybookFinal "https://github.com/remla25-team21/operation/blob/main/ansible/playbooks/finalization.yml"
  click DockerCompose "https://github.com/remla25-team21/operation/blob/main/kubernetes/docker-compose.yml"
  click SSHKeys "https://github.com/remla25-team21/operation/tree/main/ssh_keys/"

  %% Styles
  classDef app fill:#bbdefb,stroke:#0d47a1,color:#0d47a1;
  classDef infra fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20;
  classDef artifact fill:#ffe0b2,stroke:#e65100,color:#e65100;
  classDef external fill:#f0f4c3,stroke:#827717,color:#827717;
```
