Grafana 13.1.7 Observability
Free credit available Limited time

Grafana PostgreSQL backend. Your dashboards live in Postgres from day one.

Grafana 13.1.7 with PostgreSQL 16 as its own database deploys in one click onto a dedicated server Selfhost.dev provisions, secures and runs. Grafana is pointed at Postgres before it first starts, so every dashboard, user and alert rule is stored there from the beginning. The database is never reachable from the internet.

Two containers on one server, nothing to wire by hand. Six locations on three continents.

One click. Two containers. The template deploys in about five minutes.

+$5.00 added at signup ยท deployment choice preserved ยท no card

What the one click wires up before your first dashboard.
In one line

What is Grafana with PostgreSQL?

What it is

Grafana OSS keeping its own data in PostgreSQL instead of the SQLite file it ships with. It is not the PostgreSQL data source, which every Grafana has built in, this one included.

Who it is for

Teams putting Grafana in front of more than one person who want its dashboards, users and alert rules in a real database. Grafana's own docs recommend MySQL or PostgreSQL for production.

When to use it

When the instance matters enough to back up and restore like any other database. For a trial or one person's dashboards, plain Grafana is one container less.

Compose

Grafana PostgreSQL on Docker Compose, set up for you

Many Grafana PostgreSQL tutorials end in a Docker Compose file like this: Postgres beside Grafana with port 5432 published. Some never set GF_DATABASE_TYPE, so Grafana still keeps its dashboards in SQLite. This template wires Grafana to its Postgres before the first boot and keeps the database off the internet.

A compose file with Postgres in it is not a Postgres backend

Grafana uses SQLite unless GF_DATABASE_TYPE says otherwise, even with Postgres running next to it. Postgres is then only a data source while dashboards sit in a file on the Grafana volume. Here Grafana's database settings point at the bundled Postgres from the start.

The stack, end to end

Callers

Your team and your alert receivers

Edge

TLS and routing

Your project server
Container

Grafana 13.1.7

Container

PostgreSQL 16

Volume

grafana-data

Platform secret

Admin password

Grafana and Postgres on Docker Compose, by handGrafana PostgreSQL on Selfhost.dev
Run grafana-enterprise:latest and postgres:16grafana/grafana:13.1.7, pinned, beside postgres:16-alpine
Add GF_DATABASE_* or Grafana stays on SQLiteSet before first boot: Postgres holds dashboards, users and alert state
Publish 5432:5432 to reach the databasePort 5432 stays inside the server; the firewall opens only 22, 80 and 443
Sign in with admin/admin, then change itGF_SECURITY_ADMIN_USER and GF_SECURITY_ADMIN_PASSWORD set before first boot
Mount two volumes and keep thempostgresql-data for the database, grafana-data for plugins and renders
Put a proxy and a certificate in frontTLS per hostname, renewed for you; GF_SERVER_ROOT_URL follows your domain
Port 5432 stays inside the server. Deploy the stack
Server

Grafana PostgreSQL requirements

Grafana PostgreSQL requirements are modest: two light containers and two volumes behind HTTPS. Grafana's own database holds dashboards, users and alert state, not your metrics, so it stays small. 4 GB, the smallest server we offer, is the size we recommend.

What it needs

Grafana
13.1.7, pinned
Database
PostgreSQL 16 (postgres:16-alpine) in its own container
Memory and CPU
4 GB, the smallest server we offer; x86 or ARM
What a 4 GB server handles
This template plus four more light templates or one heavy one
Not configured
Data sources, dashboards and SMTP
Grafana's supported range
PostgreSQL 12 and newer
Server size: 4 GB, enough for Grafana (Postgres). Deploy on a 4 GB server
Quickstart

How to deploy Grafana with PostgreSQL in 3 steps

Two containers, one server, no SQL to run.

  1. Choose Grafana (Postgres) and a 4 GB server

    The Launch button opens this exact template in the console. Pick one of six locations and submit; the template deploys in about five minutes.

  2. Keep the administrator login

    The console shows the Grafana username and password, both set before first boot. Store them somewhere safe; the database needs no setup from you.

  3. Connect your data

    Sign in, add a data source and build or import a dashboard. Everything you create is written to the bundled Postgres.

Deploy Grafana (Postgres)Step 1 starts in the console.
Launch Grafana (Postgres)
Billing

What Grafana with PostgreSQL costs to run

Grafana with PostgreSQL costs the same to run as Grafana alone: both containers share one server. A European 4 GB server runs them at $0.02/hr, about $15 to $16 a month, billed by the hour against prepaid credits. No database fee, no fee per user.

$0.02
/hr, about $15 to $16 a month at 730 hours
European 4 GB server, $0.02/hr Deploy Grafana (Postgres)
What else you pay for
ItemCost
Grafana OSS and PostgreSQL 16$0
Users, editors and viewers$0 at any number
Bandwidth$0, traffic is included in the server price
Optional daily backups+20% of the server price
ServerRAM, cores, diskWhereRateAbout a month
cx23 (recommended)4 GB, 2 cores, 40 GBEurope$0.02/hr$15.18
cax11 (ARM)4 GB, 2 cores, 40 GBEurope$0.02/hr$16.35
cx33 (room to grow)8 GB, 4 cores, 80 GBEurope$0.03/hr$23.36
cpx214 GB, 3 cores, 80 GBUS$0.12/hr$87.75
cpx224 GB, 2 cores, 80 GBSingapore$0.10/hr$72.56

