# micoli/gocker architecture

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

- Interactive diagram: https://gitdiagram.com/micoli/gocker
- Repository: https://github.com/micoli/gocker

## Overview

##### Main Components Identification
The system can be broken down into these primary components:

a. Core Application Layer
- Main application entry point (gocker/__main__.py)
- Arguments handling (gocker/arguments.py)
- Process management (gocker/process.py)
- Threading utilities (gocker/threads.py)

b. GUI Layer
- Application UI (gocker/gui/app.py)
- Event bus system (gocker/gui/bus.py)
- Command handling (gocker/gui/commands.py)
- Action management (gocker/gui/actions.py)

c. Services Layer
- Docker Container Services
- File System Event Services
- Log Collector Services
- Subprocess Management Services

d. UI Components
- Container inspection
- Log viewing
- Container list
- Event list
- Services tree
- Shortcuts help

**[User Interface Layer]**

- GUI Components
- Container List
- Log Viewer
- Service Tree
- Container Inspector

- [Event Bus / Command Layer]
- Event Handler
- Command Processor
- Action Manager

- [Services Layer]
- Docker Services
- Container Management
- Metrics Collection
- Event Monitoring

- Log Services
- Docker Logs
- Filesystem Events

- Process Services
- Supervisor Integration
- PM2 Integration

- [Docker Socket]
- Host Docker Engine

##### Implementation Details to Note

- Use dependency injection patterns (shown in gui/dependency_injection.py)
- Data structures (circular_list.py, constrained_list.py)
- Relationship between services and their corresponding UI components

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph User["User Interface Layer"]
        GUI["Application UI"]:::ui
        click GUI "https://github.com/micoli/gocker/blob/master/gocker/gui/app.py"
        
        subgraph Components["GUI Components"]
            ContInsp["Container Inspector"]:::ui
            click ContInsp "https://github.com/micoli/gocker/blob/master/gocker/gui/components/container_inspect.py"
            LogView["Log Viewer"]:::ui
            click LogView "https://github.com/micoli/gocker/blob/master/gocker/gui/components/container_log_list.py"
            ContList["Container List"]:::ui
            click ContList "https://github.com/micoli/gocker/blob/master/gocker/gui/components/containers_list.py"
            EventList["Event List"]:::ui
            click EventList "https://github.com/micoli/gocker/blob/master/gocker/gui/components/event_list.py"
            ServTree["Services Tree"]:::ui
            click ServTree "https://github.com/micoli/gocker/blob/master/gocker/gui/components/services_tree.py"
            ShortHelp["Shortcuts Help"]:::ui
            click ShortHelp "https://github.com/micoli/gocker/blob/master/gocker/gui/components/shortcuts_help.py"
        end

        subgraph EventCommand["Event Bus / Command Layer"]
            EventBus["Event Bus"]:::event
            click EventBus "https://github.com/micoli/gocker/blob/master/gocker/gui/bus.py"
            CmdProc["Command Processor"]:::event
            click CmdProc "https://github.com/micoli/gocker/blob/master/gocker/gui/commands.py"
            ActMgr["Action Manager"]:::event
            click ActMgr "https://github.com/micoli/gocker/blob/master/gocker/gui/actions.py"
            Events["Event System"]:::event
            click Events "https://github.com/micoli/gocker/blob/master/gocker/gui/events.py"
        end
    end

    subgraph Core["Core Application Layer"]
        Main["Main Entry Point"]:::core
        click Main "https://github.com/micoli/gocker/blob/master/gocker/__main__.py"
        Args["Arguments Handler"]:::core
        click Args "https://github.com/micoli/gocker/blob/master/gocker/arguments.py"
        ProcMgr["Process Manager"]:::core
        click ProcMgr "https://github.com/micoli/gocker/blob/master/gocker/process.py"
        ThreadUtil["Threading Utilities"]:::core
        click ThreadUtil "https://github.com/micoli/gocker/blob/master/gocker/threads.py"
    end

    subgraph Services["Services Layer"]
        subgraph DockerSvc["Docker Services"]
            ContSvc["Container Management"]:::service
            click ContSvc "https://github.com/micoli/gocker/blob/master/gocker/gui/services/docker_container/docker_containers_service.py"
            MetricsSvc["Metrics Collection"]:::service
            click MetricsSvc "https://github.com/micoli/gocker/blob/master/gocker/gui/services/docker_container/docker_containers_metrics.py"
            EventSvc["Event Monitoring"]:::service
            click EventSvc "https://github.com/micoli/gocker/blob/master/gocker/gui/services/docker_container/docker_events.py"
        end

        subgraph LogSvc["Log Services"]
            DockerLogs["Docker Logs"]:::service
            click DockerLogs "https://github.com/micoli/gocker/blob/master/gocker/gui/services/docker_container/docker_logs_collector_service.py"
            FSEvents["Filesystem Events"]:::service
            click FSEvents "https://github.com/micoli/gocker/blob/master/gocker/gui/services/fs_event/fs_events.py"
            LogCollector["Log Collector"]:::service
            click LogCollector "https://github.com/micoli/gocker/blob/master/gocker/gui/services/log_collector.py"
        end

        subgraph ProcSvc["Process Services"]
            SubProc["Subprocess Management"]:::service
            click SubProc "https://github.com/micoli/gocker/blob/master/gocker/gui/services/subprocesse/subprocess_logs_collector_service.py"
            Supervisor["Supervisor Integration"]:::service
            click Supervisor "https://github.com/micoli/gocker/blob/master/gocker/gui/services/subprocesse/supervisord.py"
        end
    end

    Docker[("Docker Socket")]:::external
    DI["Dependency Injection"]:::core
    click DI "https://github.com/micoli/gocker/blob/master/gocker/gui/dependency_injection.py"

    %% Relationships
    Main --> GUI
    GUI --> Components
    Components --> EventCommand
    EventCommand --> Services
    Services --> Docker
    DI --> Services
    DI --> EventCommand

    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef event fill:#f1c40f,stroke:#f39c12,color:black
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef core fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef external fill:#34495e,stroke:#2c3e50,color:white

    %% Legend
    subgraph Legend
        UI["UI Component"]:::ui
        EV["Event System"]:::event
        SV["Service"]:::service
        CR["Core Component"]:::core
        EX["External System"]:::external
    end
```
