Postgres jira home export
--------------------

1. Create a database
https://confluence.atlassian.com/display/JIRA/Connecting+JIRA+to+PostgreSQL
psql
CREATE DATABASE jiradb WITH ENCODING 'UNICODE' LC_COLLATE 'C' LC_CTYPE 'C' TEMPLATE template0;


2. Download a standalone version of JIRA
https://www.atlassian.com/software/jira/download-archives\
Version: 6.3

// extract and set home directory
unzip atlassian-jira-6.3.zip
cd atlassian-jira-6.3-standalone/
mkdir home
echo "jira.home=`pwd`/home" > atlassian-jira/WEB-INF/classes/jira-application.properties

// db driver
download
https://maven.atlassian.com/service/local/repositories/central/content/postgresql/postgresql/9.0-801.jdbc4/postgresql-9.0-801.jdbc4.jar
cp postgresql-9.0-801.jdbc4.jar lib/

// start jira
bin/start-jira.sh

//configure db

// insert following license
 

// admin details

Full name: Administrator
Email: admin@example.com
Username: admin
Password: admin

// notifications
don't configure email options

// finally the dashboard shows up

// stop JIRA

// execute following queries to set relative paths:
UPDATE propertystring SET propertyvalue = './data/attachments' where ID = (SELECT ID FROM propertyentry where ENTITY_NAME = 'jira.properties' and ENTITY_ID = 1 AND PROPERTY_KEY = 'jira.path.attachments' AND propertytype = 5);
UPDATE propertystring SET propertyvalue = './export' where ID = (SELECT ID FROM propertyentry where ENTITY_NAME = 'jira.properties' and ENTITY_ID = 1 AND PROPERTY_KEY = 'jira.path.backup' AND propertytype = 5);

// Do a db export
pg_dump -Upostgres jiradb > jira_63_postgres91_dump.sql
