# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: VictoriaMetrics
spec:
    description: The high-performance, open source time series database & monitoring solution
    coverImage: https://cdn.zeabur.com/templates/cover-image/victoriametrics.png
    icon: https://cdn.zeabur.com/templates/icon/victoriametrics.svg
    tags:
        - monitoring
        - observability
        - metrics
    readme: |
        VictoriaMetrics is a fast and scalable open source time series database and monitoring solution that lets users build a monitoring platform without scalability issues and minimal operational burden.

        It can store millions of data points per second on a single instance, or scale to a high-load monitoring system across multiple data centers. Also, it stores 10x more data using the same compute and storage resources as existing solutions.

        Typically, you compose VictoriaMetrics with [Grafana](https://zeabur.com/templates/MDTTQR) to visualize and integrate the metrics.

        Check the benchmark between VictoriaMetrics and Prometheus on [their blog](https://victoriametrics.com/blog/comparing-agents-for-scraping/). For more information about VictoriaMetrics, please refer to [the official website](https://victoriametrics.com).

        ## Usage

        You can find the port mapping (`8428`) from the “Networking” tab in the “Services” section.

        To add your own targets, you should add them in the `/etc/victoriametrics/scrape.yaml` file on [Config Editor](https://zeabur.com/docs/data-management/config-edit). For example:

        ```yaml
        scrape_configs:
          - job_name: 'victoriametrics'
            static_configs:
              - targets: ['http://localhost:8428/metrics']
          - job_name: 'my-service'
            static_configs:
              - targets: ['http://my-service.zeabur.internal:8080/metrics']
        ```

        Then, you can query the metrics with VictoriaMetrics's Web UI at `https://your-domain/vmui` (where `your-domain` binds to the port `8428`) and with [Grafana](https://zeabur.com/templates/MDTTQR).

        By default, the data retention period is 30 days. You can change it by modifying the `-retentionPeriod` argument in the Command section of the Settings tab of this service. See [Retention](https://docs.victoriametrics.com/victoriametrics/#retention) section in VictoriaMetrics' docs for more information.

        More integrations supported by VictoriaMetrics [are listed here](https://docs.victoriametrics.com/victoriametrics/integrations/).
    services:
        - name: victoriametrics
          icon: https://cdn.zeabur.com/templates/icon/victoriametrics.svg
          template: PREBUILT
          spec:
            source:
                image: victoriametrics/victoria-metrics:v1.137.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
