en:user_advanced:gs3_server
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:user_advanced:gs3_server [2016/11/16 20:33] – created kjdon | en:user_advanced:gs3_server [2025/06/27 03:00] (current) – [Proxying Tomcat with Apache] kjdon | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Advanced Server: Greenstone 3 ====== | ||
| - | ===== Apache Tomcat ===== | + | ====== Greenstone 3 Apache Tomcat |
| + | |||
| Tomcat is a servlet container, and Greenstone3 runs as a servlet inside it. | Tomcat is a servlet container, and Greenstone3 runs as a servlet inside it. | ||
| The file '' | The file '' | ||
| + | |||
| A Tomcat Context represents a web application. The Context for Greenstone3 is given by the file | A Tomcat Context represents a web application. The Context for Greenstone3 is given by the file | ||
| $GSDL3SRCHOME/ | $GSDL3SRCHOME/ | ||
| - | This tells Tomcat where to find the files for the application including its web.xml file (in the $GSDL3HOME folder, ie the web folder in your greenstone3 installation) , and what URL (/ | + | This tells Tomcat where to find the files for the application including its web.xml file (in the $GSDL3HOME folder, ie the web folder in your greenstone3 installation) , and what URL (/ |
| + | |||
| + | To make changes to these files, | ||
| Anything inside the Context directory is accessible via Tomcat . For example, the index.html | Anything inside the Context directory is accessible via Tomcat . For example, the index.html | ||
| file that lives in $GSDL3HOME can be accessed through the URL | file that lives in $GSDL3HOME can be accessed through the URL | ||
| Line 13: | Line 18: | ||
| localhost: | localhost: | ||
| - | ==== Starting and Stopping Tomcat ==== | + | ===== Starting and Stopping Tomcat |
| - | Greenstone provides a little server program which will start the Tomcat server and open the library in a browser. See the [[en: | + | Greenstone provides a little server program which will start the Tomcat server and open the library in a browser. See the [[en:user: |
| Alternatively, | Alternatively, | ||
| To start tomcat: | To start tomcat: | ||
| - | < | + | < |
| OR: | OR: | ||
| - | < | + | < |
| + | $ source ./ | ||
| + | $ ant start</ | ||
| To stop tomcat: | To stop tomcat: | ||
| - | < | + | < |
| OR: | OR: | ||
| < | < | ||
| To stop and then immediately start up again in one step, use restart: | To stop and then immediately start up again in one step, use restart: | ||
| + | < | ||
| + | OR: | ||
| < | < | ||
| - | ==== Changing Tomcat Port Number ==== | + | ===== Changing Tomcat Port Number |
| - | Greenstone sets up Tomcat to run on port 8383 by default. To change this, you can edit the tomcat.port property in build.properties. | + | Greenstone sets up Tomcat to run on port 8383 by default. To change this, you can edit the tomcat.port property in build.properties. |
| - | Alternatively, | + | |
| - | ==== Changing Tomcat settings ==== | + | Alternatively, |
| - | Don't edit the configuration files in Tomcat directly. Edit the versions in $GSDL3SRCHOME/ | + | |
| - | web.xml (copied to $GSDL3SRCHOME/packages/ | + | |
| - | 'ant configure-tomcat' will copy these files to their correct places, replacing variable placeholders with their correct values. This is done each time Tomcat is restarted | + | ===== Changing Tomcat settings ===== |
| + | Don't edit the configuration files in Tomcat directly. Edit the versions in $GSDL3SRCHOME/ | ||
| + | * greenstone3.xml.in (copied to $GSDL3SRCHOME/ | ||
| + | * server_tomcat8.xml.in (copied to $GSDL3SRCHOME/ | ||
| + | * web8.xml.in (copied to $GSDL3SRCHOME/ | ||
| + | * root_context.xml.in (copied to $GSDL3SRCHOME/ | ||
| + | |||
| + | 'ant configure' | ||
| Note: Tomcat must be shutdown and restarted any time you make changes in the following | Note: Tomcat must be shutdown and restarted any time you make changes in the following | ||
| Line 44: | Line 58: | ||
| * '' | * '' | ||
| - | * '' | + | |
| + | | ||
| * any classes or jar files used by the servlets | * any classes or jar files used by the servlets | ||
| We have disabled following symlinks for the greenstone servlet. | We have disabled following symlinks for the greenstone servlet. | ||
| - | To enable it, edit $GSDL3SRCHOME/ | + | To enable it, edit $GSDL3SRCHOME/ |
| - | set ’allowLinking’ to true. Restart Tomcat. | + | set ’tomcat.user.allowLinking’ to true. Restart Tomcat. |
| - | By default, | + | Tomcat |
| - | | + | |
| - | ($GSDL3SRCHOME/ | + | |
| We have set the greenstone context to be reloadable. | We have set the greenstone context to be reloadable. | ||
| This means that if a class or resource file in $GSDL3HOME/ | This means that if a class or resource file in $GSDL3HOME/ | ||
| the servlet will be reloaded. This is useful for development, | the servlet will be reloaded. This is useful for development, | ||
| - | production mode: set the ’reloadable’ attribute to false in $GSDL3SRCHOME/ | + | production mode: set the ’reloadable’ attribute to false in $GSDL3SRCHOME/ |
| - | ==== Changing collections or services ==== | + | If you are seeing lots of errors in packages/ |
| + | < | ||
| + | to the cache for web application [/ | ||
| + | insufficient free space available after evicting expired cache entries</ | ||
| + | |||
| + | ==== Using Greenstone inside a frame ==== | ||
| + | |||
| + | Greenstone' | ||
| + | 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/ | ||
| + | < | ||
| + | <!-- if greenstone is to be run in an iframe, need to use the --> | ||
| + | <!-- sameSiteCookies=none version of the CookieProcessor --> | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | ==== 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/ | ||
| + | |||
| + | Look for the ''< | ||
| + | |||
| + | ===== Changing collections or services | ||
| On startup, the servlet loads in its site, collections and services. | On startup, the servlet loads in its site, collections and services. | ||
| If the site or collection configuration files are changed, these changes will not take | If the site or collection configuration files are changed, these changes will not take | ||
| Line 66: | Line 106: | ||
| | | ||
| - | ==== Tomcat Session Handling ==== | + | ===== Tomcat Session Handling |
| Tomcat uses a Manager to handle HTTP session information. The Manager is specified in a < | Tomcat uses a Manager to handle HTTP session information. The Manager is specified in a < | ||
| - | Session information is stored between normal stop and starts in $GSDL3SRCHOME/ | + | Session information is stored between normal stop and starts in $GSDL3SRCHOME/ |
| 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 76: | Line 116: | ||
| - | ==== Proxying Tomcat with Apache ==== | + | ===== Proxying Tomcat with Apache |
| Instead of incorporating servlet support into your existing web server, | Instead of incorporating servlet support into your existing web server, | ||
| an easy alternative is to proxy Tomcat. The http:// | an easy alternative is to proxy Tomcat. The http:// | ||
| Line 86: | Line 126: | ||
| ServerName www.greenstone.org | ServerName www.greenstone.org | ||
| ... | ... | ||
| - | ProxyPass / | + | |
| - | ProxyPassReverse / | + | Redirect / |
| + | ProxyPass / | ||
| + | ProxyPass / | ||
| + | ProxyPassReverse / | ||
| + | < | ||
| + | ProxyPassReverseCookiePath / | ||
| + | </ | ||
| </ | </ | ||
| </ | </ | ||
| + | |||
| + | 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 95: | Line 143: | ||
| http:// | http:// | ||
| + | You will also need to tell Greenstone itself about the new web address. Edit **build.properties**. | ||
| + | Set the revproxy fields: | ||
| + | < | ||
| + | revproxy.protocol=https | ||
| + | revproxy.domain=www.greenstone.org | ||
| + | ## | ||
| + | ## | ||
| + | </ | ||
| + | |||
| + | You will also need to edit **resources/ | ||
| + | Uncomment and set the servlet_url_prefix param: | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | You will need to restart Tomcat for these settings to take effect. | ||
| === 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. | ||
| Line 108: | Line 175: | ||
| - | ==== Deploying a Soap Server on localsite ==== | + | ===== Deploying a Soap Server on localsite |
| Line 116: | Line 183: | ||
| < | < | ||
| Then, deploy | Then, deploy | ||
| - | (as written in the [[http://www.greenstone.org/ | + | (as written in the [[http://files.greenstone.org/ |
| < | < | ||
| Check that it works, by **starting** tomcat again and going to: | Check that it works, by **starting** tomcat again and going to: | ||
| Line 122: | Line 189: | ||
| Make sure that the page appears. You can also look at the wsdl file for the gs3 web service that's been exposed: | Make sure that the page appears. You can also look at the wsdl file for the gs3 web service that's been exposed: | ||
| < | < | ||
| - | You can also deploy other sites, see the [[http://www.greenstone.org/ | + | You can also deploy other sites, see the [[http://files.greenstone.org/ |
en/user_advanced/gs3_server.1479328420.txt.gz · Last modified: 2016/11/16 20:33 by kjdon
