# arelius-d/nexdocman architecture

> Architecture diagram of the GitHub repository arelius-d/nexdocman, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arelius-d/nexdocman
- Repository: https://github.com/arelius-d/nexdocman

## Overview

#### Purpose and Entry Points
NeXdocMan is a Debian-oriented Bash utility that deploys, installs, manages, audits, updates, and removes Docker/Docker Compose environments. Its only visible implementation entry point is `nexdocman.sh`; the distributed release payload is `NeXdocMan.tar.gz`. Users invoke the script initially with `--deploy`, then use the globally installed `nexdocman` command interactively or through flags.

Paths: `nexdocman.sh`, `NeXdocMan.tar.gz`

#### Deployment and Persistent Footprint
The deploy stage initializes runtime directories, generates configuration, installs a persistent executable under `/usr/local/bin/nexdocman`, and removes the temporary downloaded payload. Runtime state is intentionally host-local rather than repository-managed: configuration is under `/usr/local/lib/nexdocman/`; logs are under `/var/log/NeXdocMan/`; schedules are written to the user/system crontab.

Paths: `nexdocman.sh`, `README.md`

#### Docker Installation Boundary
Installation is a privileged host-management flow: it detects Debian package conditions, removes conflicting legacy packages, installs Docker Engine and Compose using Docker’s official installation route, adds the active user to the `docker` group, and validates daemon operation with `hello-world`. It depends on OS package tooling, system services, Docker’s repository/install script, and either `curl` or `wget`.

Paths: `nexdocman.sh`, `README.md`

#### Interactive and Non-Interactive Control Plane
The script exposes an interactive terminal menu plus command flags for install, status, Docker/Compose maintenance, image checking/updating, cleanup, cron configuration, utility update, removal, and destructive purge. `--yes` supports unattended execution; verbosity controls terminal output. This is a CLI orchestration tool, not a daemon or web service.

Paths: `nexdocman.sh`, `README.md`

#### Image Update and Hot-Swap Flow
The update pipeline inspects local/running containers and their image references, checks/pulls updated images, and selectively recreates affected workloads. Compose-managed services use Compose recreation (`up -d --no-deps`); standalone containers are recreated through Docker-native operations. Configurable exclusions prevent matching container names, images, or glob patterns from being pulled or restarted. The key boundary is that NeXdocMan drives Docker/Compose but does not own application definitions or volumes.

Paths: `nexdocman.sh`, `README.md`

#### Scheduled Maintenance and Logging
Configuration controls independent cron schedules for deep Docker pruning and image updates. Cron launches the installed CLI, which runs briefly and exits, avoiding a persistent update daemon. Cleanup executes Docker system prune including volumes; operational and cron output are retained in separate log files, with optional age-based log pruning. Applying configuration is explicit through `--configure-cron`.

Paths: `nexdocman.sh`, `README.md`

#### Lifecycle, Self-Update, and Destructive Operations
Self-update polls GitHub’s API/releases and redeploys the global utility when a newer version exists. Removal deletes NeXdocMan binaries, configuration, logs, and cron entries while preserving Docker. Purge is a separate destructive boundary: it removes Docker/Compose and Docker/containerd data, including `/var/lib/docker`, `/var/lib/containerd`, and user Docker state.

Paths: `nexdocman.sh`, `README.md`

