Documentation for FishEye 3.0.x. Documentation for other versions is available too.

To switch to a PostgreSQL database, install PostgreSQL and follow the steps below. When they are used together, FishEye and Crucible share the same external database.

Please note that during the migration of database servers, the FishEye/Crucible instance will not be available to users or to external API clients.

Step 1. Install and Create a PostgreSQL Database

  1. The JDBC drivers for PostgreSQL are bundled with FishEye/Crucible. Skip to Step 2 if this meets your needs. If you want to install a specific, different version of the bundled JDBC driver, download the download the PostgreSQL JDBC driver .jar file from the PostgreSQL website and copy the .jar file to your FISHEYE_INST/lib directory (create the lib/ directory if it doesn't already exist). Move the existing JDBC .jar file to another location (and back it up). Restart FishEye/Crucible to have it pick up the new driver.
  2. Create a new database user (replacing 'username' and 'password' with the appropriate values):

    $ psql 
    > create user username password 'password'; 
    
  3. Create a UTF-8 database and make the newly created user the owner:

    > create database crucible ENCODING 'UTF-8' OWNER username;
  4. Make sure the user has full access to the database:

    > grant all on database crucible to username;

Step 2. Configure FishEye/Crucible to use PostgreSQL, and Migrate Data

In order to migrate to a different database backend, you must create a backup of sql data, configure the database and finally import the data via a backup restoration process. This can be done from either the FishEye/Crucible administration console, which streamlines the process, or via the command line tool which FishEye/Crucible provides.

From FishEye/Crucible's Administration

  1. Navigate to the Database page in FishEye/Crucible's Administration console.

    To log in to the Admin area, you can either:

    • click Administration at the foot of the page. 
    • navigate to http://HOSTNAME:8060/admin/, where HOSTNAME is the name of the server on which you installed Fisheye.

    Once logged in as an administrator you can also get to the Admin area by clicking your user menu in the FishEye/Crucible header, and choosing Administration.

  2. First click Edit and then click Test Connection to verify that FishEye/Crucible can log in to the existing database.
  3. Select PostgreSQL from the database Type.
  4. Fill in the appropriate fields, using the same connection details as used when creating the PostgreSQL database in Step 1 above.
    1. Driver Location:  either your own PostgreSQL JDBC or the Bundled one that came with FishEye
    2. URL:  create this field by replacing the host, port, and database name with your own
      (i.e.  jdbc:postgresql://localhost:5432/<dbname>  e.g. jdbc:postgresql://localhost:5432/crucible)
    3. Username:  your DB username
    4. Password:  your DB password
    5. Minimum Pool Connections:  5 is the default
    6. Maximum Pool Connections:  20 is the default
    7. Parameters:  (one per line)
      1. useUnicode=true
      2. characterEncoding=UTF8


  5. Click Test Connection to validate the values.

    Screenshot: Testing the Connection



    If this fails, verify that you have the PostgreSQL JDBC driver .jar file in the classpath (by placing the .jar file in FISHEYE_INST/lib). Also, ensure that the database user can log in to the database from the machine that FishEye/Crucible is running on and that all the required privileges are present.
  6. Click Save & Migrate to start the migration process.

    During the migration process (which will take several minutes, depending on the size of your database and network throughput), the product will be inaccessible to users and external API clients. Users will see a maintenance screen that informs them of the process. Should the migration fail for any reason, FishEye/Crucible will not switch to the new database and report on the encountered problems. Because the destination database may now contain some, but not yet all data, drop all tables, indexes and constraints before attempting a new migration.

    Screenshot: Migrating the Database

From the command line

  1. Create a backup of the sql data from the FishEye/Crucible instance. Information on how to create a backup can be found at Backing up and restoring FishEye data / Backing up and restoring Crucible data.
  2. Run the following command from the bin directory in FISHEYE_INST:

    $ ./fisheyectl.sh restore --sql \
            --file /path/to/backup.zip \
            --dbtype postgresql \
            --jdbcurl jdbc:postgresql://hostname/dbname \
            --username crucible \
            --password password
    
  3. When the import is complete, FishEye/Crucible can be started and will use PostgreSQL.
  • No labels

2 Comments

  1. Two thoughts with this.

    Firstly, not being very familiar with PostgreSQL, it would have been nice to realise beforehand that I could have created a new tablespace for crucible. We already had a separate one for our JIRA database, but these instructions created the database straight in the global tablespace.

     

    Secondly, I got this:

    Unable to connect to PostgreSQL database jdbc:postgresql://localhost:5432/crucible: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "fisheye", database "crucible", SSL off Couldn't connect to the database

     

    Same from the command line:

    $ psql -h localhost -U fisheye -d crucible
    psql: FATAL: no pg_hba.conf entry for host "127.0.0.1", user "fisheye", database "crucible", SSL off

     

    My colleague showed me I needed to add these entries to get it to work:

    $ sudo su - postgres

    Edit /var/lib/pgsql/data/pg_hba.conf to add the fisheye entries below:

    # local is for Unix domain socket connections only
    local all postgres ident
    local all jira password
    local all fisheye password
    # IPv4 local connections:
    host all jira 127.0.0.1/32 password
    host all fisheye 127.0.0.1/32 password
    # IPv6 local connections:
    host all jira ::1/128 password
    host all fisheye ::1/128 password

    Then reload config without taking down PostgreSQL:

    -bash-3.2$ pg_ctl reload
    server signaled

    Then test:

    $ psql -h localhost -U fisheye -d crucible

    Password for user fisheye:

    psql (8.4.7)

    Type "help" for help.

     

    crucible=> \q

     

    Then I was able to carry on with the migration.

  2. Anonymous

    This happens because you create a user BEFORE having the role and if the user does not having the role, it fails.

    If you follow this tutorial, at the end, please add

    sudo -u postgres psql -c "ALTER USER username PASSWORD 'yourpassword';"