# codebleu/gitlab_bm architecture

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

- Interactive diagram: https://gitdiagram.com/codebleu/gitlab_bm
- Repository: https://github.com/codebleu/gitlab_bm

## Overview

##### Main Components

a. Core GLBM Application
- It as a hexagon or rectangle with rounded corners
- Main modules visible in the src/gitlab_bm directory:
- Backup Manager (backup.py)
- Configuration Manager (config.py)
- S3 Integration (s3_utils.py)
- Notification System (slack.py)

b. External Services
- GitLab Instance (source of backups)
- S3 Storage (destination for backups)
- Slack (notifications)

##### Component Relationships

- GLBM → GitLab: Backup extraction
- GLBM → S3: Backup storage
- GLBM → Slack: Notifications

##### Configuration Sources (show as input layers)
- Config files (multiple locations)
- Environment variables

##### Specific process flows
a. Main backup flow:
- GitLab → GLBM → S3 Storage
b. Configuration backup flow:
- GitLab Config → GLBM → S3 Storage
c. Cleanup flow:
- GLBM → S3 Storage (deletion of old backups)

##### Important Details to Highlight
- Configuration hierarchy
- Backup types (Main Backup vs. Backup Config)
- Retention policy flow (days_to_keep parameter)
- Skip backup options

**Top Layer: Configuration Sources**
**Middle Layer: GLBM Core Components**
**Bottom Layer: External Services**

Special Considerations:
##### Error/notification flows to Slack

Keep the abstraction level focused on the system architecture while including enough detail to show the backup management workflow. This will help developers understand both the high-level structure and the specific interactions between components.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef external fill:#2ecc71,stroke:#27ae60,color:white
    classDef config fill:#f1c40f,stroke:#f39c12,color:black
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Configuration Layer
    subgraph ConfigSources
        Config["Configuration Files"]:::config
        EnvVars["Environment Variables"]:::config
    end

    %% Core GLBM Application Layer
    subgraph CoreGLBM["Core GLBM Application"]
        CLI["CLI Interface"]:::core
        AppInfo["Application Info"]:::core
        BackupMgr["Backup Manager"]:::core
        ConfigMgr["Configuration Manager"]:::core
        S3Utils["S3 Integration"]:::core
        SlackNotif["Notification System"]:::core
        Logger["Logging System"]:::core
    end

    %% External Services Layer
    subgraph ExternalServices
        GitLab["GitLab Instance"]:::external
        S3["S3 Storage"]:::storage
        Slack["Slack"]:::external
    end

    %% Relationships
    Config --> ConfigMgr
    EnvVars --> ConfigMgr
    CLI --> BackupMgr
    ConfigMgr --> BackupMgr
    BackupMgr --> S3Utils
    BackupMgr --> SlackNotif
    BackupMgr --> Logger
    S3Utils --> S3
    SlackNotif --> Slack
    BackupMgr --> GitLab
    AppInfo --> CLI

    %% Click events for component mapping
    click CLI "https://github.com/codebleu/gitlab_bm/blob/main/src/gitlab_bm/main.py"
    click BackupMgr "https://github.com/codebleu/gitlab_bm/blob/main/src/gitlab_bm/backup.py"
    click ConfigMgr "https://github.com/codebleu/gitlab_bm/blob/main/src/gitlab_bm/config.py"
    click S3Utils "https://github.com/codebleu/gitlab_bm/blob/main/src/gitlab_bm/s3_utils.py"
    click SlackNotif "https://github.com/codebleu/gitlab_bm/blob/main/src/gitlab_bm/slack.py"
    click Logger "https://github.com/codebleu/gitlab_bm/blob/main/src/gitlab_bm/logging_setup.py"
    click AppInfo "https://github.com/codebleu/gitlab_bm/blob/main/src/gitlab_bm/app_info.py"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["External Services"]:::external
        L3["Configuration"]:::config
        L4["Storage"]:::storage
    end
```
