Quepasa Docs

Postgres

Quepasa works smoothly with PostgreSQL as a backing database. Below is an example Docker Compose snippet that sets up Quepasa with a PostgreSQL container.

services:
  web:
    image: codefroglabs/quepasa-web
    environment:
      QUEPASA__DATABASE__ENABLED: "true"
      QUEPASA__DATABASE__CONNECTIONSTRING: "Host=db;Port=5432;Database=Quepasa;Username=quepasa;Password=YOUR-DB-PASSWORD"
      QUEPASA__DATABASE__ADOINVARIANT: "Npgsql"
      QUEPASA__DEPLOYMENT__CLUSTERMODE: "2"
      QUEPASA__CLIENT__PRIMARYBACKEND: "http://backend"
    ports:
      - "5007:8080"
    depends_on:
      - backend
      - db

  backend:
    image: codefroglabs/quepasa-backend
    environment:
      QUEPASA__DATABASE__ENABLED: "true"
      QUEPASA__DATABASE__CONNECTIONSTRING: "Host=db;Port=5432;Database=Quepasa;Username=quepasa;Password=YOUR-DB-PASSWORD"
      QUEPASA__DATABASE__ADOINVARIANT: "Npgsql"
      QUEPASA__DEPLOYMENT__CLUSTERMODE: "2"
      QUEPASA__SETUP__SEED: "true"
    depends_on:
      - db

  db:
    image: postgres
    environment:
      POSTGRES_USER: quepasa
      POSTGRES_PASSWORD: YOUR-DB-PASSWORD
      POSTGRES_DB: Quepasa
    ports:
      - "5432:5432"

Important Considerations

  1. Enable the Database

    • QUEPASA__DATABASE__ENABLED=true ensures Quepasa uses persistent storage.
  2. Connection String

    • A typical PostgreSQL connection string is something like:
      Host=db;Port=5432;Database=Quepasa;Username=quepasa;Password=YOUR-DB-PASSWORD
      
    • Here, db is the name of the PostgreSQL container service, and 5432 is the standard PostgreSQL port.
  3. Environment Variables

    • QUEPASA__DATABASE__ADOINVARIANT=Npgsql tells Quepasa to use PostgreSQL.
    • POSTGRES_USER and POSTGRES_PASSWORD define the database credentials.
    • POSTGRES_DB sets the default database name.
  4. Production vs. Development

    • In production, protect your passwords with a secret management tool. Consider persisting your database storage (e.g., using volumes) for data durability.
  5. License Requirement

    • When QUEPASA__DATABASE__ENABLED=true, Quepasa checks for a valid license on startup. Provide it via QUEPASA_LICENSE if required.

With these configurations, Quepasa will store data in PostgreSQL. Remember to replace any placeholder passwords with your secure values.