# duongcmd/vps-n8n architecture

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

- Interactive diagram: https://gitdiagram.com/duongcmd/vps-n8n
- Repository: https://github.com/duongcmd/vps-n8n

## Overview

##### Project type and purpose
- This is not a full-stack app or a microservice suite. It’s a DevOps/documentation project that shows how to install and run Windows 10 inside a Docker container on a Linux (Ubuntu/Debian) host.
- The README walks the user through prerequisites, package installation, Docker Compose configuration, and how to troubleshoot common errors.

##### “file structure”
- There is only one top-level file (`README.md`). All of the logic lives in that document and in the referenced `windows10.yml` Compose file.
- No source code directories or build scripts; the key pieces are the host OS, Docker engine, virtualization (KVM), the container image, and the user-supplied Compose file.

##### README for architectural clues
- The central component is a Docker service (“windows”) defined by `dockurr/windows` image.
- Host dependencies: KVM device, network tunnel, named volumes or bind-mounts.
- Exposed ports (RDP/TCP, RDP/UDP, web UI on 8006).
- External service: Docker image registry (Docker Hub).

a. Main components
- Host OS (Ubuntu/Debian)
- Docker daemon & Docker Compose
- Virtualization layer (KVM/QEMU via `/dev/kvm`)
- Container instance (Windows 10)
- Docker image registry (external)
- Devices and resources: CPU cores, RAM, disk volumes
- Network interfaces (`/dev/net/tun`, port mappings)
b. Relationships / interactions
- User runs `docker-compose -f windows10.yml up` → Docker client → Docker daemon
- Docker daemon pulls `dockurr/windows` from Docker Hub
- Docker daemon hands image to KVM/QEMU to spin up a VM-inside-container
- Container sees allocated RAM, CPU, block storage (volumes or disks)
- Network packets flow through host’s kernel → tun device → container → mapped ports
c. Key architectural patterns
- Container-within-VM pattern: using KVM inside a Docker container
- Infrastructure as code: Compose file declaratively describes the service
- Resource isolation: cgroup limits for RAM, CPU, device mapping
d. Relevant technologies
- Docker engine & Docker Compose v3.8
- KVM virtualization (host’s `/dev/kvm`)
- QEMU (under the covers inside `dockurr/windows`)
- Linux network tunneling (/dev/net/tun)
- Host kernel modules for virtualization and networking

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External services
    DockerHub["Docker Hub\n(Image Registry)"]:::external

    %% User interaction
    User["User"]:::user
    Doc["Documentation & Setup Guide"]:::doc
    Compose["Docker Compose File\nwindows10.yml"]:::doc

    %% Host OS layer
    subgraph "Host OS (Ubuntu/Debian)" 
        direction TB
        CLI["Docker CLI"]:::host
        Daemon["Docker Daemon"]:::host
        Kernel["Host Kernel\n(cgroups, namespaces)"]:::host
        Devices["Devices & Modules\n/dev/kvm, /dev/net/tun"]:::host
        Volumes["Storage Volumes\n(RAM, CPU, Disk)"]:::storage
    end

    %% Container layer
    subgraph "Container Boundary" 
        direction TB
        Container["Container\n(dockurr/windows)"]:::container
        VM["Windows 10 VM\n(QEMU)"]:::container
        Network["Port Mappings\n3389 TCP/UDP, 8006"]:::container
    end

    %% Interactions
    User --> Doc
    User --> Compose
    Doc --> Compose
    User --> CLI
    Compose --> CLI
    CLI -->|"docker-compose up"| Daemon
    Daemon -->|"docker pull"| DockerHub
    Daemon -->|"API & cgroups"| Kernel
    Daemon -->|"attach"| Devices
    Daemon -->|"mounts"| Volumes
    Daemon -->|"create container"| Container
    Devices -->|"device mapping"| Container
    Volumes -->|"volume mount"| Container
    Kernel -->|"network namespace"| Container
    Container -->|"launch VM"| VM
    Container --> Network

    %% Click events
    click Doc "https://github.com/duongcmd/vps-n8n/blob/main/README.md"
    click Compose "https://github.com/duongcmd/vps-n8n/blob/main/windows10.yml"

    %% Styling
    classDef external fill:#cccccc,stroke:#333,stroke-width:1px;
    classDef user fill:#ffd966,stroke:#333,stroke-width:1px;
    classDef doc fill:#fff2cc,stroke:#333,stroke-width:1px;
    classDef host fill:#cfe2f3,stroke:#333,stroke-width:1px;
    classDef container fill:#d9ead3,stroke:#333,stroke-width:1px;
    classDef storage fill:#e6b8af,stroke:#333,stroke-width:1px;
```
