Skip to content

Configure PostgreSQL

Use the bundled PostgreSQL service or connect Supermetry to a dedicated PostgreSQL 18 database.

Choose the bundled database for the simplest install, or create a dedicated database on an existing PostgreSQL server.

  1. Use PostgreSQL 18, the supported baseline. The installer warns when it connects to an older server.

  2. For a Docker install with the bundled database, keep the generated POSTGRES_PASSWORD in .env and start the stack.

    Terminal window
    cd /opt/supermetry
    docker compose up -d
  3. For your own PostgreSQL server, create a role and database. Replace CHANGE_ME before running the command.

    Terminal window
    sudo -u postgres psql <<'SQL'
    CREATE ROLE supermetry LOGIN PASSWORD 'CHANGE_ME';
    CREATE DATABASE supermetry OWNER supermetry;
    SQL
  4. Set the connection URL in the Supermetry environment file.

    Terminal window
    sudoedit /etc/supermetry/supermetry.env

    Use sslmode=disable only for a local connection that does not need TLS:

    SUPERMETRY_DATABASE_URL=postgres://supermetry:CHANGE_ME@127.0.0.1:5432/supermetry?sslmode=disable

    For a remote database, use TLS:

    SUPERMETRY_DATABASE_URL=postgres://supermetry:CHANGE_ME@db.example.com:5432/supermetry?sslmode=require
  5. Restart Supermetry. It runs database migrations during startup.

    Terminal window
    sudo systemctl restart supermetry
    sudo systemctl status supermetry --no-pager

What you should see: the service is active and starts without a PostgreSQL connection or migration error.