Changeset 30568


Ignore:
Timestamp:
2016-06-10T22:11:15+12:00 (8 years ago)
Author:
ak19
Message:

All the commits for a distributed GS3 on Windows (no changes made for linux yet). In a distributed GS3, the GS3 is installed in a read-only location and the tomcat runs from the writable TMP area, while the collections go to a writable userweb location specified by the user. (The DVD-only mode still works and is separate.) A problem remains, but exists in the TSG patched version too, and since the current commit breaks nothing, I'm committing it. The user needs to modify 4 properties in build.properties, one of which is new.They need to set using.user.web to true, set web.home to the userweb location, set gsdl3home.isreadonly to true and set gsdl3.writablehome to the tmpdir. The problem is that I can't successfully build the simple html collection if the GS3 installed location is read-only, as the perl code wants to create temporary files in gs2build\tmp which is read-only.

Location:
main/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/gems.bat

    r25678 r30568  
    4444
    4545:checkUserPermissions
     46
     47rem In a distributed GS3 setup like in the labs, we don't require the Greenstone directory to be writable.
     48rem If GS3, get the using.user.web property from build.properties and if set to true, we can skip to shiftElevated
     49:: http://ss64.com/nt/syntax-substring.html
     50    if "%_VERSION%" == "3" if exist "%GSDL3SRCHOME%\build.properties" for /F "tokens=1,2 delims==" %%G in (%GSDL3SRCHOME%\build.properties) do (
     51        if "%%G" == "using.user.web" if "%%H" == "true" goto :shiftElevated
     52    )
     53
    4654    echo.
    4755    echo Checking if the Greenstone collection directory is writable ...
  • main/trunk/gli/gli.bat

    r25939 r30568  
    4848
    4949:checkUserPermissions
     50
     51rem In a distributed GS3 setup like in the labs, we don't require the Greenstone directory to be writable.
     52rem If GS3, get the using.user.web property from build.properties and if set to true, we can skip to shiftElevated
     53:: http://ss64.com/nt/syntax-substring.html
     54    if "%_VERSION%" == "3" if exist "%GSDL3SRCHOME%\build.properties" for /F "tokens=1,2 delims==" %%G in (%GSDL3SRCHOME%\build.properties) do (
     55        if "%%G" == "using.user.web" if "%%H" == "true" goto :shiftElevated
     56    )
    5057    echo.
    5158    echo Checking if the Greenstone collection directory is writable ...
     
    158165:: Run GS3 if version = 3
    159166:rungs3
     167
     168    rem In a distributed GS3 set up like in the labs, gsdl3home.isreadonly would be true and
     169    rem we need to run the web server in read-only mode. This section of code borrowed from gs3-server.bat.
     170    set USE_TMPDIR_FOR_TOMCAT=
     171    for /F "tokens=1,2 delims==" %%G in (%GSDL3SRCHOME%\build.properties) do (
     172        if "%%G"=="gsdl3home.isreadonly" set USE_TMPDIR_FOR_TOMCAT=%%H
     173    )   
     174    if "%USE_TMPDIR_FOR_TOMCAT%" == "true" (
     175        set gsdl3_writablehome=%TMP%\greenstone\web
     176        set opt_properties="-Dgsdl3home.isreadonly=true" -Dgsdl3.writablehome="%gsdl3_writablehome%"
     177        echo Setting Greenstone3 web home writable area to be: %gsdl3_writablehome%
     178        pushd %GSDL3SRCHOME%
     179        cmd /c ant.bat %opt_properties% configure-web
     180        popd
     181    )
     182   
    160183    if "%_VERSION%" == "3" "%JAVA_EXECUTABLE%" -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar;lib/rsyntaxtextarea.jar org.greenstone.gatherer.GathererProg -gsdl "%GSDLHOME%" -gsdlos %GSDLOS% -gsdl3 "%GSDL3HOME%" -gsdl3src "%GSDL3SRCHOME%" -perl "%PERLPATH%" %1 %2 %3 %4 %5 %6 %7 %8 %9
    161184    if ERRORLEVEL 2 (
  • main/trunk/greenstone3/build.properties.in

    r29977 r30568  
    1515# uncomment the following if you have moved the greenstone3 web directory to tomcats webapps dir
    1616#web.home=${tomcat.installed.path}/webapps/greenstone3
     17
     18## If creating a distributed GS3 set up, with GS3 in a read-only location, then it will need a
     19## distinct user web folder for content (sites and collections), and need to run tomcat from TMP.
     20## You need to configure 4 properties to get a distributed GS3 to work on windows:
     21## - set web.home above to the writable location where collections and sites should be created (use forward slashes)
     22## - uncomment using.user.web below and set to true,
     23## To make tomcat run from TMP folder (a writable location):
     24## - set gsdl3home.isreadonly to true and
     25## - set gsdl3.writablehome to ${java.io.tmpdir}/greenstone/web (use forward slashes)
     26# using.user.web=true
    1727
    1828# Default derby networked server portnumber is 1527, can change this here in case of conflict
  • main/trunk/greenstone3/build.xml

    r30304 r30568  
    169169  <property name="web.home" value="${basedir}/web"/>
    170170  <property name="web.writablehome" value="${gsdl3.writablehome}"/>
    171 
     171  <!-- If using a distributed GS3, then the user web would not contain everything in the default GS3 web
     172  (it won't contain a CGI or lib folder inside WEB-INF, for instance) -->
     173  <if>
     174    <bool><available file="${web.home}/WEB-INF/cgi" type="dir"/></bool>
     175    <property name="full.web.dir" value="${web.home}"/>
     176    <else>
     177        <property name="full.web.dir" value="${basedir}/web"/>
     178    </else>
     179  </if> 
     180 
    172181  <!-- jar files needed by applets go here -->
    173182  <property name="web.applet" value="${web.home}/applet"/>
    174 
     183 
    175184  <!-- jar files needed by the servlet (and extra ones) go here -->
    176185  <property name="web.lib" value="${web.home}/WEB-INF/lib"/>
     
    235244        preservelastmodified="true"
    236245        failonerror="true" > 
    237     <fileset dir="${web.home}/WEB-INF" includes="**"/> 
     246    <fileset dir="${full.web.dir}/WEB-INF" includes="**"/> 
    238247      </copy>
    239248
     
    631640 
    632641  <path id="derby.server.classpath">
    633     <pathelement location="${web.lib}/derbynet.jar"/>
    634     <pathelement location="${web.lib}/derby.jar"/>
     642    <pathelement location="${web.writablelib}/derbynet.jar"/>
     643    <pathelement location="${web.writablelib}/derby.jar"/>
    635644  </path>
    636645
     
    12721281    <bool><not><equals arg1="${web.home}" arg2="${web.writablehome}"></equals></not></bool>
    12731282    <mkdir dir="${web.writablehome}"/>
    1274     <copy file="${web.home}/WEB-INF/cgi/gliserver.pl"       tofile="${web.writablehome}/WEB-INF/cgi/gliserver.pl"       overwrite="true"/>
    1275     <copy file="${web.home}/WEB-INF/cgi/metadata-server.pl" tofile="${web.writablehome}/WEB-INF/cgi/metadata-server.pl" overwrite="true"/>
    1276     <copy file="${web.home}/WEB-INF/cgi/checksum.pl"        tofile="${web.writablehome}/WEB-INF/cgi/checksum.pl"        overwrite="true"/>
     1283    <copy file="${full.web.dir}/WEB-INF/cgi/gliserver.pl"       tofile="${web.writablehome}/WEB-INF/cgi/gliserver.pl"       overwrite="true"/>
     1284    <copy file="${full.web.dir}/WEB-INF/cgi/metadata-server.pl" tofile="${web.writablehome}/WEB-INF/cgi/metadata-server.pl" overwrite="true"/>
     1285    <copy file="${full.web.dir}/WEB-INF/cgi/checksum.pl"        tofile="${web.writablehome}/WEB-INF/cgi/checksum.pl"        overwrite="true"/>
    12771286      </if>
    12781287
  • main/trunk/greenstone3/gs3-server.bat

    r27903 r30568  
    1616if "%GSDL3SRCHOME%" == "" call "%GSDL3PATH%\gs3-setup.bat" SetEnv > nul
    1717
     18set USE_TMPDIR_FOR_TOMCAT=
     19for /F "tokens=1,2 delims==" %%G in (%GSDL3SRCHOME%\build.properties) do (
     20    if "%%G"=="gsdl3home.isreadonly" set USE_TMPDIR_FOR_TOMCAT=%%H
     21)
    1822
     23:: If the gsdl3.home readonly property is not already set to true, then
    1924:: See if Greenstone3 web folder is writable
     25if "%USE_TMPDIR_FOR_TOMCAT%" == "false" (
    2026  echo.
    2127  echo Checking if the Greenstone3 web directory is writable ...
    2228  (echo This is a temporary file. It is safe to delete it. > "%GSDL3HOME%\testing.tmp" ) 2>nul
    2329  if exist "%GSDL3HOME%\testing.tmp" goto isWritable
     30)
    2431
    2532:: Is read-only
    2633  set gsdl3_writablehome=%TMP%\greenstone\web
    2734  set opt_properties="-Dgsdl3home.isreadonly=true" -Dgsdl3.writablehome="%gsdl3_writablehome%"
    28   echo ... no.
     35  if "%USE_TMPDIR_FOR_TOMCAT%" == "false" echo ... no.
    2936  echo Setting Greenstone3 web home writable area to be: %gsdl3_writablehome%
    3037
  • main/trunk/greenstone3/gs3-setup.bat

    r27832 r30568  
    3636:: set GSDL3HOME to the 'web' subdirectory
    3737set GSDL3HOME=!GSDL3SRCHOME!\web
     38set TOMCATWEB=!GSDL3SRCHOME!\web
     39:: set GSDL3HOME to any web.home property provided, and create that folder if it doesn't exist
     40:: Replace forward slashes in web.home with back slashes
     41:: http://scripts.dragon-it.co.uk/scripts.nsf/docs/batch-search-replace-substitute!OpenDocument&ExpandSection=3&BaseTarget=East&AutoFramed
     42if exist "!GSDL3SRCHOME!\build.properties" for /F "tokens=1,2 delims==" %%G in (!GSDL3SRCHOME!\build.properties) do (
     43    if "%%G"=="web.home" (
     44        set GSDL3HOME=%%H
     45        set GSDL3HOME=!GSDL3HOME:/=\!
     46        set TOMCATWEB=!GSDL3HOME!
     47        if not exist "!GSDL3HOME!" cmd /c "!GSDL3SRCHOME!\userweb.cmd"
     48    )
     49)
     50
     51:: Whatever the web directory is, it should contain the WEB-INF\classes folder, else go back to using default for this
     52:: The WEB-INF\classes folder will be absent in a userweb folder, but will be present if GSDL3HOME=GSDL3SRCHOME\web
     53:: or if web.home points to GS3 as a webapp inside tomcat
     54if not exist "!GSDL3HOME!\WEB-INF\classes" set TOMCATWEB=!GSDL3SRCHOME!\web
    3855
    3956:: change if using external tomcat or ant
     
    4663:: ---- Set the CLASSPATH and PATH environment variables ----
    4764if "!GS_CP_SET!" == "yes" goto skipSetCp
    48 set CLASSPATH=!GSDL3HOME!\WEB-INF\classes;!GSDL3SRCHOME!\resources\java;!GSDL3SRCHOME!\cp.jar;!CLASSPATH!;
     65set CLASSPATH=!TOMCATWEB!\WEB-INF\classes;!GSDL3SRCHOME!\resources\java;!GSDL3SRCHOME!\cp.jar;!CLASSPATH!;
    4966set PATH=!GSDL3SRCHOME!\bin;!GSDL3SRCHOME!\bin\script;!GSDL3SRCHOME!\lib\jni;!ANT_HOME!\bin;!PATH!
    5067
Note: See TracChangeset for help on using the changeset viewer.