view doc/postgresql.txt @ 7441:e7df82ae137d

Cleanup docker before 2.3.0b1 release scripts/Docker/Dockerfile Document/implement pip_sdist source mode for testing the source distribution. Change from multiple if's to case statement. Disable verbose tracing of shells script. Use --build-arg="VERBOSE=1" to enable set -xv. scripts/Docker/roundup_start Report error if demo mode is used with 2.2.0. This catches the easiest case where build is done using pypi before 2.3.0 final is released. Indent demo mode PORT_8080 doc block so it's not lost in a wall of text. doc/installation.txt Document all source --build-args including how to build from pypi using a version specifier. Break out other uses of --build-arg into code blocks. Reference docker compose section rather than referencing docker-compose.yml. Clarify docker hub tagging for devel releases. Minor formatting fixes.
author John Rouillard <rouilj@ieee.org>
date Wed, 31 May 2023 19:14:56 -0400
parents b21ebabeb2ef
children 3071db43bfb6
line wrap: on
line source

.. index:: postgres; deployment notes

==========================
PostgreSQL/psycopg Backend
==========================

This are notes about PostqreSQL backend based on the psycopg adapter for
Roundup issue tracker.

Prerequisites
=============

To use PostgreSQL as backend for storing roundup data, you should
additionally install:

1. PostgreSQL_ 8.x or higher

2. The psycopg_ python interface to PostgreSQL_

Note that you currently need at least version 2.8 of psycopg_ -- the
postgresql backend will work with 2.7 but if you're using the native
postgresql indexer you need at least 2.8. Also if you want to run the
tests, these also need 2.8. If your distribution has an older version we
suggest that you install into a python virtual environment.

.. _psycopg: https://www.psycopg.org/
.. _PostgreSQL: https://www.postgresql.org/


Running the PostgreSQL unit tests
=================================

The user that you're running the tests as will need to be able to access
the postgresql database on the local machine and create and drop
databases. See the config values in 'test/db_test_base.py' 
about which database connection, name and user will be used.

At this time the following command will setup the user::

  sudo -u postgres psql -c "CREATE ROLE rounduptest WITH CREATEDB LOGIN PASSWORD 'rounduptest';" -U postgres

Note ``rounduptest`` is a well known account, so you should
remove/disable the account after testing and set up a suitable
production account. You need to remove any database owned by
``rounduptest`` first. So something like this should work::


  sudo -u postgres psql -c "DROP DATABASE rounduptest;" -U postgres
  sudo -u postgres psql -c "DROP ROLE rounduptest;" -U postgres

If the ``rounduptest`` database is left in a broken state
(e.g. because of a crash during testing) dropping the database and
restarting the tests should fix it.
   
Credit
======

The postgresql backend was originally submitted by Federico Di Gregorio
<fog@initd.org>


Roundup Issue Tracker: http://roundup-tracker.org/