Changeset 30568

2016-06-10T22:11:15+12:00 (7 years ago)

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, 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.

1 added
6 edited


  • main/trunk/gli/gems.bat

    r25678 r30568  
     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 and if set to true, we can skip to shiftElevated
     50    if "%_VERSION%" == "3" if exist "%GSDL3SRCHOME%\" for /F "tokens=1,2 delims==" %%G in (%GSDL3SRCHOME%\ do (
     51        if "%%G" == "using.user.web" if "%%H" == "true" goto :shiftElevated
     52    )
    4654    echo.
    4755    echo Checking if the Greenstone collection directory is writable ...
  • main/trunk/gli/gli.bat

    r25939 r30568  
     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 and if set to true, we can skip to shiftElevated
     54    if "%_VERSION%" == "3" if exist "%GSDL3SRCHOME%\" for /F "tokens=1,2 delims==" %%G in (%GSDL3SRCHOME%\ 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
     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%\ 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    )
    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/

    r29977 r30568  
    1515# uncomment the following if you have moved the greenstone3 web directory to tomcats webapps dir
     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 ${}/greenstone/web (use forward slashes)
     26# using.user.web=true
    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  <!-- 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> 
    172181  <!-- jar files needed by applets go here -->
    173182  <property name="web.applet" value="${web.home}/applet"/>
    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>
    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>
    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/"       tofile="${web.writablehome}/WEB-INF/cgi/"       overwrite="true"/>
    1275     <copy file="${web.home}/WEB-INF/cgi/" tofile="${web.writablehome}/WEB-INF/cgi/" overwrite="true"/>
    1276     <copy file="${web.home}/WEB-INF/cgi/"        tofile="${web.writablehome}/WEB-INF/cgi/"        overwrite="true"/>
     1283    <copy file="${full.web.dir}/WEB-INF/cgi/"       tofile="${web.writablehome}/WEB-INF/cgi/"       overwrite="true"/>
     1284    <copy file="${full.web.dir}/WEB-INF/cgi/" tofile="${web.writablehome}/WEB-INF/cgi/" overwrite="true"/>
     1285    <copy file="${full.web.dir}/WEB-INF/cgi/"        tofile="${web.writablehome}/WEB-INF/cgi/"        overwrite="true"/>
    12771286      </if>
  • main/trunk/greenstone3/gs3-server.bat

    r27903 r30568  
    1616if "%GSDL3SRCHOME%" == "" call "%GSDL3PATH%\gs3-setup.bat" SetEnv > nul
     19for /F "tokens=1,2 delims==" %%G in (%GSDL3SRCHOME%\ do (
     20    if "%%G"=="gsdl3home.isreadonly" set USE_TMPDIR_FOR_TOMCAT=%%H
     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
    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%
  • main/trunk/greenstone3/gs3-setup.bat

    r27832 r30568  
    3636:: set GSDL3HOME to the 'web' subdirectory
    3737set GSDL3HOME=!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
     42if exist "!GSDL3SRCHOME!\" for /F "tokens=1,2 delims==" %%G in (!GSDL3SRCHOME!\ 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    )
     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
    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!
Note: See TracChangeset for help on using the changeset viewer.