# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: VictoriaMetics + Grafana
spec:
    description: Monitor your applications with VictoriaMetrics 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 **VictoriaMetrics** 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 **[VictoriaMetrics template](https://zeabur.com/templates/UBHA7Z)** 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 (VictoriaMetrics) 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 VictoriaMetrics and Grafana.\n"
    services:
        - name: victoriametrics
          icon: https://www.gravatar.com/avatar/a625fcc372d7c43a7943d031fbd88942?s=240&r=g&d=404
          template: PREBUILT
          spec:
            id: victoriametrics
            source:
                image: victoriametrics/victoria-metrics:v1.132.0
                command:
                    - /victoria-metrics-prod
                args:
                    - -storageDataPath=/victoria-metrics-data
                    - -retentionPeriod=30d
                    - -promscrape.config=/etc/victoriametrics/scrape.yaml
            ports:
                - id: web
                  port: 8428
                  type: HTTP
            volumes:
                - id: data
                  dir: /victoria-metrics-data
            configs:
                - path: /etc/victoriametrics/scrape.yaml
                  template: |
                    global:
                      scrape_interval: 15s
                    scrape_configs:
                      - job_name: 'victoriametrics'
                        static_configs:
                          - targets: ['http://localhost:8428/metrics']
                  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
            instructions:
                - title: Username
                  content: ${GF_SECURITY_ADMIN_USER}
                - title: Password
                  content: ${GF_SECURITY_ADMIN_PASSWORD}
            env:
                GF_SECURITY_ADMIN_PASSWORD:
                    default: ${PASSWORD}
                GF_SECURITY_ADMIN_USER:
                    default: admin
            configs:
                - path: /etc/grafana/provisioning/datasources/datasource.yml
                  template: |
                    apiVersion: 1
                    datasources:
                      - name: VictoriaMetrics
                        type: prometheus
                        access: proxy
                        orgId: 1
                        url: http://victoriametrics:8428
                        basicAuth: false
                        isDefault: true
                  permission: null
                  envsubst: null
          domainKey: PUBLIC_DOMAIN
