Changeset 32432 for gs3-extensions

Show
Ignore:
Timestamp:
07.09.2018 19:39:40 (13 months ago)
Author:
ak19
Message:

1. Since there's a chance that 127.0.0.1 isn't always the loopback address or may not always work, we allow this to be specified by the new property localhost.server.http in build.properties. Updating recently commited code that is affected by this and where I had been hardcoding 127.0.0.1. 2. Fixing up the port and now the server host name used by the solr extension: these should be the correct property names, which are localhost.port.http and the new localhost.server.http instead of tomcat.server and the default port for the default protocol, since all GS3 internal communications with solr are done through the local HTTP url, whatever the public URL (with default protocol, matching port and server name) might be. I also updated the get-solr-servlet-url target in build.xml to use the local http base URL (see point 3), so that solr building will work correctly. 3. build.xml now has 2 new targets, one to get the local http base URL and one to get the local http default servlet URL. Both also use the new localhost.server.http property, besides the recently introduced localhost.port.http property. 4. Now the default behaviour of util.pm::get_full_greenstone_url_prefix() is to call the new get-local-http-servlet-url ant target, since only activate.pl's servercontrol.pm helper module uses it. If you want util.pm::get_full_greenstone_url_prefix() to return the non-local (public) servlet URL, pass in 1 (true) for the new 3rd parameter. The important decision here is that activate will use the internal (i.e. local http) greenstone servlet URL to issue pinging and (de)activating commands, since localhost (specifically 127.0.0.1) over http is now always available and because a domain named server over https will create complications to do with certification checks by wget, when wget gets run by activate.pl. Alternatively, activate.pl/servercontrol.pm could run wget with the no-cert-checking flag or we could make wget check the GS3 https certificate if one exists. But all that is convoluted and unnecessary: we've so far always worked with http, and usually with localhost over the httpport, and activate.pl so far has worked well with this, so have some confidence that using the local http URL internally should still work, even if the default GS3 URL has been set up to be a public (https) URL.

Location:
gs3-extensions/solr/trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/gs3-setup.bat

    r31755 r32432  
    1212:: sets the SOLR_PORT and SOLR_HOST to the values of tomcat.port and tomcat.host properties 
    1313 
    14 set SOLR_PORT=8983 
    15 set SOLR_HOST=localhost 
     14set SOLR_PORT=8383 
     15set SOLR_HOST=127.0.0.1 
    1616 
    1717setlocal enabledelayedexpansion 
    1818set FOUNDPROPS= 
     19:: The Solr servlet should only be locally accessible, thus restricting the protocol to http as 
     20:: https certificates can't be issued for localhost/127.0.0.1 (https://letsencrypt.org/docs/certificates-for-localhost/) 
     21:: This means we use the properties localhost.server.http (defaults to 127.0.0.1) and localhost.port.http  
     22:: to construct the solr servlet url, rather than properties tomcat.server and tomcat.port.https 
    1923:: Loosely based on  
    2024:: http://stackoverflow.com/questions/7708681/how-to-read-from-a-properties-file-using-batch-script  
     
    2428:: for alternative suggestions useful in other instances 
    2529FOR /F "usebackq tokens=1,2 delims==" %%G IN ("%GSDL3SRCHOME%\build.properties") DO (  
    26     if "%%G"=="tomcat.server" set SOLR_HOST=%%H& set FOUNDPROPS=!FOUNDPROPS!found 
    27     if "%%G"=="tomcat.port" set SOLR_PORT=%%H& set FOUNDPROPS=!FOUNDPROPS!found 
     30    if "%%G"=="localhost.server.http" set SOLR_HOST=%%H& set FOUNDPROPS=!FOUNDPROPS!found 
     31    if "%%G"=="localhost.port.http" set SOLR_PORT=%%H& set FOUNDPROPS=!FOUNDPROPS!found 
    2832    :: break out of the loop as soon as both properties are found 
    2933    if "!FOUNDPROPS!" == "foundfound" goto foundall 
  • gs3-extensions/solr/trunk/src/gs3-setup.sh

    r31138 r32432  
    1515# The following sets the field separator IFS to the = sign, then reads the file line by  
    1616# line, setting propname and propval (which are fields separated by '=') for each line read 
    17 SOLR_PORT=8983 
    18 SOLR_HOST=localhost 
     17SOLR_PORT=8383 
     18SOLR_HOST=127.0.0.1 
    1919file=$GSDL3SRCHOME/build.properties 
     20# The Solr servlet should only be locally accessible, thus restricting the protocol to http as 
     21# https certificates can't be issued for localhost/127.0.0.1 (https://letsencrypt.org/docs/certificates-for-localhost/) 
     22# This means we use the properties localhost.server.http (defaults to 127.0.0.1) and localhost.port.http  
     23# to construct the solr servlet url, rather than properties tomcat.server and tomcat.port.https 
    2024while IFS== read propname propval; do 
    21     if [ "x$propname" = "xtomcat.server" ] ; then 
     25    if [ "x$propname" = "xlocalhost.server.http" ] ; then 
    2226    SOLR_HOST=$propval 
    2327    fi 
    24     if [ "x$propname" = "xtomcat.port" ] ; then 
     28    if [ "x$propname" = "xlocalhost.port.http" ] ; then 
    2529    SOLR_PORT=$propval 
    2630    fi