# llnut/dnf architecture

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

- Interactive diagram: https://gitdiagram.com/llnut/dnf
- Repository: https://github.com/llnut/dnf

## Overview

This repository packages a DNF game server as container images, with single-container and separated-database deployment options. The main workflow is an operator starting a configured deployment, container initialization preparing its services, and a player using the login client to reach the game. The README also documents multi-channel and multi-region setups, Kubernetes deployment, scheduled maintenance, and database backup/restore. Runtime source excerpts were not provided, so service-level wiring beyond these documented relationships is not inferred.

Main entry points: [`deploy/dnf`](https://github.com/llnut/dnf/tree/main/deploy/dnf) (Container Deployment), [`build/dnf_data/etc/s6-overlay/s6-rc.d/scheduler`](https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/scheduler) (Scheduled Maintenance), [`deploy/dnf/docker-compose`](https://github.com/llnut/dnf/tree/main/deploy/dnf/docker-compose) (Compose Modes), [`deploy/dnf/k8s-deploy`](https://github.com/llnut/dnf/tree/main/deploy/dnf/k8s-deploy) (Kubernetes Mode)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_deploy["Deployment"]
  node_deployment["Container Deployment"]
  node_compose["Compose Modes"]
  node_kubernetes["Kubernetes Mode"]
end

subgraph group_runtime["Server Runtime"]
  node_init["Startup Initialization<br/>[init-data]"]
  node_env["Environment Resolution<br/>[env-resolve]"]
  node_game["Game Services<br/>[game_template]"]
  node_channels["Channel Services<br/>[channel]"]
  node_plugins["DP Plugins"]
end

subgraph group_data["Database Operations"]
  node_database[("MySQL Database<br/>[mysql]")]
  node_dbinit["Database Initialization<br/>[init-db]"]
  node_entrypoint["DB Entrypoint<br/>[db-entrypoint.sh]"]
  node_scheduled["Scheduled Maintenance<br/>[scheduler]"]
  node_backup["Backup and Restore"]
end

subgraph group_access["Player Access"]
  node_gateway["Login Gateway<br/>[llnut_gate]"]
end

node_operator(("Operator"))
node_client(("Game Client"))

node_operator -->|"starts"| node_deployment
node_deployment -->|"initializes"| node_init
node_deployment -->|"supports modes"| node_compose
node_deployment -->|"supports mode"| node_kubernetes
node_client -->|"logs in"| node_gateway
node_client -->|"plays through"| node_game
node_scheduled -->|"backs up"| node_database
node_scheduled -->|"runs backups"| node_backup
node_operator -->|"requests restore"| node_backup

click node_deployment "https://github.com/llnut/dnf/tree/main/deploy/dnf"
click node_compose "https://github.com/llnut/dnf/tree/main/deploy/dnf/docker-compose"
click node_kubernetes "https://github.com/llnut/dnf/tree/main/deploy/dnf/k8s-deploy"
click node_init "https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/init-data"
click node_env "https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/env-resolve"
click node_game "https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/game_template"
click node_channels "https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/channel"
click node_gateway "https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/llnut_gate"
click node_database "https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/mysql"
click node_dbinit "https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/init-db"
click node_entrypoint "https://github.com/llnut/dnf/blob/main/build/dnf_data/db-entrypoint.sh"
click node_scheduled "https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/scheduler"
click node_backup "https://github.com/llnut/dnf/tree/main/deploy/dnf"
click node_plugins "https://github.com/llnut/dnf/tree/main/plugin"

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_deployment,node_compose,node_kubernetes,node_client toneBlue
class node_init,node_env,node_game,node_channels,node_plugins toneAmber
class node_database,node_dbinit,node_entrypoint,node_scheduled,node_backup toneMint
class node_gateway toneRose
class node_operator toneIndigo
```

## Components

### Deployment

- [Container Deployment](https://github.com/llnut/dnf/tree/main/deploy/dnf): `deploy/dnf`
- [Compose Modes](https://github.com/llnut/dnf/tree/main/deploy/dnf/docker-compose): `deploy/dnf/docker-compose`
- [Kubernetes Mode](https://github.com/llnut/dnf/tree/main/deploy/dnf/k8s-deploy): `deploy/dnf/k8s-deploy`

### Server Runtime

- [Startup Initialization](https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/init-data): `build/dnf_data/etc/s6-overlay/s6-rc.d/init-data`
- [Environment Resolution](https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/env-resolve): `build/dnf_data/etc/s6-overlay/s6-rc.d/env-resolve`
- [Game Services](https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/game_template): `build/dnf_data/etc/s6-overlay/s6-rc.d/game_template`
- [Channel Services](https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/channel): `build/dnf_data/etc/s6-overlay/s6-rc.d/channel`
- [DP Plugins](https://github.com/llnut/dnf/tree/main/plugin): `plugin`

### Database Operations

- [MySQL Database](https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/mysql): `build/dnf_data/etc/s6-overlay/s6-rc.d/mysql`
- [Database Initialization](https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/init-db): `build/dnf_data/etc/s6-overlay/s6-rc.d/init-db`
- [DB Entrypoint](https://github.com/llnut/dnf/blob/main/build/dnf_data/db-entrypoint.sh): `build/dnf_data/db-entrypoint.sh`
- [Scheduled Maintenance](https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/scheduler): `build/dnf_data/etc/s6-overlay/s6-rc.d/scheduler`
- [Backup and Restore](https://github.com/llnut/dnf/tree/main/deploy/dnf): `deploy/dnf`

### Player Access

- [Login Gateway](https://github.com/llnut/dnf/tree/main/build/dnf_data/etc/s6-overlay/s6-rc.d/llnut_gate): `build/dnf_data/etc/s6-overlay/s6-rc.d/llnut_gate`

### Other components

- **Operator**
- **Game Client**

## Connections

- Operator → Container Deployment: starts (evidence: `README.md`)
- Container Deployment → Startup Initialization: initializes (evidence: `README.md`)
- Container Deployment → Compose Modes: supports modes (evidence: `README.md`)
- Container Deployment → Kubernetes Mode: supports mode (evidence: `README.md`)
- Game Client → Login Gateway: logs in (evidence: `README.md`)
- Game Client → Game Services: plays through (evidence: `README.md`)
- Scheduled Maintenance → MySQL Database: backs up (evidence: `README.md`)
- Scheduled Maintenance → Backup and Restore: runs backups (evidence: `README.md`)
- Operator → Backup and Restore: requests restore (evidence: `README.md`)
