User Tools

Site Tools


en:user_advanced:gs3_server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:user_advanced:gs3_server [2025/06/27 01:29] – [Changing Tomcat settings] kjdonen:user_advanced:gs3_server [2025/06/27 03:00] (current) – [Proxying Tomcat with Apache] kjdon
Line 73: Line 73:
  the servlet will be reloaded. This is useful for development, but should be turned off for   the servlet will be reloaded. This is useful for development, but should be turned off for 
 production mode: set the ’reloadable’ attribute to false in $GSDL3SRCHOME/resources/tomcat/greenstone3.xml.in. Restart Tomcat. production mode: set the ’reloadable’ attribute to false in $GSDL3SRCHOME/resources/tomcat/greenstone3.xml.in. Restart Tomcat.
 +
 +If you are seeing lots of errors in packages/tomcat/logs/catalina.out like the following, then consider increasing the maximum size of the cache - edit the cacheMaxSize attribute on the Resources element in resources.tomcat/greenstone3.xml.in.
 +<code>org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [... class name ...] 
 +to the cache for web application [/greenstone3] because there was 
 +insufficient free space available after evicting expired cache entries</code>
 +
 +==== Using Greenstone inside a frame ====
 +
 +Greenstone's cookies are SameSite=none by default (prior to April 2024) or after that, SameSite=strict. Browsers nowadays handle samesite=none in different ways. To get Greenstone to work properly inside a frame, the cookies need to be SameSite=none, partitioned=true. This needs a later version of Tomcat.
 +From April 2024, we use a newer version of Tomcat (8.5.99) instead of 8.5.51. This has the ability to set partitioned for cookies. 
 +This feature is available in Greenstone 3.12 and later.
 +Edit resources/tomcat/greenstone3.xml.in - comment out the CookieProcessor line setting strict, and uncomment the one setting none + partitioned. Then restart Tomcat
 +<code>
 +<!-- if greenstone is to be run in an iframe, need to use the -->
 +<!-- sameSiteCookies=none version of the CookieProcessor -->
 +  <CookieProcessor sameSiteCookies="none" partitioned="true"/>
 +  <!--<CookieProcessor sameSiteCookies="strict"/>-->
 +</code>
 +
 +==== Turn off localhost access logs ====
 +
 +By default, one of the enabled forms of logging in Apache Tomcat is the Local Host Access Log.  This log tracks every connection made to the server. This can add up to a lot of logs that can quickly overwhelm the hard drive space of your server. 
 +
 +To disable this, edit resources/tomcat/server_tomcat8.xml.in
 +
 +Look for the ''<Valve className="org.apache.catalina.valves.AccessLogValve".../>'' section and comment it out by surrounding it in ''<nowiki><!--  --></nowiki>''
  
 ===== Changing collections or services ===== ===== Changing collections or services =====
Line 84: Line 110:
 Tomcat uses a Manager to handle HTTP session information. The Manager is specified in a <Manager> element in the greenstone3.xml context file. By default, Greenstone uses the standard Tomcat default manager. Tomcat uses a Manager to handle HTTP session information. The Manager is specified in a <Manager> element in the greenstone3.xml context file. By default, Greenstone uses the standard Tomcat default manager.
  
-Session information is stored between normal stop and starts in $GSDL3SRCHOME/packages/tomcat/work/Catalina/localhost/greenstone3/SESSIONS.ser. To disable storing session info between restarts, set the pathname attribute of the Manager element to "" in $GSDL3SRCHOME/resources/tomcat/greenstone3.xml.+Session information is stored between normal stop and starts in $GSDL3SRCHOME/packages/tomcat/work/Catalina/localhost/greenstone3/SESSIONS.ser. To disable storing session info between restarts, set the pathname attribute of the Manager element to "" in $GSDL3SRCHOME/resources/tomcat/greenstone3.xml.in.
  
 To manually clear saved session info, stop Tomcat and delete the SESSIONS.ser file. To manually clear saved session info, stop Tomcat and delete the SESSIONS.ser file.
Line 100: Line 126:
 ServerName www.greenstone.org ServerName www.greenstone.org
 ... ...
-ProxyPass /greenstone3 http://puka.cs.waikato.ac.nz:8080/greenstone3 + 
-ProxyPassReverse /greenstone3 http://puka.cs.waikato.ac.nz:8080/greenstone3+Redirect /greenstone3 /greenstone3/ 
 +ProxyPass /webswing-server/ http://puka.cs.waikato.ac.nz:8383/webswing-server/ upgrade=websocket 
 +ProxyPass /greenstone3http://puka.cs.waikato.ac.nz:8080/greenstone3 
 +ProxyPassReverse /greenstone3http://puka.cs.waikato.ac.nz:8080/greenstone3 
 +<Location /greenstone3> 
 +          ProxyPassReverseCookiePath /greenstone3 /greenstone3 
 +</Location>
 </VirtualHost> </VirtualHost>
 </code> </code>
 +
 +Restart Apache for these changes to take effect.
  
 In our example, the Greenstone3 servlet can be accessed at  In our example, the Greenstone3 servlet can be accessed at 
Line 109: Line 143:
 http://puka.cs.waikato.ac.nz:8080/greenstone3/library, which is not publicly accessible. http://puka.cs.waikato.ac.nz:8080/greenstone3/library, which is not publicly accessible.
  
-You will also need to tell Greenstone itself about the new web address. Edit  +You will also need to tell Greenstone itself about the new web address. Edit **build.properties**. 
-**web/sites/localsite/siteConfig.xml**. Add a line like the following to the <metadataList>:+Set the revproxy fields:
 <code> <code>
-<metadata name="siteURL">http://www.greenstone.org/greenstone3/</metadata>+revproxy.protocol=https 
 +revproxy.domain=www.greenstone.org 
 +##revproxy.opt_port=8383 
 +##revproxy.context=greenstone3
 </code> </code>
  
- +You will also need to edit **resources/web/servlets.xml.in** 
-Set up the tomcat.port and shutdown port in your ''build.properties'' file if different from the default 8383 and 8305 respectively. +Uncomment and set the servlet_url_prefix param:
- +
-Also edit these files ton contain the new url-prefix (if different from /greenstone3):+
 <code> <code>
- ./resources/web/global.properties.in +<init-param> 
- ./resources/web/global.properties+   <param-name>servlet_url_prefix</param-name> 
 +   <param-value>//www.greenstone.org/greenstone3/</param-value> 
 +</init-param>
 </code> </code>
-to change  
-<code>[email protected]@</code> 
-to 
-<code> 
- #[email protected]@ 
- tomcat.context=urban-narrative-greenstone3 
-</code> 
- 
-Don't forget to run (from GS3 folder): 
-<code> 
- ant configure-web 
-</code> 
-to regenerate the global.properties file in the actual web folder. 
- 
-Finally, to get everything running: 
-</code> 
-./gs3-setup.sh 
-ant start 
-<code> 
-Then 
-<code>ssh [email protected] (e.g. puka)</code> 
-In the same x-term, ssh -L back into the machine running the GS3 server: 
-<code>puka$ ssh -L port:localhost:port (you@)gs3-server.machine.domain</code> 
  
-On any browser, visit: +You will need to restart Tomcat for these settings to take effect.
-<code>remote.public.machine/url-prefix/library</code>+
 === Running Tomcat behind a proxy === === Running Tomcat behind a proxy ===
 Almost everything works fine when Tomcat is running behind a proxy.  Almost everything works fine when Tomcat is running behind a proxy. 
en/user_advanced/gs3_server.1750987786.txt.gz · Last modified: 2025/06/27 01:29 by kjdon