=== modified file 'tools/dhis2-tools-deb/docs/manual.xml' --- tools/dhis2-tools-deb/docs/manual.xml 2013-05-28 12:06:12 +0000 +++ tools/dhis2-tools-deb/docs/manual.xml 2013-05-29 11:52:03 +0000 @@ -1,18 +1,20 @@ - + DHIS2 server tools manual - Bob - Jolliffe + DHIS2 developer team Overview - Installing and managing DHIS2. + The dhis2-tools package is a collection of tools and utilities for installing and managing + DHIS2 applications on an ubuntu server. The tools provide the ability to go from a "blank" + server with only ssh running, to a fully functioning dhis2 installation in a matter of + minutes. Used together they can also be combined into automated scripts to facilitate rapid + reconstruction of a given configuration. @@ -41,7 +43,29 @@ Description - Use this tool to create a new dhis2 instance in a tomcat container. + Use this tool to create a new dhis2 instance in a tomcat container. The name that is + specified will be used to create a new user and a new database with the name of that user. + The user will be assigned to the dhis2 group. The user + will have a home directory created in /var/lib/dhis2/<username>. This directory acts as + both the DHIS2_HOME directory and also the CATALINA_BASE directory for the tomcat servlet container. + By default the instance is allocated 2G of heap space RAM. This can be adjusted by + editing the parameters in /var/lib/dhis2/<name>/bin/setenv.sh. + The servlet container is configured to run with an http connector pool of a maximum of + 100 threads. This parameter can be adjusted by editing /var/lib/dhis2/<name>/conf/server.conf. + The servlet container configuration has been specially tweaked for running DHIS2. For + example tomcat filters are used to ensure that all static content from the web application + are cacheable by web proxy servers such as nginx or apache. The lib directory of the + webapp has been explicitly placed in the application classpath so that additional jars + such as java compiled apache camel routes can be made available to the DHIS2 + application. + Note that a dhis2 war file is not deployed by default. See the manual page for + dhis2-deploy-war for instructions to deploy a dhis2 war + file over the internet from the latest stable global build, latest trunk build or from a + user specified war file on the filesystem. + You need to be a member of the dhis2-admin group to + use these and other tools for managing the instance. See the manual page for dhis2-create-admin. OPTIONS @@ -54,7 +78,13 @@ Examples - Create it like this + dhis2-instance-create -p 8080 hmis + Creates a new instance called hmis listening on http port 8080. + + + See also + dhis2-create-admin (1), dhis2-deploy-war (1), dhis2-startup (1), dhis2-shutdown (1), + dhis2-deploy-war (1) and dhis2-log (1). @@ -117,28 +147,52 @@ - dhis2-deploy-stable + dhis2-deploy-war 1 - dhis2-deploy-stable + dhis2-deploy-war Deploys a war file /usr/bin/dhis2-deploy-stable - instance name + + + + instance name - + + + OPTIONS + + + -t + Deploy war from latest trunk build. NOT RECOMMENDED for production systems + + + -l + Deploy war located at a custom url + + + -f + Deploy war from a file on the filesystem + + + + Description - Deploys the latest stable dhis2 war file from http://stable.dhis2.org. + Deploys a dhis2 war file to the instance. The default behaviour when no options are given is to download and deploy the latest stable release from http://stable.dhis2.org. Examples - dhis2-deploy-stable myInstance + dhis2-deploy-war myInstance deploys the latest stable release from dhis2.org into myInstance. + dhis2-deploy-war -f wars/dhis.war myInstance deploys the war file at wars/dhis.war into myInstance. + dhis2-deploy-war -t myInstance deploys the latest trunk build from the dhis2 team integration server into myInstance. Don't use this in production. + dhis2-deploy-war -l http://mywars.org/dhis.war myInstance deploys the war file from a user provided url into myInstance. === removed file 'tools/dhis2-tools-deb/pkg/usr/bin/dhis2-deploy-stable' --- tools/dhis2-tools-deb/pkg/usr/bin/dhis2-deploy-stable 2013-05-28 12:06:12 +0000 +++ tools/dhis2-tools-deb/pkg/usr/bin/dhis2-deploy-stable 1970-01-01 00:00:00 +0000 @@ -1,25 +0,0 @@ -#!/bin/sh -# ____ __ ______________ -# / __ \/ / / / _/ ___/__ \ -# / / / / /_/ // / \__ \__/ / -# / /_/ / __ // / ___/ / __/ -# /_____/_/ /_/___//____/____/ -# -# DHIS2 instance startup script - -set -e - -if [ "$#" -ne 1 ]; then - echo "usage: dhis2-deploy-stable " - exit 1 -fi - -INSTANCE=$1 -DHIS2STABLE="http://stable.dhis2.org" - -dhis2-shutdown $INSTANCE 2>/dev/null || { echo $INSTANCE not running; } -# clean out existing webapps -sudo -u $INSTANCE rm -rf /var/lib/dhis2/$INSTANCE/webapps/* 1>/dev/null 2>&1 || { echo "No $INSTANCE webapps"; exit 1; } -# get the latest stable dhis.war -sudo -u $INSTANCE wget -O /var/lib/dhis2/$INSTANCE/webapps/$INSTANCE.war $DHIS2STABLE -dhis2-startup $INSTANCE === added file 'tools/dhis2-tools-deb/pkg/usr/bin/dhis2-deploy-war' --- tools/dhis2-tools-deb/pkg/usr/bin/dhis2-deploy-war 1970-01-01 00:00:00 +0000 +++ tools/dhis2-tools-deb/pkg/usr/bin/dhis2-deploy-war 2013-05-29 11:52:03 +0000 @@ -0,0 +1,59 @@ +#!/bin/sh +# ____ __ ______________ +# / __ \/ / / / _/ ___/__ \ +# / / / / /_/ // / \__ \__/ / +# / /_/ / __ // / ___/ / __/ +# /_____/_/ /_/___//____/____/ +# +# DHIS2 war deployment + +set -e + +DHIS2STABLE="http://stable.dhis2.org" +DHIS2TRUNK="http://trunk.dhis2.org" +TEMPWAR=/tmp/dhis.war + +SOURCE=$DHIS2STABLE + +# remove any stale temp file +rm -f $TEMPWAR + +while getopts :tl:f: opt; +do + case $opt in + f) + cp $OPTARG $TEMPWAR; + break; + ;; + t) + SOURCE=$DHIS2TRUNK + ;; + l) + SOURCE=$OPTARG + ;; + \?) + echo "Invalid option -$opt" >&2 + exit 1; + ;; + :) + echo "Option -$opt requires an argument." >&2 + exit 1 + esac +done + +shift $(( $OPTIND-1 )) + +INSTANCE=$1 +TARGET=/var/lib/dhis2/$INSTANCE/webapps/$INSTANCE.war + +# download war file if we don't have it +test -f $TEMPWAR || wget -O $TEMPWAR $SOURCE +unzip -tq $TEMPWAR || { echo "Corrupt war file: $TEMPWAR"; exit 1; } + +dhis2-shutdown $INSTANCE 2>/dev/null || { echo $INSTANCE not running; } +# clean out existing webapp +sudo -u $INSTANCE rm -rf /var/lib/dhis2/$INSTANCE/webapps/$INSTANCE 1>/dev/null 2>&1 || { echo "No $INSTANCE webapps"; exit 1; } +sudo -u $INSTANCE cp $TEMPWAR $TARGET + +rm $TEMPWAR || echo "Warning $TEMPWAR not deleted. Please delete manually." +dhis2-startup $INSTANCE === modified file 'tools/dhis2-tools-deb/pkg/usr/bin/dhis2-restoredb' --- tools/dhis2-tools-deb/pkg/usr/bin/dhis2-restoredb 2013-05-28 17:30:32 +0000 +++ tools/dhis2-tools-deb/pkg/usr/bin/dhis2-restoredb 2013-05-29 11:52:03 +0000 @@ -45,4 +45,4 @@ pg_dump -s $DHIS2_DB | grep -i 'owner to' | sed -e "s/OWNER TO .*;/OWNER TO $DHIS2_USER;/i"|psql $DHIS2_DB # restart tomcat -dhis2-startup $INSTANCE +# dhis2-startup $INSTANCE