Main entry points: [`nexdocman.sh`](https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh) (Menu and flags), [`NeXdocMan.tar.gz`](https://github.com/arelius-d/nexdocman/blob/main/NeXdocMan.tar.gz) (Release payload)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI control plane"]
  node_script["NeXdocMan script<br/>Bash CLI<br/>[nexdocman.sh]"]
  node_deploy["Deploy bootstrap<br/>installer flow<br/>[nexdocman.sh]"]
  node_installed_cli["Global nexdocman<br/>installed executable"]
  node_config["Host configuration<br/>local state"]
  node_menu_flags["Menu and flags<br/>command interface<br/>[nexdocman.sh]"]
end

subgraph group_docker["Docker management"]
  node_docker_install["Docker install flow<br/>privileged installer<br/>[nexdocman.sh]"]
  node_host_tools{{"Debian host tooling<br/>OS boundary"}}
  node_docker_runtime{{"Docker runtime<br/>container platform"}}
  node_image_update["Image hot-swap<br/>update pipeline<br/>[nexdocman.sh]"]
  node_workloads["Application workloads<br/>external definitions"]
end

subgraph group_maintenance["Scheduled maintenance"]
  node_cron["Cron schedules<br/>scheduler configuration"]
  node_cleanup_logging["Cleanup and logs<br/>maintenance flow<br/>[nexdocman.sh]"]
end

subgraph group_lifecycle["Lifecycle boundaries"]
  node_release["Release payload<br/>archive<br/>[NeXdocMan.tar.gz]"]
  node_self_update["Self-update<br/>release updater<br/>[nexdocman.sh]"]
  node_github{{"GitHub releases API<br/>external release source"}}
  node_remove["Remove and purge<br/>destructive lifecycle<br/>[nexdocman.sh]"]
end

node_release -->|"initial --deploy"| node_deploy
node_script -->|"implements"| node_deploy
node_deploy -->|"installs"| node_installed_cli
node_deploy -->|"generates"| node_config
node_installed_cli -->|"invokes"| node_menu_flags
node_menu_flags -->|"install commands"| node_docker_install
node_docker_install -->|"uses"| node_host_tools
node_docker_install -->|"installs and validates"| node_docker_runtime
node_menu_flags -->|"update commands"| node_image_update
node_config -.->|"exclusions"| node_image_update
node_image_update -->|"inspects, pulls, recreates"| node_docker_runtime
node_image_update -->|"Compose or native recreation"| node_workloads
node_menu_flags -->|"--configure-cron"| node_cron
node_cron -->|"brief scheduled runs"| node_installed_cli
node_installed_cli -->|"cleanup execution"| node_cleanup_logging
node_cleanup_logging -->|"system prune --volumes"| node_docker_runtime
node_config -.->|"schedule settings"| node_cron
node_menu_flags -->|"update command"| node_self_update
node_self_update -->|"checks releases"| node_github
node_self_update -->|"redeploys"| node_deploy
node_menu_flags -->|"remove or purge"| node_remove
node_remove -->|"removes utility"| node_installed_cli
node_remove -.->|"purge only"| node_docker_runtime

click node_release "https://github.com/arelius-d/nexdocman/blob/main/NeXdocMan.tar.gz"
click node_script "https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh"
click node_deploy "https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh"
click node_menu_flags "https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh"
click node_docker_install "https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh"
click node_image_update "https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh"
click node_cleanup_logging "https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh"
click node_self_update "https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh"
click node_remove "https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_script,node_deploy,node_installed_cli,node_config,node_menu_flags toneBlue
class node_docker_install,node_host_tools,node_docker_runtime,node_image_update,node_workloads toneAmber
class node_cron,node_cleanup_logging toneMint
class node_release,node_self_update,node_github,node_remove toneRose
```

## Components

### CLI control plane

- [NeXdocMan script](https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh): Bash CLI · Single implementation entry point. · `nexdocman.sh`
- [Deploy bootstrap](https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh): installer flow · Initializes host-local installation. · `nexdocman.sh`
- **Global nexdocman**: installed executable · Persistent command at /usr/local/bin/nexdocman.
- **Host configuration**: local state · Configuration under /usr/local/lib/nexdocman/.
- [Menu and flags](https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh): command interface · Interactive menu and unattended flags including --yes. · `nexdocman.sh`

### Docker management

- [Docker install flow](https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh): privileged installer · Replaces legacy packages and installs Engine and Compose. · `nexdocman.sh`
- **Debian host tooling**: OS boundary · Package tools, services, curl/wget, and Docker install route.
- **Docker runtime**: container platform · Daemon, images, containers, volumes, and Docker group.
- [Image hot-swap](https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh): update pipeline · Pulls eligible images and selectively recreates workloads. · `nexdocman.sh`
- **Application workloads**: external definitions · Compose projects and standalone containers remain user-owned.

### Scheduled maintenance

- **Cron schedules**: scheduler configuration · Independent cleanup and image-update schedules.
- [Cleanup and logs](https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh): maintenance flow · Prunes Docker including volumes and retains operational/cron logs. · `nexdocman.sh`

### Lifecycle boundaries

- [Release payload](https://github.com/arelius-d/nexdocman/blob/main/NeXdocMan.tar.gz): archive · Distributed deployment archive. · `NeXdocMan.tar.gz`
- [Self-update](https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh): release updater · Checks GitHub releases and redeploys newer utility versions. · `nexdocman.sh`
- **GitHub releases API**: external release source
- [Remove and purge](https://github.com/arelius-d/nexdocman/blob/main/nexdocman.sh): destructive lifecycle · Removal preserves Docker; purge removes Docker and its data. · `nexdocman.sh`

## Connections

- Release payload → Deploy bootstrap: initial --deploy
- NeXdocMan script → Deploy bootstrap: implements
- Deploy bootstrap → Global nexdocman: installs
- Deploy bootstrap → Host configuration: generates
- Global nexdocman → Menu and flags: invokes
- Menu and flags → Docker install flow: install commands
- Docker install flow → Debian host tooling: uses
- Docker install flow → Docker runtime: installs and validates
- Menu and flags → Image hot-swap: update commands
- Host configuration → Image hot-swap: exclusions
- Image hot-swap → Docker runtime: inspects, pulls, recreates
- Image hot-swap → Application workloads: Compose or native recreation
- Menu and flags → Cron schedules: --configure-cron
- Cron schedules → Global nexdocman: brief scheduled runs
- Global nexdocman → Cleanup and logs: cleanup execution
- Cleanup and logs → Docker runtime: system prune --volumes
- Host configuration → Cron schedules: schedule settings
- Menu and flags → Self-update: update command
- Self-update → GitHub releases API: checks releases
- Self-update → Deploy bootstrap: redeploys
- Menu and flags → Remove and purge: remove or purge
- Remove and purge → Global nexdocman: removes utility
- Remove and purge → Docker runtime: purge only · Deletes Docker, containerd, and data.
