# jsalvador-zsh/odoo-production-template architecture

> Architecture diagram of the GitHub repository jsalvador-zsh/odoo-production-template, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jsalvador-zsh/odoo-production-template
- Repository: https://github.com/jsalvador-zsh/odoo-production-template

## Overview

##### Project type and purpose
- This is a full-stack production deployment template for Odoo 18, orchestrated via Docker Compose, with an “infra as code” layout and a complete monitoring suite (Prometheus, Grafana, AlertManager, exporters).
- Purpose: deploy Odoo ERP in production securely (Nginx + SSL), backed by PostgreSQL and Redis, and monitor everything.

##### File structure
- Top-level:
- .env.template, docker-compose.yml.template, docker-compose-monitoring.yml.template → environment and orchestration
- install.sh, setup-monitoring.sh → bootstrap scripts
- config/odoo.conf.template, nginx/nginx.conf.template → runtime configs
- monitoring/: subfolders for Prometheus, Grafana, AlertManager, exporters, scripts
- nginx/: reverse-proxy templates (SSL certs)
- No dedicated “frontend” directory – the Odoo container serves the UI.

##### README for insights
- Confirms the architecture: Nginx → Odoo → PostgreSQL + Redis
- Monitoring: Prometheus scrapes exporters, Grafana for dashboards, AlertManager for alerts
- Lists ports, services, dashboards, alert rules, environment variables.