Monthly figures assume 730 hours.

If your balance reaches zero

With a card on file or a past top-up, the server is powered off and held for 24 hours. We email you; a top-up in that window starts it again. Welcome-credit-only servers are deleted at zero, database included, so keep your own pg_dump.

Compare sizes and locations in the calculator, no signup. Per-user Grafana Cloud and Amazon prices sit on the Grafana hosting page.

Database

Grafana SQLite vs PostgreSQL

Grafana PostgreSQL or SQLite is the one storage choice Grafana leaves to you. SQLite ships inside the binary and, in Grafana's own words, suits local development and small evaluation instances. For production its docs recommend MySQL or PostgreSQL. Only where the state lives changes.

Where they differGrafana with SQLiteGrafana with PostgreSQL (this page)
Where its state livesA file on the Grafana volumeIts own PostgreSQL 16 container
Grafana's guidanceLocal development, small evaluationProduction
Your own copyDashboard JSON exportspg_dump of the whole database
High availabilityNot possible: HA needs a shared databaseThe kind of database HA needs; one Grafana server here

Guidance quoted from Grafana's installation and high availability docs.

When plain Grafana is the better choice

For a trial or one person's dashboards, Grafana with SQLite does the same job with one container less. Start there; dashboards move across as JSON when the instance grows into a team tool.

Status

What the platform checks on every Grafana PostgreSQL server

  • Every service is health-checked every 60 seconds.
  • A stalled deploy is retried automatically, not abandoned.
  • A deploy is never reported done until the URL answers.
  • Your Grafana version does not move. 13.1.7 is pinned and Postgres stays on major version 16; a restart brings back the same images.
  • Grafana never boots on admin/admin. The administrator is seeded before the first start.
~5 min to deploy

The Grafana (Postgres) template deploys in about five minutes. That is the platform's own budget, not an estimate.

Notes

Grafana PostgreSQL limitations

  1. One Grafana server, not a cluster. High availability needs two or more Grafana servers behind a load balancer. This template runs one. Its database is the kind that design needs, with no public port for a second server to join.
  2. The bundled Postgres is not a Managed Database. It is a container on the project server with no point in time recovery, pooling or Multi-AZ. Managed PostgreSQL is a separate product.
  3. Starts empty, Grafana pinned. No data sources, dashboards or SMTP are provisioned. Grafana stays on 13.1.7 and Postgres on major version 16; our re-pins reach new deployments only.

Nothing here in your way? The template deploys in about five minutes.

Launch Grafana (Postgres)
Backups

Grafana PostgreSQL backup and restore

Grafana PostgreSQL backup works two ways here. The server can take an optional daily snapshot of everything on it. With container access over SSH, which we grant on request, pg_dump inside the database container writes Grafana's whole state to one file you can keep anywhere.

MethodWhat it coversWhere it lives
Daily server backup (optional, +20%)Grafana, Postgres, plugins and renders; the last 7 keptWith the server; deleted with it
pg_dump over SSH (container access on request)Dashboards, folders, users, alert rules and alert stateWherever you copy it
Sizing

Not sure one server is enough?

Tell us how many dashboards, viewers and alert rules you run. We reply with the size to run and what it costs a month.

Help

Frequently asked questions

Is Grafana with PostgreSQL high availability?

No, not by itself. Grafana's high availability design runs two or more Grafana servers behind a load balancer, all sharing one MySQL or PostgreSQL database. This template runs one Grafana server with its state already in PostgreSQL, the kind of database that design needs. The database has no public port, so a second Grafana server cannot reach it as deployed.

Does Grafana need PostgreSQL in production?

Grafana's documentation says SQLite isn't recommended for production and points to MySQL or PostgreSQL instead. SQLite works well for local development and small evaluation instances. Once dashboards and alert rules matter to a whole team, PostgreSQL is the safer home for them. This template sets it up before Grafana first starts.

Is this the Grafana PostgreSQL data source?

No. This template uses PostgreSQL as Grafana's own database, where it keeps dashboards, users and alert state. The PostgreSQL data source is separate: it is built into every Grafana, this one included. It charts data from any Postgres database Grafana can reach. Use both if your metrics already live in Postgres.

How do I move from Grafana with SQLite to PostgreSQL?

Export each dashboard as JSON, deploy this template, add your data sources again, then import the files. Recreate users, teams and alert rules in the new instance. Your SQLite deployment keeps running until you delete it, so you can compare the two side by side before pointing your domain at the new one.

Which PostgreSQL version does Grafana support?

Grafana supports PostgreSQL 12 and newer for its own database, following PostgreSQL's upstream support timeline. This template runs postgres:16-alpine, inside that range, next to grafana/grafana:13.1.7. Grafana is pinned to that exact tag and Postgres stays on major version 16, so a restart moves neither.

Grafana on Postgres. Wired before you sign in.

  • Grafana 13.1.7, pinned, on PostgreSQL 16
  • A European 4 GB server, about $15 to $16 a month
  • One pg_dump holds every dashboard
Launch Grafana (Postgres)

About Selfhost.dev

Selfhost.dev is a managed self hosting platform for developers and small teams. Open source apps and databases on dedicated servers you control, billed by the hour, in six locations across three continents.

Best for: Grafana, Metabase, Elasticsearch with Kibana and managed PostgreSQL, MySQL, Redis, ClickHouse, OpenSearch and Kafka.