Setting up the Opal State Database

1. Install a PostgreSQL database (version 7.4.6 or higher).

2. Create a database called app_db, and a user called app_user with a password. Grant all permissions on app_db to the app_user. Configure the database to accept remote JDBC connections (consult the database documentation for this).

3. Create the job status table inside the app_db database using the following:

   create table job_status (
       job_id varchar(32) not null primary key,
       code integer not null,
       message text not null,
       base_url varchar(128) not null,
       start_time varchar(128),
       last_update varchar(128),
       client_dn varchar(128),
       service_name varchar(128));

4. Create the output table inside the app_db database using the following:

   create table job_output (
       job_id varchar(32) not null primary key,
       std_out varchar(128) not null,
       std_err varchar(128) not null,
       foreign key(job_id) references job_status(job_id));

5. Create the output file table inside the app_db database using the following:

   create table output_file (
       job_id varchar(32) not null,
       name varchar(32) not null,
       url varchar(128) not null,
       foreign key(job_id) references job_status(job_id));

6. Set the following properties in the opal.properties file: database.url (a jdbc url), database.user (app_user), database.passwd, and database.use (true, if database is to be used - default is false).

7. Reinstall Opal by running the following command:

    ant -f build-opal.xml install

8. Restart Tomcat for the changes to take effect.