Grafana

Dashboards, visualizations and alerts for your metrics, logs and traces

Grafana on Cubeship

Grafana turns metrics, logs and traces from the data sources you already run into dashboards and alerts.

This template installs it on a Cubeship instance with a managed Postgres for its dashboards, users and alert rules.

What it creates

  • grafana — the Grafana server, from grafana/grafana:13.2.1, answering on the domain you choose.
  • grafana-db — a managed Postgres 18 database, attached to the app.

What you are asked

InputWhat to give
Where Grafana answersA domain you control, pointed at your instance.
The password for the admin accountNothing — the instance generates it and shows it once.
The key Grafana encrypts data source credentials withNothing — generated and shown once. Keep a copy: a new key cannot read the passwords saved under the old one.

After installing

  1. Open the domain and sign in as admin with the generated password.
  2. Add your first data source under Connections.

GF_SERVER_ROOT_URL assumes the instance serves HTTPS. On an instance with TLS off, change it to start with http://.

Plugins

The app has no disk of its own, so a plugin installed from the UI is gone on the next deploy. List the ones you need in GF_PLUGINS_PREINSTALL instead — for example grafana-clock-panel — and Grafana installs them on every start.

Resources

The app is limited to 1 CPU and 512 MiB of memory. Raise limits in template.yaml for many users or heavy dashboards.

What this creates

grafana

grafana/grafana:13.2.1

grafana-db

Postgres 18

template.yaml
# yaml-language-server: $schema=https://cubeship.dev/schema/template/v1.json
version: 1
minCubeship: "0.6.0"
project: grafana

inputs:
  - key: domain
    type: domain
    label: Where Grafana answers
  - key: adminPassword
    type: secret
    label: The password for the admin account
    generate: 24
  - key: secretKey
    type: secret
    label: The key Grafana encrypts data source credentials with
    help: Keep a copy. Without it, the passwords saved in data sources cannot be read again.
    generate: 32

databases:
  - key: db
    name: grafana-db
    engine: postgres
    version: "18"
    database: grafana

apps:
  - key: web
    name: grafana
    image: grafana/grafana
    tag: "13.2.1"
    port: 3000
    health: /api/health
    domains:
      - host: ${input.domain}
    attach:
      - database: db
    limits: { cpu: 1, memory: 512Mi }
    env:
      GF_DATABASE_TYPE: postgres
      # host:port in one value, which is how Grafana reads it.
      GF_DATABASE_HOST: ${db.db.host}:${db.db.port}
      GF_DATABASE_NAME: ${db.db.name}
      GF_DATABASE_USER: ${db.db.user}
      GF_DATABASE_PASSWORD: ${db.db.password}
      GF_DATABASE_SSL_MODE: disable
      GF_SECURITY_ADMIN_PASSWORD: ${input.adminPassword}
      GF_SECURITY_SECRET_KEY: ${input.secretKey}
      GF_SERVER_ROOT_URL: https://${input.domain}/