# a-c-g/ubuntuserver architecture

> Architecture diagram of the GitHub repository a-c-g/ubuntuserver, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/a-c-g/ubuntuserver
- Repository: https://github.com/a-c-g/ubuntuserver

## Overview

##### Main Components

a) External Systems:
- Spring Backend Server (source of user data)
- Git Repositories (destination for commits)
- User CSV Data Source

b) Core Components:
- CSV Request Handler
- Directory Management System
- Push Management System
- File Monitoring Daemon
- Cron Job Scheduler

##### Component Relationships

**[Spring Server] → [CSV Request Handler] → [User CSV Storage]**
- ↓
**[Directory Manager] ← [User CSV Storage] → [Push Manager]**
- ↓                                       ↓
**[User Directories] → [File Monitor Daemon] → [Git Repositories]**

##### Key Processes to Highlight

a) CSV Management Flow:
- requestCSV.sh fetching data from Spring Server
- CSV data storage and processing
- Status checking and validation

b) Directory Management Flow:
- MASTER_CALL_MKDIR.sh creating user directories
- Soft link creation for .exp files
- Directory structure maintenance

c) Push Management Flow:
- MASTER_CALL_PUSH.sh handling git pushes
- README updates
- Repository management

##### Scheduled Tasks
A separate section showing the cron schedule:
**[23:50 Daily] → CSV Request**
**[23:55 Daily] → Directory Management**
**[Every 12 hours] → Push Management**

##### Monitoring System
Continuous monitoring system:
**[File Monitor Daemon] → [.exp Files] → [Backup System]**

##### Important Details

- Directory structure hierarchy
- File relationships and dependencies
- Backup and recovery mechanisms
- Integration points with external systems

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Systems
    subgraph External
        SpringServer["Spring Backend Server"]:::external
        GitRepos["Git Repositories"]:::external
        CSVSource["User CSV Data Source"]:::external
    end

    %% Core Components
    subgraph Core
        CSVHandler["CSV Request Handler"]:::core
        DirManager["Directory Management System"]:::core
        PushManager["Push Management System"]:::core
        FileMonitor["File Monitoring Daemon"]:::daemon
        CronScheduler["Cron Job Scheduler"]:::scheduler
    end

    %% Data Storage
    UserCSV[("User CSV Storage")]:::storage

    %% User Directories
    UserDirs["User Directories"]:::directory

    %% Authentication
    subgraph Auth
        TokenHandler["Token Handler"]:::auth
        EmailConfig["Email Configuration"]:::auth
        RepoConfig["Repository Configuration"]:::auth
    end

    %% Relationships
    SpringServer --> CSVHandler
    CSVHandler --> UserCSV
    UserCSV --> DirManager
    UserCSV --> PushManager
    DirManager --> UserDirs
    UserDirs --> FileMonitor
    FileMonitor --> GitRepos
    PushManager --> GitRepos

    %% Authentication Flow
    TokenHandler --> PushManager
    EmailConfig --> PushManager
    RepoConfig --> PushManager

    %% Scheduler Control
    CronScheduler --> |"23:50 Daily"| CSVHandler
    CronScheduler --> |"23:55 Daily"| DirManager
    CronScheduler --> |"Every 12h"| PushManager

    %% Click Events
    click CSVHandler "https://github.com/A-C-G/UbuntuServer/blob/master/requestCSV.sh"
    click DirManager "https://github.com/A-C-G/UbuntuServer/blob/master/MASTER_CALL_MKDIR.sh"
    click PushManager "https://github.com/A-C-G/UbuntuServer/blob/master/MASTER_CALL_PUSH.sh"
    click FileMonitor "https://github.com/A-C-G/UbuntuServer/blob/master/MASTER_CALL_COMPARE_EXP.sh"
    click TokenHandler "https://github.com/A-C-G/UbuntuServer/blob/master/EXP_CALL_TOKEN.sh"
    click EmailConfig "https://github.com/A-C-G/UbuntuServer/blob/master/EXP_CALL_EMAIL.sh"
    click RepoConfig "https://github.com/A-C-G/UbuntuServer/blob/master/EXP_CALL_REPONAME.sh"

    %% Styling
    classDef external fill:#a8d1f0,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef storage fill:#FFE4B5,stroke:#333
    classDef daemon fill:#FFB6C1,stroke:#333
    classDef scheduler fill:#DDA0DD,stroke:#333
    classDef directory fill:#F0E68C,stroke:#333
    classDef auth fill:#98FB98,stroke:#333

    %% Legend
    subgraph Legend
        L1["External System"]:::external
        L2["Core Component"]:::core
        L3[("Data Storage")]:::storage
        L4["Daemon Process"]:::daemon
        L5["Scheduler"]:::scheduler
        L6["Directory"]:::directory
        L7["Authentication"]:::auth
    end
```
