# fargus3222/nn-docker architecture

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

- Interactive diagram: https://gitdiagram.com/fargus3222/nn-docker
- Repository: https://github.com/fargus3222/nn-docker

## Overview

##### Project type and purpose
- This is a Docker‑packaged crypto node (“Nexus Node”) intended to run a Nexus blockchain node inside a container.
- The README makes clear it’s not a full stack web app but a single‑service container image, with supporting scripts, CI/CD pipeline, and orchestration via docker-compose.

##### File structure
- Top‑level CI/CD:
- .github/workflows/deploy.job.yml – GitHub Actions build & publish
- Build and run scripts:
- Dockerfile – builds the Nexus Node image
- Makefile – developer shortcuts (build, test, push)
- install.sh / run.sh – convenience wrappers
- Runtime orchestration:
- docker-compose.yml – compose definition mounting host volume to container (~/.nexus/)
- Other:
- .gitignore, LICENSE files, CHANGELOG.md

##### README for insights
- Describes how to pull and run the image, and how to use docker‑compose.
- Mentions the external Nexus network (peer‑to‑peer blockchain).

##### Main components
a. Host infrastructure:
- Developer/CI server (GitHub Actions)
- Docker registry (Docker Hub)
- Production/edge host (on‑prem or cloud VM)
b. Build pipeline:
- Source repo → GitHub Actions → Docker Hub
c. Runtime components:
- Docker Engine on Host → runs Nexus Node container
- Mounted Host Volume (~/.nexus) for blockchain data persistence
- Nexus Node process inside container
d. External dependencies:
- Nexus P2P network (other nodes)

##### Relationships and interactions
- Developer pushes code → CI pipeline triggers Docker build → image is pushed to registry
- Host pulls image → Docker Engine instantiates container
- Container reads/writes data from host volume
- Nexus Node in container communicates over the internet with other P2P nodes

##### Architectural patterns and principles
- Single‑service container (microservice‑style)
- Immutable infrastructure: container image is the deployable artifact
- CI/CD pipeline ensures repeatable builds and versioning
- Data persistence via volume mount (separation of compute and storage)

##### Relevant technologies
- Docker, Docker Compose
- GitHub Actions
- Bash scripts (install.sh, run.sh)
- Makefile for local automation
- Nexus blockchain node software (inside image)

##### Detail
- Which scripts (run.sh, install.sh) interact at build or run time
- Call out the Makefile targets (build, push) if relevant to the CI stage

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Source Repository"
        Repo_Readme["README.md"]:::infra
        Repo_Changelog["CHANGELOG.md"]:::infra
        Repo_Gitignore[".gitignore"]:::infra
        Repo_LicenseA["LICENSE-APACHE"]:::infra
        Repo_LicenseM["LICENSE-MIT"]:::infra
        Dockerfile["Dockerfile"]:::infra
        Makefile["Makefile"]:::infra
        InstallScript["install.sh"]:::infra
        RunScript["run.sh"]:::infra
        ComposeFile["docker-compose.yml"]:::infra
        Workflow["GitHub Actions CI/CD"]:::infra
    end

    Workflow -->|"build image"| DockerHub["Docker Hub (Registry)"]:::infra
    DockerHub -->|"pull image"| Engine["Docker Engine (Host)"]:::infra
    RunScript -->|"start via compose"| Engine
    ComposeFile -->|"orchestrates"| Engine
    Engine -->|"runs"| Container["Nexus Node Container"]:::app
    Container -->|"mounts"| Volume["Host Volume (~/.nexus/)"]:::storage
    Container -->|"P2P comms"| External["Nexus P2P Network"]:::external

    Dockerfile -->|"used by"| Workflow
    Makefile -->|"scripts run by"| Workflow
    InstallScript -->|"setup for build"| Workflow

    classDef infra fill:#D6EAF8,stroke:#2980B9,color:#1B4F72
    classDef app fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef storage fill:#F2F3F4,stroke:#CACFD2,color:#616A6B
    classDef external fill:#E8F8F5,stroke:#48C9B0,color:#117A65

    click Workflow "https://github.com/fargus3222/nn-docker/blob/master/.github/workflows/deploy.job.yml"
    click Dockerfile "https://github.com/fargus3222/nn-docker/tree/master/Dockerfile"
    click Makefile "https://github.com/fargus3222/nn-docker/tree/master/Makefile"
    click InstallScript "https://github.com/fargus3222/nn-docker/blob/master/install.sh"
    click RunScript "https://github.com/fargus3222/nn-docker/blob/master/run.sh"
    click ComposeFile "https://github.com/fargus3222/nn-docker/blob/master/docker-compose.yml"
    click Repo_Readme "https://github.com/fargus3222/nn-docker/blob/master/README.md"
    click Repo_Changelog "https://github.com/fargus3222/nn-docker/blob/master/CHANGELOG.md"
    click Repo_Gitignore "https://github.com/fargus3222/nn-docker/blob/master/.gitignore"
    click Repo_LicenseA "https://github.com/fargus3222/nn-docker/tree/master/LICENSE-APACHE"
    click Repo_LicenseM "https://github.com/fargus3222/nn-docker/tree/master/LICENSE-MIT"
```
