# bibliosansfrontieres/ideascube-deploy architecture

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

- Interactive diagram: https://gitdiagram.com/bibliosansfrontieres/ideascube-deploy
- Repository: https://github.com/bibliosansfrontieres/ideascube-deploy

## Overview

##### Main Components

a. Infrastructure Layer:
- CMAL Device (Host System)
- Balena Engine (Container Runtime)
- System Configuration Components
- Storage Management
- Network Configuration (Tinc VPN)

b. Container Layer:
- Traefik (Reverse Proxy/Load Balancer)
- Ideascube Container
- Kiwix Container
- Kolibri Container

c. Configuration Management:
- Ansible Roles Structure
- Content Management System
- Device Configuration Update System

**Top Tier: Infrastructure Management**

**Middle Tier: Container Orchestration**

**Bottom Tier: Application Containers**

##### Key Relationships

- Traefik's routing relationships with application containers
- Storage mounts and content management flows

##### Important Elements to Highlight

a. Automation Flow:
- Initialization process starting from ideascube_setup.sh
- Update paths for both containers and content

b. Security Layer:
- SSH Configuration
- Firewall Rules
- VPN Connectivity

c. Storage Management:
- Content Storage
- Log Management
- Backup Systems

##### Specific Implementation Details

- Annotations for key configuration files
- Version control integration points

##### The networking and security infrastructure

This system design should clearly communicate both the high-level architecture and the specific implementation details unique to this educational device deployment system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Infrastructure
        CMAL[CMAL Device Host]
        SysInit[System Initialization]:::init
        click SysInit "https://github.com/bibliosansfrontieres/ideascube-deploy/blob/master/ideascube_setup.sh"
        
        subgraph System_Config
            SysCfg[System Configuration]:::system
            click SysCfg "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/roles/setup_system/"
            Storage[Storage Management]:::storage
            click Storage "https://github.com/bibliosansfrontieres/ideascube-deploy/blob/master/roles/setup_system/tasks/storage.yml"
            SSH[SSH Configuration]:::security
            click SSH "https://github.com/bibliosansfrontieres/ideascube-deploy/blob/master/roles/setup_system/tasks/ssh_config.yml"
            Logs[Log Management]:::system
            click Logs "https://github.com/bibliosansfrontieres/ideascube-deploy/blob/master/roles/setup_system/tasks/logs.yml"
        end
        
        subgraph Network
            VPN[Tinc VPN]:::network
            click VPN "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/roles/tinc/"
            Firewall[Firewall Rules]:::security
        end
    end
    
    subgraph Container_Management
        BalenaEngine[Balena Engine]:::container
        click BalenaEngine "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/roles/balena-engine/"
        ContainerMgmt[Container Management]:::container
        click ContainerMgmt "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/roles/containers/"
    end
    
    subgraph Applications
        Traefik[Traefik Proxy]:::proxy
        click Traefik "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/docker_images/traefik/"
        
        subgraph Educational_Apps
            Ideascube[Ideascube]:::app
            click Ideascube "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/docker_images/ideascube/"
            Kiwix[Kiwix]:::app
            click Kiwix "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/docker_images/kiwix/"
            Kolibri[Kolibri]:::app
            click Kolibri "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/docker_images/kolibri/"
        end
    end
    
    subgraph Configuration_Management
        DevConfig[Device Configuration]:::config
        click DevConfig "https://github.com/bibliosansfrontieres/ideascube-deploy/blob/master/device.json"
        ContentMgmt[Content Management]:::content
        click ContentMgmt "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/roles/content_management/"
        UpdateSystem[Update System]:::update
        click UpdateSystem "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/roles/update_device_config/"
        Cleanup[System Cleanup]:::maintenance
        click Cleanup "https://github.com/bibliosansfrontieres/ideascube-deploy/tree/master/roles/cleanup/"
    end
    
    %% Relationships
    SysInit --> SysCfg
    SysCfg --> Storage
    SysCfg --> SSH
    SysCfg --> Logs
    
    CMAL --> BalenaEngine
    BalenaEngine --> ContainerMgmt
    ContainerMgmt --> Traefik
    
    Traefik --> Ideascube
    Traefik --> Kiwix
    Traefik --> Kolibri
    
    VPN --> CMAL
    Firewall --> CMAL
    
    DevConfig --> UpdateSystem
    UpdateSystem --> ContainerMgmt
    ContentMgmt --> Educational_Apps
    
    %% Styling
    classDef system fill:#f9f,stroke:#333
    classDef container fill:#0cf,stroke:#333
    classDef network fill:#9f9,stroke:#333
    classDef security fill:#f66,stroke:#333
    classDef storage fill:#ff9,stroke:#333
    classDef proxy fill:#9cf,stroke:#333
    classDef app fill:#99f,stroke:#333
    classDef config fill:#f90,stroke:#333
    classDef content fill:#fc9,stroke:#333
    classDef update fill:#c9f,stroke:#333
    classDef maintenance fill:#ccc,stroke:#333
    classDef init fill:#ff9,stroke:#333
```
