source: gs3-extensions/solr/trunk/src/gs3-setup.sh@ 35163

Last change on this file since 35163 was 32432, checked in by ak19, 6 years ago
  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.
File size: 2.9 KB
Line 
1
2extdesc="the Solr Extension"
3
4full_setup=`pwd`/${BASH_SOURCE}
5fulldir=${full_setup%/*}
6fulldir=${fulldir%/.}
7
8#--
9# Edit the following two port values if they conflict with
10# with existing services on your computer
11#--
12
13# If using tomcat, read the tomcat host and port from the toplevel GS3 build.properties
14# http://en.kioskea.net/faq/1757-how-to-read-a-file-line-by-line
15# The following sets the field separator IFS to the = sign, then reads the file line by
16# line, setting propname and propval (which are fields separated by '=') for each line read
17SOLR_PORT=8383
18SOLR_HOST=127.0.0.1
19file=$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
24while IFS== read propname propval; do
25 if [ "x$propname" = "xlocalhost.server.http" ] ; then
26 SOLR_HOST=$propval
27 fi
28 if [ "x$propname" = "xlocalhost.port.http" ] ; then
29 SOLR_PORT=$propval
30 fi
31done < $file
32
33echo "SOLR port: $SOLR_PORT"
34echo "SOLR host: $SOLR_HOST"
35
36# If using jetty:
37# The port Jetty runs on:
38SOLR_JETTY_PORT=8983
39
40# The port Jetty listens on for a "stop" command
41JETTY_STOP_PORT=8079
42
43
44if test -z $GSDLOS ; then
45 GSDLOS=`uname -s | tr '[A-Z]' '[a-z]'`
46 # check for running bash under Cygwin
47 if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ;
48 then
49 GSDLOS=windows
50 fi
51 # check for running bash under MinGW/MSys
52 if test "`echo $GSDLOS | sed 's/mingw//'`" != "$GSDLOS" ;
53 then
54 GSDLOS=windows
55 fi
56 echo "GSDLOS was not set. Setting it to '$GSDLOS'"
57 export GSDLOS
58fi
59
60first_time=0;
61
62if [ "x$GEXT_SOLR" = "x" ] ; then
63 export GEXT_SOLR=`pwd`
64
65 if [ -d "$GEXT_SOLR/bin/script" ] ; then
66 export PATH=$GEXT_SOLR/bin/script:$PATH
67 fi
68
69 if [ -d "$GEXT_SOLR/lib" ] ; then
70 if [ "$GSDLOS" = "linux" ] ; then
71 export LD_LIBRARY_PATH=$GEXT_SOLR/lib:$LD_LIBRARY_PATH
72 elif [ "$GSDLOS" = "darwin" ] ; then
73 export DYLD_LIBRARY_PATH=$GEXT_SOLR/lib:$DYLD_LIBRARY_PATH
74 fi
75 fi
76
77 extdir=${GEXT_SOLR##*/}
78
79 if [ "x$GSDL3EXTS" = "x" ] ; then
80 export GSDL3EXTS=$extdir
81 else
82 export GSDL3EXTS=$GSDL3EXTS:$extdir
83 fi
84
85 export SOLR_JETTY_PORT
86 export JETTY_STOP_PORT
87 export SOLR_PORT
88 export SOLR_HOST
89 first_time=1
90
91 echo "+Your environment is now setup for $extdesc"
92else
93 echo "+Your environment is already setup for $extdesc"
94fi
95
96#echo "++Solr/Jetty server will run on port $SOLR_JETTY_PORT (+ port $JETTY_STOP_PORT for shutdown command)"
97
98if [ "$first_time" = "1" ] ; then
99 echo "++Solr will run off the tomcat server on port $SOLR_PORT. "
100 echo "-- This port value can be changed by editing tomcat.port in build.properties"
101 echo ""
102fi
Note: See TracBrowser for help on using the repository browser.