If you keep the same database settings when you re-run the installer, it will keep that same data.
jar and war files are basically zip files. So you can't just edit the jar. Assuming you are starting from the war, you'll need to unzip that war. Then unzip WEB-INF/lib/ODKAggregate-settings.jar
, then edit security.properties
(text file) to update the hostname. Then you'll need to re-zip the jar and re-zip the war and make sure they are in the same place. It's not hard, but you do have to be precise.
You can also see this done in the ODK Aggregate VM installer:
https://github.com/nafundi/odk-aggregate-box/blob/master/provisioning/roles/install-aggregate/tasks/main.yml#L23-L68
And if that doesn't make sense, here's part of a Bash script that does this on Ubuntu.
TIMESTAMP=$(date +%Y-%m-%dT%H:%M:%SZ)
ZIP_PATH=$(which zip)
UNZIP_PATH=$(which unzip)
WAR_PATH="/var/lib/tomcat6/webapps/ROOT.war"
WAR_FOLDER_PATH="/var/lib/tomcat6/webapps/ROOT"
BACKUP_WAR_PATH="/usr/local/etc/aggregate/ROOT.war.$TIMESTAMP"
echo "Unpacking ROOT.war";
$UNZIP_PATH -q $WAR_PATH -d /tmp/ODKAggregate;
echo "Unpacking ODKAggregate-settings.jar";
$UNZIP_PATH -q /tmp/ODKAggregate/WEB-INF/lib/ODKAggregate-settings.jar -d /tmp/ODKAggregate-settings;
echo "Changing ODKAggregate-settings.jar settings";
eval "sed -i -e 's/^security.server.hostname=.*/security.server.hostname=$HOSTNAME/g' /tmp/ODKAggregate-settings/security.properties;";
echo "Repacking ODKAggregate-settings.jar";
cd /tmp/ODKAggregate-settings;
$ZIP_PATH -q -r ../ODKAggregate/WEB-INF/lib/ODKAggregate-settings.jar .;
echo "Backing up old war and removing exploded folder";
if [ -f $WAR_PATH ]
then
mv $WAR_PATH "$BACKUP_WAR_PATH";
fi
if [ -d $WAR_FOLDER_PATH ]
then
rm -rf $WAR_FOLDER_PATH;
fi
echo "Repacking ROOT.war";
cd /tmp/ODKAggregate;
$ZIP_PATH -q -r $WAR_PATH .;