Set up a PostgreSQL database

When you install TeamForge, the PostgreSQL database that handles your CollabNet TeamForge data is set up automatically by default. However, you can configure PostgreSQL further to work with your site's specific conditions.

Note: These are the minimal steps required for a site running on a single server. Settings may vary if your environment features multiple boxes or special networking characteristics. See Set up a PostgreSQL database on its own server.
  1. Check that the basic configuration settings for PostgreSQL are correct in the master configuration file. See Set your basic TeamForge database options.
  2. Log onto the server as the PostgreSQL user.
    • su-postgres
    Note: Replace postgres with the value you selected for DATABASE_USERNAME in the site-options.conf file, if you changed it from the default. Your password is the value of the DATABASE_PASSWORD in the site-options.conf file.
  3. On SuSE, start PostgreSQL with initdb.
    • initdb -D /var/lib/pgsql/data
  4. In the /var/lib/pgsql/data/pg_hba.conf file, make sure the host entry points to your CollabNet TeamForge server. The table should look like this:
    #TYPE   DATABASE           USER                   CIDR-ADDRESS       METHOD
    # "local" is for Unix domain socket connections only
    local   all                all                                       trust
    # IPv4 local connections:
    host    all                all                    127.0.0.1/32       trust
    # IPv6 local connections:
    host    <DATABASE_NAME>    <DATABASE_USERNAME>    <app_host_ip>/32   md5
    

    where:

    • <DATABASE_NAME> is the value of the DATABASE_NAME variable in the site-options.conf file.
    • <DATABASE_USERNAME> is the value of the DATABASE_USERNAME variable in the site-options.conf file.
    • <app_host_ip> is the IP address of the main TeamForge application server (that is, the server to which the app parameter is assigned in the site-options.conf file).
  5. In the /var/lib/pgsql/data/postgresql.conf file, under CONNECTIONS AND AUTHENTICATION, make sure the listen_addresses variable points to your database server.
    • listen_addresses = '127.0.0.1,<database_host_ip>'

    where <database_host_ip> is the IP address of the the server to which the database parameter is assigned in the site-options.conf file.

    Note: If your database is running on the same machine as the main TeamForge application, point the variable to your application server.
  6. Log out of PostgreSQL and restart it.
    • exit
    • /etc/init.d/postgresql start
  7. Log back into the PostgreSQL server and create the PostgreSQL user.
    • su-postgres
    • createuser -P -S --createdb --no-createrole <username>
  8. Create the database.
    • createdb -E UTF8 -O <database username> <database name>

    where <database username> and <database name> are the values you specified in the site-options.conf file.

  9. Exit the PostgreSQL shell.
    • exit
Your database is now ready to manage the work products your users produce.
Tip:
  • Before proceeding, make sure you can manually connect to PostgreSQL using the settings you have specified for the application. It is easier to troubleshoot the connection now than in later steps.
  • For recommendations on optimizing your PostgreSQL database to fit the particular requirements of your CollabNet TeamForge site, see this wiki page.