# mike99mac/zlma architecture

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

- Interactive diagram: https://gitdiagram.com/mike99mac/zlma
- Repository: https://github.com/mike99mac/zlma

## Overview

##### Project Type and Purpose
- The project is a specialized administration platform that integrates a web interface, RESTful API, and numerous command-line utilities. Its main goal is to modernize z/VM administration by replacing legacy interfaces (like 3270 green screens) with modern, browser-based interfaces and command-line operations.
- It is built to manage Linux servers on z/VM, with components for both read-only display (e.g., dashboards, server status) and restricted write operations (e.g., issuing commands, updating configurations).

##### File Structure Analysis
- Top-level files such as LICENSE, README.md, and RELEASE-NOTES.md indicate that this is a mature, documented project.
- The “srv” directory holds the web-facing elements:
- srv/www/zlma contains the web UI pages and scripts (e.g., home.py, finder.py, restapi.py) that deliver the read-only interface and REST endpoints.
- srv/www/zlmarw houses web scripts for read-write capabilities, including console command interfaces, VIF (Virtual Image Facility) operations, and command modules (e.g., vifcmd.py, vifdisk*.py).
- The “usr/local/sbin” directory contains several command-line tools and utilities (zlma, vif, cpcommand, etc.) that perform heavy lifting for DB updates, command dispatch, and interfacing with external systems.
- Additional configuration and initialization files (e.g., zlma.conf, instzlma, zlmainfo) indicate that the system centralizes its settings and installation procedures.
- Supplementary files like the Apache configuration examples and installation scripts further define the deployment architecture.

##### Insights from the README
- The README offers a clear overview of key components: a relational database for configuration management data, multiple Linux command-line tools (zlma, vif, console-related commands), a RESTful API, and web interfaces for administration.
- It explains the architectural goals (modern, centralized, simple, well-architected, and secure) and details the responsibilities assigned to the Web UI (presentation), command-line interfaces (processing and backend operations), and REST API (cross-LPAR communication).
- The document describes how SSH is used for remote command execution and how the system’s security is handled via limited privileges and audit-trail logging.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        UI_RO["Web UI (Read-Only)"]:::web
        UI_RW["Web UI (Write-Protected)"]:::web
        REST_RO["REST API (Read-Only)"]:::api
        REST_RW["REST API (Read-Write)"]:::api
    end

    subgraph "Application/Business Logic"
        CLI["CLI Tools & Command-Line Utilities"]:::cli
        VIF["VIF Module & Operations"]:::cli
    end

    subgraph "Data Access Layer"
        DB["Database (MariaDB)"]:::db
    end

    subgraph "Configuration & Deployment"
        CONFIG["Configuration File (zlma.conf)"]:::config
        INST["Installer Script (instzlma)"]:::config
    end

    subgraph "External Systems"
        EXT["External z/VM Linux Hosts (via SSH)"]:::external
    end

    UI_RO -->|"calls"| REST_RO
    UI_RW -->|"calls"| REST_RW

    REST_RO -->|"queries"| DB
    REST_RW -->|"updates"| DB

    CLI -->|"CRUD"| DB
    VIF -->|"CRUD"| DB

    CLI -->|"SSH"| EXT
    VIF -->|"SSH"| EXT

    CONFIG -.->|"configures"| CLI
    CONFIG -.->|"configures"| DB
    INST -.->|"deploys"| CLI
    INST -.->|"deploys"| CONFIG

    %% Click Events
    click UI_RO "https://github.com/mike99mac/zlma/tree/main/srv/www/zlma"
    click UI_RW "https://github.com/mike99mac/zlma/tree/main/srv/www/zlmarw"
    click REST_RO "https://github.com/mike99mac/zlma/blob/main/srv/www/zlma/restapi.py"
    click REST_RW "https://github.com/mike99mac/zlma/blob/main/srv/www/zlmarw/restapirw.py"
    click CLI "https://github.com/mike99mac/zlma/tree/main/usr/local/sbin"
    click VIF "https://github.com/mike99mac/zlma/tree/main/srv/www/zlmarw"
    click CONFIG "https://github.com/mike99mac/zlma/blob/main/zlma.conf"
    click INST "https://github.com/mike99mac/zlma/tree/main/instzlma"

    %% Styles
    classDef web fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef api fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef cli fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef db fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef config fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef external fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
