Skip to content

Latest commit

 

History

History
71 lines (56 loc) · 1.81 KB

File metadata and controls

71 lines (56 loc) · 1.81 KB

PostgreSQL Guide

Using a PostgreSQL database

By default, in-memory db is used. If you want to use PostgreSQL with RHDH, here are the steps:

NOTE: You must have Red Hat Login to use postgresql image.

  1. Login to container registry with Red Hat Login credentials to use postgresql image

    podman login registry.redhat.io

    If you prefer docker you can just replace podman with docker

    docker login registry.redhat.io
  2. Uncomment the db service block in compose.yaml file

    db:
      image: "registry.redhat.io/rhel8/postgresql-16:latest"
      volumes:
        - "/var/lib/pgsql/data"
      env_file:
        - path: "./default.env"
          required: true
        - path: "./.env"
          required: false
      environment:
        - POSTGRESQL_ADMIN_PASSWORD=${POSTGRES_PASSWORD}
      healthcheck:
        test: ["CMD", "pg_isready", "-U", "postgres"]
        interval: 5s
        timeout: 5s
        retries: 5
  3. Uncomment the db section in the depends_on section of rhdh service in compose.yaml

    depends_on:
      install-dynamic-plugins:
        condition: service_completed_successfully
      db:
        condition: service_healthy
  4. Comment out the SQLite in-memory configuration in app-config.local.yaml

    # database:
    #   client: better-sqlite3
    #   connection: ':memory:'
  5. Add Postgres configuration in app-config.local.yaml

    database:
     client: pg
     connection:
       host: ${POSTGRES_HOST}
       port: ${POSTGRES_PORT}
       user: ${POSTGRES_USER}
       password: ${POSTGRES_PASSWORD}