# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Prometheus + Grafana
spec:
    description: Monitor your applications with Prometheus and Grafana.
    icon: https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Grafana_icon.svg/1969px-Grafana_icon.svg.png
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: The domain name for your Grafana dashboard
    tags:
        - monitoring
        - prometheus
        - grafana
    readme: "## ⚠️ Deprecation Notice: Switch to Standalone Templates\n\nThis integrated template is now **deprecated and unmaintained**. While it served as a convenient \"all-in-one\" package, its monolithic design prevents you from independently swapping or upgrading individual components.\n\nTo provide you with greater flexibility and control over your stack, Zeabur has decoupled **Prometheus** and **Grafana** into separate, standalone templates. This change allows you to mix and match versions and configurations that best suit your specific infrastructure needs.\n\n### How to Replicate This Setup\n\nIf you need a comprehensive telemetry solution like this one, you can easily recreate it by following these steps:\n\n1. Deploy the **[Grafana template](https://zeabur.com/templates/MDTTQR)** by selecting the **\"Create New Project\"** option. \n2. Deploy the **[Prometheus template](https://zeabur.com/templates/XV8ADT)** and choose **\"Deploy to Existing Project\"** to add it to the same workspace.\n\nIt's also common to deploy them in separate projects, where you have a central Grafana instance receiving metrics (Prometheus) from multiple projects.\n\nAlso, we highly encourage you to explore the **[Grafana template page](https://zeabur.com/templates/MDTTQR)** to discover other metrics and tracing backend solutions. By combining these independent building blocks, you can design a robust, custom observability solution tailored specifically to your goals.\n\n---\n\nMonitor your applications with Prometheus and Grafana.\n"
    services:
        - name: prometheus
          icon: https://avatars.githubusercontent.com/u/3380462?s=48&v=4
          template: PREBUILT
          spec:
            id: prometheus
            source:
                image: prom/prometheus
            ports:
                - id: web
                  port: 9090
                  type: HTTP
            volumes:
                - id: data
                  dir: /prometheus
            configs:
                - path: /etc/prometheus/prometheus.yml
                  template: |
                    global:
                      scrape_interval: 15s
                    scrape_configs:
                      - job_name: 'prometheus'
                        static_configs:
                          - targets: ['localhost:9090']
                  permission: null
                  envsubst: null
        - name: grafana
          icon: https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Grafana_icon.svg/1969px-Grafana_icon.svg.png
          template: PREBUILT
          spec:
            id: grafana
            source:
                image: grafana/grafana
            ports:
                - id: web
                  port: 3000
                  type: HTTP
            volumes:
                - id: data
                  dir: /var/lib/grafana
            env:
                GF_SECURITY_ADMIN_PASSWORD:
                    default: admin
                GF_SECURITY_ADMIN_USER:
                    default: admin
            configs:
                - path: /etc/grafana/provisioning/datasources/datasource.yml
                  template: |
                    apiVersion: 1
                    datasources:
                      - name: Prometheus
                        type: prometheus
                        access: proxy
                        orgId: 1
                        url: http://prometheus:9090
                        basicAuth: false
                        isDefault: true
                  permission: null
                  envsubst: null
          domainKey: PUBLIC_DOMAIN
