Infrastructure
==============

Réseau LAN — 192.168.0.0/24
-----------------------------

.. code-block:: text

    ┌───────────────────────────────────────────────────────────────┐
    │                    LAN 192.168.0.0/24                         │
    │                                                                │
    │  .82  CORE       Gitea + Grafana + InfluxDB + Caddy            │
    │                  Reverse-proxy → cosma-vm pour /cosma-qc       │
    │                                                                │
    │  .83  cosma-vm   Dispatcher cosma-qc (systemd)                 │
    │                  Dashboard FastAPI :3849                        │
    │                  OpenVPN server :1194 UDP                       │
    │                                                                │
    │  .84  ml-stack   GPU worker  RTX 3090 24GB                     │
    │  .87  gpu        GPU worker  RTX 3060 12GB                     │
    │                                                                │
    │  .168 z620       Proxmox host HP Z620 — SSD MP4 bruts          │
    │  .101 poxML      Proxmox hyperviseur — héberge cosma-vm (VM 202)│
    └───────────────────────────────────────────────────────────────┘


Nœud cosma-vm (.83) — serveur principal cosma-qc
--------------------------------------------------

VM #202 sur Proxmox poxML (.101). 4 vCPU, 4 GB RAM, 40 GB SSD.
User : ``cosma`` (avec docker group et sudo).

Services :

- **Dispatcher** — ``cosma-qc-dispatcher.service`` (systemd)
  Lance les extractions ffmpeg sur les workers GPU.

- **Dashboard FastAPI** — conteneur Docker ``cosma-qc-app``, port **3849**.
  Accès via Caddy sur core : ``http://192.168.0.82/cosma-qc``

- **OpenVPN** — ``openvpn-server@cosma.service``, port 1194 UDP.
  Permet aux collègues daccéder au LAN depuis lextérieur.

Commandes utiles :

.. code-block:: bash

    # SSH vers cosma-vm
    ssh cosma@192.168.0.83

    # Statut dispatcher
    sudo systemctl status cosma-qc-dispatcher

    # Logs dispatcher
    tail -f /home/cosma/cosma-qc-data/dispatcher.log

    # Dashboard local
    http://192.168.0.83:3849


Nœud core (.82)
----------------

**Rôle :** routeur et services communs.

Services actifs :

- **Caddy** — reverse proxy HTTPS, route ``/cosma-qc`` vers .83:3849.
- **Gitea** — dépôt source ``floppyrj45/cosma-qc``.
- **Grafana / InfluxDB** — monitoring infrastructure.


Nœuds GPU workers (.84 et .87)
--------------------------------

.. list-table::
   :header-rows: 1
   :widths: 15 25 20 40

   * - IP
     - Nom SSH
     - GPU
     - VRAM
   * - .84
     - ml-stack
     - RTX 3090
     - 24 GB
   * - .87
     - gpu
     - RTX 3060
     - 12 GB

**Rôle :** exécution de ffmpeg et lingbot-map.

.. code-block:: text

    /cosma-qc-frames/
    └── job_N/
        ├── frame_NNNNNN.jpg
        ├── .video_V.done
        ├── reconstruction.ply
        └── reconstruction.glb


Nœud z620 (.168) — stockage MP4
----------------------------------

HP Z620 (Proxmox). SSD /mnt/portablessd avec les MP4 GoPro bruts.
Les MP4 **ne quittent jamais** z620 — ffmpeg sy exécute via SSH-relay.

SSH relay (depuis cosma-vm ou core) :

.. code-block:: bash

    ssh ml-stack "ssh z620 \\"commande\\""


OpenVPN — accès collègues
--------------------------

Serveur OpenVPN sur cosma-vm (.83:1194 UDP).
Adresse externe : ``laboratoire.freeboxos.fr:1194``

Profil client : ``cosma-qc-collegue1.ovpn`` (Nextcloud sync).

Génération dun nouveau client :

.. code-block:: bash

    cd /home/cosma/openvpn-ca/easyrsa3
    ./easyrsa gen-req NOMCLIENT nopass
    ./easyrsa sign-req client NOMCLIENT


Ports réseau récapitulatifs
----------------------------

.. list-table::
   :header-rows: 1
   :widths: 15 15 70

   * - Host
     - Port
     - Service
   * - .83
     - 3849
     - Dashboard FastAPI cosma-qc
   * - .83
     - 1194/udp
     - OpenVPN server
   * - .84 / .87
     - 8100+N
     - Viser viewer (job N)
   * - .84 / .87
     - 8300
     - HTTP server GLB/PLY export

