=== renamed directory 'dhis2-live-installer' => 'installers' === modified file 'installers/INSTALLER-README.txt' --- dhis2-live-installer/INSTALLER-README.txt 2010-09-18 21:17:38 +0000 +++ installers/INSTALLER-README.txt 2011-03-10 14:37:48 +0000 @@ -3,22 +3,16 @@ to a desktop computer. The installer, along with the build script should build a complete DHIS2 system ready for deployment from source. -Other installers for other types of implementations may be -added in the future, but for the moment, the installer will create a Windows EXE -installer that will ship with the H2 database. - -There are two installers here. The first and most up to date is the BitRock installer. -Along with the build script included with this package, it will build a Windows -executable. The second installer is based on IZPack and may be more appropriate -for those that need a relatively simply build process, without having Maven installed. -It is recommended to use the BitRock installer, but I have included both here. - - BitRock installer notes -You should be able to execute the build script from essentially anywhere on your system. + The most up to date is the BitRock installer. +The current install will build a Windows +executable which will offer an install of Postgresql, Java, and a template DHIS2 database. The source of the current installer +can be found in the file named DHIS2_pginstaller. A few alternative installer +flavors are described at the end of this document. + It is critical that you set all of the environment variables to the correct paths in your system. -Modify the environment variables in the build.sh script to suit your needs. +Modify the environment variables in the build.sh (on Linux) or build.bat (on Windows) script to suit your needs. There are several variables that you will need to set. @@ -31,30 +25,42 @@ PATH=$PATH:/home/wheel/apache-maven-2.2.1/bin/ 3) This variable is necessary during the installer build process and should point to your local copy of the -BitRock install builder directory. You can get a copy of BitRock install builder from here -http://installbuilder.bitrock.com/download-step-2.html. Install it somewhere on your system and +BitRock install builder executable. You can get a copy of BitRock install builder from here +http://installbuilder.bitrock.com/download-step-2.html. + + Install it somewhere on your system and point the environment variable to the correct directory. - BITROCK_HOME=/home/wheel/installbuilder-6.2.7/ - -4) This variable should point to the directory where the birt.war file resides. If not set BIRT will be omitted. - BIRT_WAR="/usr/local/apache-tomcat-6.0.18/webapps/" - + Example on Linux + + BITROCK_HOME=/home/wheel/installbuilder-6.2.7/bin/builder + Example On Windows + + BITROCK_HOME="c:\Program Files\BitRock InstallBuilder Professional 6.5.6\bin\builder-cli.exe" + 5) This variable should point to the root directory of the source of the documentation branch. + DHIS2_DOCS="/home/wheel/workspace/dhis2-docbook-docs/" + DHIS2_DOCS=c:\dhis2\dhis2-docbook-docs + 6) This variable should point to your copy of the dhis2 main source branch. + + On Linux + DHIS2_SRC="/home/wheel/workspace/dhis2" - + On Windows + DHIS2_SRC=c:\dhis2 + My directory structure looks something like this.. /workspace -|_dhis2 -|_dhis2-docbook-docs -|_dhis2-live-installer +|_dhis-2 (contains the DHIS 2 source code) +|_dhis2-docbook-docs (contains the DHIS2 documentation source) +|_dhis2-live-installer (contains the Installer source) +|_dhis-live (contains the DHIS Live source) To get started just execute, just go to the dhis2-live-installer directory and execute the build.sh script if you are on Linux (be sure it is executable) -or the build.bat script if you are using Windows. There are several options you will need to pass to the build script. @@ -64,7 +70,10 @@ ./build.sh dhis2 Build only DHIS2. ./build.sh live Build only the DHIS2 Live wrapper. -There are a number of different installers that will be generated for different purposes. + + + +There are a number of other installers that will be generated for different purposes. 1)DHIS2 Windows Live @@ -79,13 +88,12 @@ Note that JRE is referring to the extracted collection of files, not the Windows executable installer. One way to obtain this is to install JRE on Windows and copy the extracted JRE directory into this project. -o Firefix browser. Place a copy of Firefox Portable in /resources/browser/FirefoxPortable. Note that Firefox portable is referring +o Firefox browser. Place a copy of Firefox Portable in /resources/browser/FirefoxPortable. Note that Firefox portable is referring to the extracted collection of files, not the Windows executable installer. One way to obtain this is to install Firefox portable on Windows and copy the extracted FirefoxPortable directory into this project. o Demo database. Place a copy of the H2 demo database (called "demo.h2.db") into resources/demodb. - You will now enter into a rather lengthy process depending on the speed of your machine. At the end you will have a Windows installer based on the latest source code and @@ -93,7 +101,12 @@ directory. -IZPack Installer +IZPack Installer + + +The second installer is based on IZPack and may be more appropriate +for those that need a relatively simply build process, without having Maven installed. +It is recommended to use the BitRock installer as the IZPack installer is no longer maintained. Basically, you will need to populate some different directories with prerequisites. === modified file 'installers/pom.xml' --- dhis2-live-installer/pom.xml 2011-01-23 00:12:53 +0000 +++ installers/pom.xml 2011-03-10 14:37:48 +0000 @@ -7,8 +7,6 @@ This project will build a set of installers for DHIS2. pom http://dhis2.com - - @@ -16,66 +14,21 @@ exec-maven-plugin 1.1 - - - DHIS2 Windows Embedded JRE - package - - ${env.BITROCK_HOME}/bin/builder - - build - ${basedir}/src/bitrock/DHIS2_live_embedded_en.xml - windows - - - - exec - - - + + DHIS 2 Postgresql Windows Installer + package + + ${env.BITROCK_HOME} + + build + ${basedir}/src/bitrock/DHIS2_pginstaller.xml + windows + + + + exec + + === modified file 'installers/resources/conf/hibernate.properties' --- dhis2-live-installer/resources/conf/hibernate.properties 2011-03-06 09:31:18 +0000 +++ installers/resources/conf/hibernate.properties 2011-03-10 14:37:48 +0000 @@ -10,7 +10,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect hibernate.connection.driver_class = org.postgresql.Driver -hibernate.connection.url = jdbc:postgresql:dhis2db +hibernate.connection.url = jdbc:postgresql:DHIS2DBNAME hibernate.connection.username = dhis2 hibernate.connection.password = dhis2 === modified file 'installers/resources/postgres/restore_db.bat' --- dhis2-live-installer/resources/postgres/restore_db.bat 2011-03-06 09:31:18 +0000 +++ installers/resources/postgres/restore_db.bat 2011-03-10 14:37:48 +0000 @@ -1,4 +1,4 @@ SET PGPASSWORD=PG_PASSWORD "c:\Program Files\PostgreSQL\9.0\bin\psql.exe" -c "CREATE USER dhis2 CREATEDB LOGIN PASSWORD 'dhis2';" -U postgres -w postgres -"c:\Program Files\Postgresql\9.0\bin\createdb.exe" -U postgres -w -O dhis2 dhis2db -"c:\Program Files\Postgresql\9.0\bin\pg_restore" -U postgres -w -d dhis2db dhis2db.backup \ No newline at end of file +"c:\Program Files\Postgresql\9.0\bin\createdb.exe" -U postgres -w -O dhis2 DHIS2DBNAME +"c:\Program Files\Postgresql\9.0\bin\pg_restore" -U postgres -w -d DHIS2DBNAME dhis2db.backup === modified file 'installers/src/bitrock/DHIS2_pginstaller.xml' --- dhis2-live-installer/src/bitrock/DHIS2_pginstaller.xml 2011-03-06 10:06:56 +0000 +++ installers/src/bitrock/DHIS2_pginstaller.xml 2011-03-10 14:37:48 +0000 @@ -223,6 +223,16 @@ 20 + + dbname + Please enter the name of the DHIS2 database. + + + + dhis2db + 0 + 40 + @@ -240,6 +250,20 @@ PG_PASSWORD ${pg_password} + + DHIS2DBNAME + ${dbname} + + + + + ${installdir}\conf\hibernate.properties + regexp + + + DHIS2DBNAME + ${dbname} + @@ -282,7 +306,6 @@ 1 - New Folder ${installdir}\tmp\ newfolder windows === added directory 'installers/src/nsis' === added file 'installers/src/nsis/dhis.nsi' --- installers/src/nsis/dhis.nsi 1970-01-01 00:00:00 +0000 +++ installers/src/nsis/dhis.nsi 2011-03-10 14:37:48 +0000 @@ -0,0 +1,327 @@ +!define AppName "DHIS2" +!define AppVersion "2.2.0" +!define ShortName "DHIS2" +!define Vendor "HISP" + + +; JDK defines +!define JDK_INSTALLER "jdk-6u24-windows-i586.exe" +!define JDK_VERSION "1.7.21" + +;MySQL defines +!define MYSQL_INSTALLER "mysql-5.5.9-win32.msi" +!define MYSQL_VERSION "5.5.9" +!define MYSQL_PORT "3306" +!define MYSQL_SERVICE_NAME "MYSQL55" +!define MYSQL_SCHEMA_NAME "dhis" +!define MYSQL_USER "root" +!define MYSQL_PASS "root" +!define MYSQL_DUMP_FILE "dump.sql" +!define MYSQL_HOST "localhost" + +;Tomcat defines +!define TOMCAT_INSTALLER "apache-tomcat-6.0.32.exe" +!define TOMCAT_VERSION "6.0.21" + +;DHIS war and hibernate defines +!define HIBERNATE_FILE "hibernate.properties" +!define WAR "dhis.war" + +;Browser (Chrome) defines +!define BROWSER_INSTALLER "ChromeStandaloneSetup.exe" + +; Include files +!include "LogicLib.nsh" +!include "nsDialogs.nsh" +!include "TextFunc.nsh" +!include "WordFunc.nsh" +;!include "EnvVarUpdate.nsh" + +!insertmacro ConfigWrite +!insertmacro ConfigRead + + +; Needed Variables + +VAR JAVAINST ; To test if JDK should be installed + +!insertmacro VersionCompare + +;-------------------------------- +;Include Modern UI + +!include "MUI2.nsh" + +;-------------------------------- +;General + + ;Name and file + Name "DHIS All in One Installer" + OutFile "DHIS2 Installer.exe" + + ;Default installation folder + InstallDir "$LOCALAPPDATA\DHIS2" + + ;Get installation folder from registry if available + InstallDirRegKey HKCU "Software\DHIS2" "" + + ;Request application privileges for Windows Vista + ;RequestExecutionLevel Admin + +;-------------------------------- +;Interface Settings + + !define MUI_ABORTWARNING + +;-------------------------------- +;Pages + + !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" + !insertmacro MUI_PAGE_COMPONENTS + Page custom CheckInstalledJRE + ; Define headers for the 'Java installation successfully' page + !define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Java installation complete" + !define MUI_PAGE_HEADER_TEXT "Installing JDK" + !define MUI_PAGE_HEADER_SUBTEXT "Please wait while we install the JDK" + !define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "JDK installed successfully." + !insertmacro MUI_PAGE_DIRECTORY + !insertmacro MUI_PAGE_INSTFILES + !define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "JDK Installation complete" + !define MUI_PAGE_HEADER_TEXT "Installing" + !define MUI_PAGE_HEADER_SUBTEXT "Please wait while Tomcat Web Server is being installed." + + !insertmacro MUI_PAGE_FINISH + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + +;-------------------------------- +;Languages + !insertmacro MUI_LANGUAGE "English" + +;-------------------------------- +;Installer Sections + +Section "Java Development Kit" jdk +SectionIn 1 RO ; Full install, cannot be unselected + SetOutPath "$INSTDIR" + SetOverwrite ifnewer + + ${if} $JAVAINST == "yes" +DetailPrint "Starting JDK installation" +Goto InstJDK + ${else} + DetailPrint "Skipping JDK installation" + Goto JavaHomeNo + ${endif} + +InstJDK: + File "Tools\${JDK_INSTALLER}" + ExecWait '"$INSTDIR\${JDK_INSTALLER}" /s /log jdk_logs.txt' + Delete "$INSTDIR\${JDK_INSTALLER}" + + ReadRegStr $7 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion" +MessageBox MB_OK "Installed JDK Version : $7" + ReadRegStr $8 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$7" "JavaHome" +MessageBox MB_OK "Installed JDK Path : $8" + + + Goto SetEnvers + +SetEnvers: + + JavaHomeNo: + + +SectionEnd + +Section "MySQL Windows service" mysql +SectionIn 1 RO ; Full install, cannot be unselected + SetOutPath "$INSTDIR" + SetOverwrite ifnewer + + File "Tools\${MYSQL_INSTALLER}" +ExecWait 'msiexec.exe /i "$INSTDIR\${MYSQL_INSTALLER}" /qn INSTALLDIR="$INSTDIR\MySQL\" /L* "$INSTDIR\MSI-MySQL-Log.txt"' + + Delete "$INSTDIR\${MYSQL_INSTALLER}" + + ReadRegStr $7 HKLM "SOFTWARE\MySQL AB\MySQL Server 5.5" "Version" +MessageBox MB_OK "Installed MySQL Version : $7" + ReadRegStr $8 HKLM "SOFTWARE\MySQL AB\MySQL Server 5.5" "Location" +MessageBox MB_OK "Installed MySQL Path : $8" + + +ExecWait '$8bin\MySQLInstanceConfig.exe -i -q "-l$INSTDIR\MSI-MySQL-Log.txt" "-nMySQL Server 5.5" "-p$8" -v${MYSQL_VERSION}"-t$8my-template.ini" "-c$8my.ini" ServerType=SERVER DatabaseType=MIXED ConnectionUsage=DSS Port=${MYSQL_PORT} ServiceName=${MYSQL_SERVICE_NAME} RootPassword=${MYSQL_PASS}' +MessageBox MB_OK "Successfully Configured MySQL Instance" +ExecWait '$8bin\mysqlslap --silent --delimiter=";" --user=${MYSQL_USER} --password=${MYSQL_PASS} --engine=innodb --create="CREATE TABLE a (b int);INSERT INTO a VALUES (23)" --query="SELECT * FROM a" --concurrency=1 --iterations=1 --query="DROP TABLE a"' +MessageBox MB_OK "MySQL Instance Successfully Passed Tests." + +ExecWait '$8bin\mysql --silent -u${MYSQL_USER} -p${MYSQL_PASS} -e "CREATE SCHEMA ${MYSQL_SCHEMA_NAME}"' +MessageBox MB_OK "${MYSQL_SCHEMA_NAME} SCHEMA Created Successfully" + + File "dhis\${MYSQL_DUMP_FILE}" +ReadEnvStr $R0 COMSPEC + +Exec '"$R0" /C $8bin\mysql --silent --wait --reconnect --user=${MYSQL_USER} --password=${MYSQL_PASS} --host=${MYSQL_HOST} --database=${MYSQL_SCHEMA_NAME} < "$INSTDIR\${MYSQL_DUMP_FILE}"' + Delete "$INSTDIR\${MYSQL_DUMP_FILE}" +MessageBox MB_OK "${MYSQL_SCHEMA_NAME} SCHEMA Tables Created Successfully" + +SectionEnd + + +Section "Tomcat 6 Windows service and ${AppName}" tomcat +SectionIn 1 RO ; Full install, cannot be unselected + SetOutPath "$INSTDIR" + SetOverwrite ifnewer + + File "Tools\${TOMCAT_INSTALLER}" + ExecWait '"$INSTDIR\${TOMCAT_INSTALLER}" /S /D=$INSTDIR\tomcat6\' + Delete "$INSTDIR\${TOMCAT_INSTALLER}" + + WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "DHIS2_HOME" $INSTDIR + ; ... and for this context + System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("DHIS2_HOME", "$INSTDIR").r0' + + File "dhis\${HIBERNATE_FILE}" + + SetOutPath "$INSTDIR\tomcat6\webapps\" + SetOverwrite ifnewer + + File "dhis\${WAR}" + + ExecWait '"$INSTDIR\tomcat6\bin\tomcat6.exe" //IS//Tomcat6 --DisplayName="Apache Tomcat 6 for DHIS" --Install="$INSTDIR\tomcat6\bin\tomcat6.exe" --Startup=auto --Jvm=auto --StartMode=jvm --StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop' + + SetOutPath "$INSTDIR" + SetOverwrite ifnewer + + File "Tools\${BROWSER_INSTALLER}" + +ExecWait '"$INSTDIR\${BROWSER_INSTALLER}" /S --system-level' +;--do-not-launch-chrome + + Delete "$INSTDIR\${BROWSER_INSTALLER}" + + +SectionEnd + +;dhis +Section "Installation of ${AppName}" SecAppFiles +SectionIn 1 RO ; Full install, cannot be unselected + SetOutPath "$INSTDIR" + + ;ADD YOUR OWN FILES HERE... + + ;Store installation folder + WriteRegStr HKCU "Software\DHIS" "" $INSTDIR + + ;Create uninstaller + WriteUninstaller "$INSTDIR\Uninstall.exe" +SectionEnd + +Section "Start menu shortcuts" SecCreateShortcut + SectionIn 1 ; Can be unselected + CreateDirectory "$SMPROGRAMS\${AppName}" + CreateShortCut "$SMPROGRAMS\${AppName}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 +; Etc +SectionEnd + +;-------------------------------- +;Descriptions + + ;Language strings + LangString DESC_SecDummy ${LANG_ENGLISH} "A test section." + + ;Assign language strings to sections + !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SecAppFiles} $(DESC_SecDummy) + !insertmacro MUI_FUNCTION_DESCRIPTION_END + +;-------------------------------- +;Uninstaller Section + +Section "Uninstall" + + Delete "$INSTDIR\Uninstall.exe" + + RMDir "$INSTDIR" + + DeleteRegKey /ifempty HKCU "Software\DHIS2" + +SectionEnd + +Function SetupSections + !insertmacro SelectSection ${jdk} + !insertmacro SelectSection ${tomcat} + !insertmacro SelectSection ${SecAppFiles} + !insertmacro SelectSection ${SecCreateShortcut} +FunctionEnd + +Function CheckInstalledJRE +; MessageBox MB_OK "Checking Installed JRE Version" + Push "${JDK_VERSION}" + Exch $0 ; Get version requested + + ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion" + ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome" + +${If} $1 != '' +; MessageBox MB_OK "Detected JDK version is : $1" +; MessageBox MB_OK "Detected JDK Path is : $2" + Goto CompareMajorVersion +${ElseIf} $2 != '' +; MessageBox MB_OK "Detected JDK Path is : $2" +${Else} +; MessageBox MB_OK 'No Installed JDK found' + Goto InstallJDK +${EndIf} + +CompareMajorVersion: + + StrCpy $3 $0 1 + StrCpy $4 $1 1 + +${If} $4 = $3 +; MessageBox MB_OK "Need $3 , found $4" + Goto CompareMinorVersion +${ElseIf} $4 > $3 +; MessageBox MB_OK " $3 is less than $4" + Goto DontInstallJDK +${Else} +; MessageBox MB_OK "$3 more than $4" + Goto InstallJDK +${EndIf} + + +CompareMinorVersion: + + StrCpy $5 $0 1 2 + StrCpy $6 $1 1 2 +; MessageBox MB_OK "Need $5 , found $6" + +${If} $5 = $6 +; MessageBox MB_OK "Need $5 , found $6" + Goto DontInstallJDK +${ElseIf} $6 > $5 +; MessageBox MB_OK " $5 is less than $6" + Goto DontInstallJDK +${Else} +; MessageBox MB_OK "$5 more than $6" + Goto InstallJDK +${EndIf} + + +InstallJDK: +; Messagebox MB_OK "Done checking JRE version, reccomend install" +StrCpy $JAVAINST 'yes' +Goto End + +DontInstallJDK: +; Messagebox MB_OK "Done checking JRE version, reccomend cancel" +StrCpy $JAVAINST 'no' + +End: +; Messagebox MB_OK "Done checking JRE version" +FunctionEnd + +Function .onInit + Call SetupSections +FunctionEnd