# osc/ondemand architecture

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

- Interactive diagram: https://gitdiagram.com/osc/ondemand
- Repository: https://github.com/osc/ondemand

## Overview

- Client/browser: Represent end users accessing the portal via a web browser.
- Reverse proxy & load balancing: Nodes such as “mod_ood_proxy” and “nginx_stage” are key components for routing user requests and enforcing security.
- Web Portal / Dashboard: The “apps/dashboard” directory (a Ruby on Rails application) is the heart of the portal. This component handles authentication, session management, and aggregates data from various sub-applications.
- Backend HPC integration: Although not directly a subfolder, the system integrates with HPC batch systems and resource managers (e.g., Slurm and others) as noted in the README and configuration examples. Represent these external services, showing connections from the dashboard or specific apps (like “batch_connect”) that manage job submission and monitoring.
- Container/Docker and Packaging: With Dockerfiles (and separate demo and development Docker configurations) and packaging directories (packaging/deb and packaging/rpm), indicate that containerized deployments and package management play a role in deployment and scalability.

##### Relationships and data flows
- How the web portal communicates with external HPC schedulers/resource managers, file systems, or even batch systems (the data flow here is typically bi-directional).
- Inter-module interactions where applicable; for example, when support ticket services interface with external systems, or when user authentication is forwarded through reverse proxies.

##### Architectural patterns and design principles
- Modular / Micro Frontend Architecture: The separation of functionality into distinct directories (each with its own manifest files, controllers, views, and assets) implies a modular design. Indicate these modules as loosely coupled yet integrated via the central dashboard.
- Containerization and automation: Emphasize that the project can be deployed via containers (Docker) and is integrated with CI pipelines (GitHub workflows, GitLab CI, etc.). This suggests automated deployment and testing pipelines, which could be abstracted as a “DevOps / CI/CD” component.
- Extensibility and configuration-based integration: The presence of manifest.yml files and dynamic templates (ERB files, etc.) indicates that adding a new application module involves configuration and templating. This is key to the project’s flexibility.

##### Relevant technologies and frameworks
- Ruby on Rails (part of “apps/dashboard” and other Ruby-based apps),
- JavaScript (as seen in various app/javascript directories),
- Docker and container orchestration,
- CI/CD (GitHub workflows, GitLab pipelines),
- Nginx (through “nginx_stage” and reverse proxy modules),
- Gem dependencies (Gemfile, Gemfile.lock indicate Ruby gems) and Rake tasks to manage automation and testing.

##### Details with clarity
- That each node (application or service component) is clearly labeled.

This approach will not only visually represent the intricate file structure and multi-component interaction but also emphasize the key technologies and architectural design choices that make Open OnDemand a robust, scalable HPC portal.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Client["Client/Browser"]:::client
    end

    %% Reverse Proxy & Load Balancing
    subgraph "Reverse Proxy & Load Balancing"
        modProxy["mod_ood_proxy"]:::proxy
        nginx["nginx_stage"]:::proxy
    end

    %% Application Layer
    subgraph "Application Layer"
        Dashboard["Dashboard (Rails Application)"]:::dashboard
        subgraph "Applications"
            ActiveJobs["Active Jobs"]:::apps
            Desktop["Desktop Applications"]:::apps
            FileEditor["File Editor"]:::apps
            Files["Files Management"]:::apps
            MyJobs["MyJobs"]:::apps
            Projects["Projects"]:::apps
            Shell["Shell"]:::apps
            SystemStatus["System Status"]:::apps
        end
    end

    %% Integration Layer
    subgraph "Integration Layer"
        HPC["HPC Batch Integration"]:::hpc
        Config["Configuration/Plugins"]:::config
    end

    %% Deployment Layer
    subgraph "Deployment"
        DF["Dockerfile"]:::docker
        DFDemo["Dockerfile.demo"]:::docker
        DFDev["Dockerfile.dev"]:::docker
        Packaging_deb["Packaging (deb)"]:::docker
        Packaging_rpm["Packaging (rpm)"]:::docker
    end

    %% Connections
    Client --> modProxy
    modProxy --> nginx
    nginx --> Dashboard
    Dashboard --> ActiveJobs
    Dashboard --> Desktop
    Dashboard --> FileEditor
    Dashboard --> Files
    Dashboard --> MyJobs
    Dashboard --> Projects
    Dashboard --> Shell
    Dashboard --> SystemStatus
    Dashboard <--> HPC
    Config --> Dashboard
    DF --> Dashboard
    DFDemo --> Dashboard
    DFDev --> Dashboard
    Packaging_deb --> Dashboard
    Packaging_rpm --> Dashboard

    %% Styles
    classDef client fill:#F9C,stroke:#333,stroke-width:2px;
    classDef proxy fill:#CCF,stroke:#333,stroke-width:2px;
    classDef dashboard fill:#CFC,stroke:#333,stroke-width:2px;
    classDef apps fill:#FC9,stroke:#333,stroke-width:2px;
    classDef hpc fill:#CFF,stroke:#333,stroke-width:2px;
    classDef config fill:#FFC,stroke:#333,stroke-width:2px;
    classDef docker fill:#DDD,stroke:#333,stroke-width:2px;

    %% Click Events
    click modProxy "https://github.com/osc/ondemand/tree/master/mod_ood_proxy/"
    click nginx "https://github.com/osc/ondemand/tree/master/nginx_stage/"
    click Dashboard "https://github.com/osc/ondemand/tree/master/apps/dashboard/"
    click ActiveJobs "https://github.com/osc/ondemand/tree/master/apps/activejobs/"
    click Desktop "https://github.com/osc/ondemand/tree/master/apps/bc_desktop/"
    click FileEditor "https://github.com/osc/ondemand/tree/master/apps/file-editor/"
    click Files "https://github.com/osc/ondemand/tree/master/apps/files/"
    click MyJobs "https://github.com/osc/ondemand/tree/master/apps/myjobs/"
    click Projects "https://github.com/osc/ondemand/tree/master/apps/projects/"
    click Shell "https://github.com/osc/ondemand/tree/master/apps/shell/"
    click SystemStatus "https://github.com/osc/ondemand/tree/master/apps/system-status/"
    click HPC "https://github.com/osc/ondemand/tree/master/apps/dashboard/app/controllers/batch_connect/"
    click Config "https://github.com/osc/ondemand/tree/master/ood-portal-generator/"
    click DF "https://github.com/osc/ondemand/tree/master/Dockerfile"
    click DFDemo "https://github.com/osc/ondemand/blob/master/Dockerfile.demo"
    click DFDev "https://github.com/osc/ondemand/blob/master/Dockerfile.dev"
    click Packaging_deb "https://github.com/osc/ondemand/tree/master/packaging/deb/"
    click Packaging_rpm "https://github.com/osc/ondemand/tree/master/packaging/rpm/"
```