##### Detail
- External dependencies: SSL certificates (nginx/ssl), environment variables (.env).
- Build scripts (install.sh) as a note or sub-system that provisions the entire stack.
- Don’t overthink – break the stack into as many discrete, logical services as you have in the file tree.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Docker Compose Project Boundary
    subgraph "Docker Compose Project"
        direction TB

        subgraph "Edge Layer"
            direction TB
            Browser["User's Browser"]:::external
            Nginx["Nginx Reverse Proxy 80/443"]:::app
        end

        subgraph "App Layer"
            direction TB
            Odoo["Odoo 18 App Server 8069"]:::app
        end

        subgraph "Data Layer"
            direction TB
            PostgreSQL[(PostgreSQL 15 DB 5432)]:::data
            Redis(("Redis 6379")):::data
        end

        subgraph "Monitoring Layer"
            direction TB
            Prometheus["Prometheus 9090"]:::monitor
            Grafana["Grafana 3000"]:::monitor
            AlertManager["AlertManager 9093"]:::monitor

            subgraph "Exporters"
                direction TB
                NodeExporter[/"Node Exporter"/]:::exporter
                cAdvisor[/"cAdvisor"/]:::exporter
                PostgresExporter[/"PostgreSQL Exporter"/]:::exporter
                RedisExporter[/"Redis Exporter"/]:::exporter
                NginxExporter[/"Nginx Exporter"/]:::exporter
                BlackboxExporter[/"Blackbox Exporter"/]:::exporter
                Loki[/"Loki Logs Aggregation"/]:::exporter
                Promtail[/"Promtail Log Shipper"/]:::exporter
            end
        end
    end

    %% Connections
    Browser -->|"HTTPS"| Nginx
    Nginx -->|"HTTP"| Odoo
    Odoo -->|"SQL"| PostgreSQL
    Odoo -->|"Cache"| Redis

    Prometheus -.->|"scrapes"| NodeExporter
    Prometheus -.->|"scrapes"| cAdvisor
    Prometheus -.->|"scrapes"| PostgresExporter
    Prometheus -.->|"scrapes"| RedisExporter
    Prometheus -.->|"scrapes"| NginxExporter
    Prometheus -.->|"scrapes"| BlackboxExporter
    Prometheus -.->|"scrapes"| Loki
    Prometheus -.->|"scrapes"| Promtail

    Grafana -->|"reads metrics"| Prometheus
    Prometheus -->|"fires alerts"| AlertManager

    %% Configuration & Scripts
    subgraph "Configuration & Scripts"
        direction TB
        EnvTemp[".env.template"]:::config
        ComposeTemp["docker-compose.yml.template"]:::config
        ComposeMonTemp["docker-compose-monitoring.yml.template"]:::config
        InstallScript["install.sh"]:::config
        SetupMonScript["setup-monitoring.sh"]:::config
        OdooConf["config/odoo.conf.template"]:::config
        NginxConf["nginx/nginx.conf.template"]:::config

        PrometheusYML["monitoring/prometheus/prometheus.yml"]:::config
        AlertRules["monitoring/prometheus/alert_rules.yml"]:::config

        GrafanaDashOdooOverview["monitoring/grafana/dashboards/odoo/odoo-overview.json"]:::config
        GrafanaDashContainerOverview["monitoring/grafana/provisioning/dashboards/containers/container-overview.json"]:::config
        GrafanaDashPostgresOverview["monitoring/grafana/provisioning/dashboards/databases/postgresql-overview.json"]:::config
        GrafanaDashOdooComplete["monitoring/grafana/provisioning/dashboards/odoo/odoo-complete-dashboard.json"]:::config
        GrafanaDashboardsYML["monitoring/grafana/provisioning/dashboards/dashboards.yml"]:::config
        GrafanaDatasourcesYML["monitoring/grafana/provisioning/datasources/datasources.yml"]:::config

        AlertmanagerYML["monitoring/alertmanager/alertmanager.yml"]:::config
        BlackboxConfig["monitoring/blackbox/config.yml"]:::config
        LokiConfig["monitoring/loki/local-config.yml"]:::config
        PromtailConfig["monitoring/promtail/config.yml"]:::config
        PostgresExporterQueries["monitoring/postgres-exporter/queries.yml"]:::config

        ScriptsDockerfile["monitoring/scripts/Dockerfile"]:::config
        MaintenanceScript["monitoring/scripts/maintenance.sh"]:::config
        OdooHealthCheck["monitoring/scripts/odoo-health-check.py"]:::config
        Requirements["monitoring/scripts/requirements.txt"]:::config
    end

    %% Config to Services Arrows
    ComposeTemp -->|"orchestrates"| Nginx
    ComposeTemp -->|"orchestrates"| Odoo
    ComposeTemp -->|"orchestrates"| PostgreSQL
    ComposeTemp -->|"orchestrates"| Redis

    ComposeMonTemp -->|"orchestrates"| Prometheus
    ComposeMonTemp -->|"orchestrates"| Grafana
    ComposeMonTemp -->|"orchestrates"| AlertManager
    ComposeMonTemp -->|"orchestrates"| NodeExporter
    ComposeMonTemp -->|"orchestrates"| cAdvisor
    ComposeMonTemp -->|"orchestrates"| PostgresExporter
    ComposeMonTemp -->|"orchestrates"| RedisExporter
    ComposeMonTemp -->|"orchestrates"| NginxExporter
    ComposeMonTemp -->|"orchestrates"| BlackboxExporter
    ComposeMonTemp -->|"orchestrates"| Loki
    ComposeMonTemp -->|"orchestrates"| Promtail

    InstallScript -->|provisions| ComposeTemp
    SetupMonScript -->|provisions| ComposeMonTemp

    OdooConf -->|configures| Odoo
    NginxConf -->|configures| Nginx

    PrometheusYML -->|configures| Prometheus
    AlertRules -->|defines rules| Prometheus

    GrafanaDashOdooOverview -->|dashboard| Grafana
    GrafanaDashContainerOverview -->|dashboard| Grafana
    GrafanaDashPostgresOverview -->|dashboard| Grafana
    GrafanaDashOdooComplete -->|dashboard| Grafana
    GrafanaDashboardsYML -->|provisioning| Grafana
    GrafanaDatasourcesYML -->|provisioning| Grafana

    AlertmanagerYML -->|configures| AlertManager
    BlackboxConfig -->|configures| BlackboxExporter
    LokiConfig -->|configures| Loki
    PromtailConfig -->|configures| Promtail
    PostgresExporterQueries -->|queries| PostgresExporter

    ScriptsDockerfile -->|builds| NodeExporter
    MaintenanceScript -->|runs maintenance| NodeExporter
    OdooHealthCheck -->|health checks| Odoo
    Requirements -->|dependencies| OdooHealthCheck

    %% Click Events
    click EnvTemp "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/.env.template"
    click ComposeTemp "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/docker-compose.yml.template"
    click ComposeMonTemp "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/docker-compose-monitoring.yml.template"
    click InstallScript "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/install.sh"
    click SetupMonScript "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/setup-monitoring.sh"
    click OdooConf "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/config/odoo.conf.template"
    click NginxConf "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/nginx/nginx.conf.template"
    click PrometheusYML "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/prometheus/prometheus.yml"
    click AlertRules "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/prometheus/alert_rules.yml"
    click GrafanaDashOdooOverview "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/grafana/dashboards/odoo/odoo-overview.json"
    click GrafanaDashContainerOverview "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/grafana/provisioning/dashboards/containers/container-overview.json"
    click GrafanaDashPostgresOverview "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/grafana/provisioning/dashboards/databases/postgresql-overview.json"
    click GrafanaDashOdooComplete "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/grafana/provisioning/dashboards/odoo/odoo-complete-dashboard.json"
    click GrafanaDashboardsYML "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/grafana/provisioning/dashboards/dashboards.yml"
    click GrafanaDatasourcesYML "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/grafana/provisioning/datasources/datasources.yml"
    click AlertmanagerYML "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/alertmanager/alertmanager.yml"
    click BlackboxConfig "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/blackbox/config.yml"
    click LokiConfig "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/loki/local-config.yml"
    click PromtailConfig "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/promtail/config.yml"
    click PostgresExporterQueries "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/postgres-exporter/queries.yml"
    click ScriptsDockerfile "https://github.com/jsalvador-zsh/odoo-production-template/tree/master/monitoring/scripts/Dockerfile"
    click MaintenanceScript "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/scripts/maintenance.sh"
    click OdooHealthCheck "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/scripts/odoo-health-check.py"
    click Requirements "https://github.com/jsalvador-zsh/odoo-production-template/blob/master/monitoring/scripts/requirements.txt"

    %% Styles
    classDef app fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef data fill:#90EE90,stroke:#000,stroke-width:1px
    classDef monitor fill:#FFA500,stroke:#000,stroke-width:1px
    classDef exporter fill:#FFE4B5,stroke:#000,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#FFFFFF,stroke:#000,stroke-width:1px,stroke-dasharray: 5 5
```
