greenstone.org greenstone wiki greenstone trac planet greenstone

Remote Greenstone3

From GreenstoneWiki

Contents

Building Greenstone collections remotely on Greenstone3

Preliminary notes for those using the Greenstone 3.03 binary release

  1. Make back-up copies of your gsdlCGI4gs3.pm and gliserver4gs3.pl
  2. Download the slightly modified versions of the two server-side files from SVN:
  3. In order to later launch the client-GLI application successfully, you may need to edit client-gli4gs3 script.
    • If you're on Linux, open greenstone3/gli/client-gli4gs3.sh and go to the line that states:
      if [ ! -f "${thisdir}/client-gli.sh" ]; then

      change this to:

      if [ ! -f "${thisdir}/client-gli4gs3.sh" ]; then
    • If you're on Windows, open up greenstone3/gli/client-gli4gs3.bat and go to the line that states:
      if exist client-gli.bat goto start

      Make sure it says:

      if exist client-gli4gs3.bat goto start
  4. Follow the steps in the Installation section of this wiki page.

Installation

This section describes how to install the remote building functionality on server and client.

Server

The server can be a Linux, Mac OS X or Windows machine. It must have the Java run-time installed (version 1.4 or newer).

To install the server-side functionality:

  1. Download Greenstone v3 and install it.
  2. Enable the tomcat CGI
    1. Rename the CGI jars supplied with (but disabled) in Tomcat
      cd greenstone3/packages/tomcat/server/lib
       mv servlets-ssi.renametojar servlets-ssi.jar
       mv servlets-cgi.renametojar servlets-cgi.jar
    2. Alter Tomcat's conf/web.xml file. (Found in greenstone3/packages/tomcat/conf folder.)
      There's a CGIServlet that's commented out; remove the comments and edit so that the live file contains.
      Code:
      <servlet>
              <servlet-name>cgi</servlet-name>
            <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
              <init-param>
                <param-name>debug</param-name>
                <param-value>6</param-value>
              </init-param>
              <init-param>
                <param-name>cgiPathPrefix</param-name>
                <param-value>WEB-INF/cgi</param-value>
              </init-param>
              <init-param>
                 <param-name>passShellEnvironment</param-name>
                 <param-value>true</param-value>
               </init-param>
              <init-param>
                  <param-name>executable</param-name>
                 <param-value>/usr/bin/perl</param-value>
              </init-param>
               <load-on-startup>5</load-on-startup>
          </servlet>

      Please note the uppercase letter 'E' in passShellEnvironment above. It was previously entered as lowercase on this page. If at that time you had copied and pasted the text above, it may have caused your remote Greenstone 3 to not work properly. You may then also want to look for any occurrence of "param-alue" in your web.xml file and correct it to "param-value".

      NOTE: Specify the full path of the Perl library for the parameter "executable" of CGIServlet. On Linux, it may look like:

      <init-param>
       	<param-name>executable</param-name>
              <param-value>/usr/bin/perl</param-value>
        </init-param>

      for Windows, it may look like:

      <init-param>
      	<param-name>executable</param-name>
              <param-value>C:\Program Files\greenstone3\gs2build\bin\windows\perl\bin\perl.exe</param-value>
      </init-param>

      Uncomment the mapping for the CGI servlet:

      Code:

      <servlet-mapping>
              <servlet-name>cgi</servlet-name>
              <url-pattern>/cgi-bin/*</url-pattern>
          </servlet-mapping>

      Note the cgi-bin value for the url-pattern.

  3. Check that Tomcat and Greenstone3 are working correctly by visiting
    http://<your-machine-name>:<port>/greenstone3/library
    The port will be "8080", unless this is already in use.
  4. Edit the "greenstone3/web/WEB-INF/cgi/gsdl3site.cfg" file and set full paths of the two greenstone home directories.
    On Linux, it may look like:
    gsdl3srchome    /research/greenstone3
    gsdlhome    /research/greenstone3/gs2build

    On Windows, it may look like:

    gsdl3srchome    "c:\Program Files\greenstone3"
    gsdlhome    "c:\Program Files\greenstone3\gs2build"
  5. Edit the first line of the greenstone3/web/WEB-INF/cgi/gliserver.pl file (or gliserver4gs3.pl if you're using the binary Greenstone 3.03 release) and specify the full path of the perl binary.
    On Unix it is likely to be:
        #!/usr/bin/perl -w

    On Windows this will be (if installed in the default location):

        #!C:\Program Files\greenstone3\gs2build\bin\windows\perl\bin\perl -w
  6. Restart Greenstone's tomcat server from greenstone 3's installation folder to take the changes into account:
    ant restart

    If you're on Linux and working with a binary release, make sure that the webserver user has executable permissions on gliserver.pl:

    cd greenstone3/web/WEB-INF/cgi
    chmod a+rx gliserver.pl
    ("chmod a+rx gliserver4gs3.pl" for those using the Greenstone 3.03 binary release)
    

    Visit

    http://<your-machine-name>:<port>/greenstone3/cgi-bin/gliserver.pl?cmd=check-installation

    in a web browser. (If you're using the Greenstone 3.03 binary release, then replace gliserver.pl in the URL string above with gliserver4gs3.pl.) You should get a message saying "Java found" and "Installation OK!". If you get a message saying "Java failed", check that the Java run-time is installed and on the webserver's path (see also the javahome property in step 4 above). If you get a "500 Internal Server Error", check the error log of your webserver for the cause (greenstone3/web/logs/greenstone.log).
    Important: You cannot continue with these instructions until this is successful, as nothing will work without it!

  7. Make the Greenstone "collect" directory, located in web/sites/localsite, writeable by the webserver user.
    On Unix, use chmod.
    On Windows, run in a DOS prompt:
        cacls "C:\Program Files\Greenstone3\web\sites\localsite\collect" /P Everyone:F
  8. Edit the Greenstone3 "greenstone3/web/interfaces/classic/transform/home.xsl" file and uncomment the line below to display an authentication link on the home page.
    <xsl:for-each select="service[@type='authen']">
          <li><a href="{$library_name}?a=g&rt=r&sa=authen&s={@name}&s1.aup=Login&s1.un=&s1.asn=">
    <xsl:value-of select="displayItem[@name='name']"/></a><xsl:value-of select="displayItem[@name='description']"/></li>
    </xsl:for-each>
  9. In the file greenstone3/web/sites/<sitename>/siteConfig.xml (e.g. greenstone3/web/sites/localsite/siteConfig.xml), uncomment the line
    <serviceRack name="Authentication"/>
  10. Add some user accounts by visiting the Greenstone home page and clicking the "Administration Page" link, then "add a new user". See the Authentication section below for more information.
  11. Open up the file global.properties in your greenstone's web/WEB-INF/classes folder. Edit the tomcat.server property's value to refer to the name of your server machine instead of leaving it at the default of "localhost":
    # tomcat info
    tomcat.server=your-server-computer-name

    Now images viewed from a browser on the client side will refer to the correct location on the remote machine.

If your end users will use the stand-alone GLI client, this is all that is required on the server, and you can skip the next section.

If your end users will be using the GLI applet, you also need to do the following four steps. These require the Java SDK -- if you don't already have this you can download it from here.

  1. In the Greenstone "gli" directory, run
        keytool -genkey -alias privateKey -keystore appletstore -storepass greenstone
    Enter the appropriate details for your organization. When it asks to enter the key password for <privateKey>, choose your own password or hit Enter to use "greenstone".
  2. Run
        jarsigner -keystore appletstore -signedjar SignedGatherer.jar GLI.jar privateKey
    When it prompts, enter the password you used above.
  3. Move the created SignedGatherer.jar file into the Greenstone "greenstone3/web/applet" directory.
  4. Edit the Greenstone3 "greenstone3/web/interfaces/default/transform/home.xsl" file and uncomment the line below to display a applet gli link on the home page:
  5. <a href="{$library_name}?a=p&sa=gli4gs3">The Librarian Interface</a>

Client

The clients can be Linux, Mac OS X or Windows machines. To use the stand-alone GLI client:

  1. Download gli-client-3.zip and unzip it.
  2. If you're on Windows run client-gli.bat and if you're on Linux/Mac OS X, run client-gli.sh. (If you're using the Greenstone 3.03 binary release, run "client-gli4gs3.bat" when on Windows or "client-gli4gs3.sh" when on Linux/Mac OS X).
  3. The following depends on the version of Greenstone 3 you are running:
    • Each time you run the GLI client on a machine it will ask for the Greenstone3 gliserver URL. This will be
      http://<your-machine-name>:<port>/greenstone3/cgi-bin/gliserver.pl
      On subsequent times, you can use the drop down box to choose a gliserver URL entered earlier.
    • However, if you're using the Greenstone 3.03 binary release things are a little different:
      The first time you run the GLI client on a machine it will ask for the Greenstone3 library. It will be
      http://<your-machine-name>:<port>/greenstone3

      If the URL of the Greenstone3 library is not given, it will ask for the Greenstone3 gliserver URL. The Greenstone3 gliserver URL will be

      http://<your-machine-name>:<port>/greenstone3/cgi-bin/gliserver4gs3.pl

To use the GLI applet:

  1. Visit your Greenstone3 library homepage and click "The Librarian Interface", half-way down the page. The GLI applet will begin loading, and after a short wait a "Launch Greenstone Librarian Interface" button will become available. Click this to start using the GLI applet.

You can now use the GLI to edit collections on the server or create new collections. The first time a collection is opened on a particular machine the GLI will read the plugin and classifier information from the server (this may take a minute or two).

Notes

General

There can be a lot of data transferred between the client and the server. This can make using the client impractical if you don't have a high speed connection between it and the server.

Authentication

The existing Greenstone3 user account system is used for authentication. User information is stored in /etc/usersDB of each site, for example, the "web/sites/localsite/etc/usersDb" dirtory stores users' infomation at site "localsite" , and the Administration pages (linked from your Greenstone library homepage) are used for adding, editing and removing users.

Groups are used to control the actions that users are allowed to perform on collections. The possible group settings are:

  • all-collections-editor: Users in this group can create new collections and edit all collections.
  • personal-collections-editor: Users in this group can create and edit "personal" collections. Personal collections have the user's username at the start of the internal collection name, and are created when the "this is a personal collection" option is ticked in the GLI "New Collection" dialog.
  • <collection-name>-collection-editor: Users is this group can create and edit the "<collection-name>" collection.

For example, users who need to create and edit their own collections, and to collaborate with others on a shared "papers" collection, should be in the "personal-collections-editor", and "papers-collection-editor" groups.

Note: After the greenstone3 environment has been set, use commands below to export the users table to text or import user records from a txt file.

  • Export a users table
  • java org.greenstone.gsdl3.util.usersDB2txt full_path_of_usersDB
  • Import user records from a text file to a users table
  • java org.greenstone.gsdl3.txt2usersDB full_path_of_the_text_file full_path_of_the_usersDB
  • config3Remote.xml stores configuration of the gli. On linux, it is located at:
  • ~/.gli

    On Windows, it is located at:

    c:\Documents and Settings\username\Application Data\Greenstone\GLI

    Check two arguments ("general.gliserver_url", "general.library_url") of the file if the remote gli couldn't connect to the server. They are like to be:

     <Argument name="general.gliserver_url">http://localhost:8080/greenstone3/cgi-bin/gliserver.pl</Argument>
     <Argument name="general.library_url">http://localhost:8080/greenstone3</Argument>

    If you're using the Greenstone 3 binary release, look for gliserver4gs3.pl instead of gliserver.pl at the end of the first Argument above.

Collection locking

Each collection may only be open by one person at a time, to prevent synchronization problems. When a request is sent to the server to perform an action on a collection, the server will check for a gli.lck file in the collection directory. This file contains the username of the person who has the collection locked. When the collection is closed, this lock file is deleted.

If the collection is locked by someone other than the person making the request, the action fails. This is reported to the user on the client side, and this user is given the option of "stealing" the lock. Generally this is not recommended, since work may be lost if multiple users are editing a collection at one time. Stealing the lock should only be done in the case where the GLI has exited abnormally and the lock file was not deleted, and only after consulting with the user who has the collection locked.

E-mail notifications

The server can be configured to e-mail the system administrator whenever a collection finishes building. To enable this, edit the Greenstone "cgi-bin/gliserver.pl" file and set "$mail_enabled" to "1", and "$mail_to_address", "$mail_from_address", and "$mail_smtp_server" appropriately.

Things have to be done if GLI needs to be re-compiled

If some changes have been made on the source files of GLI, run makegli.sh and makejar.sh(Linux) (makegli.bat and makejar.bat for Windows) to recompile the GLI. And then, do remember to copy the GLIServer.jar file to Greenstone3/gs2build/bin/java on the Greenstone3 server.


Troubleshooting

If you are experiencing problems or error messages when using the client/server version of the GLI, please follow these steps:

  1. Make sure you are using the latest version of Greenstone and have downloaded any patches on this page.
  2. Record any popup GLI error messages, and the last action you performed.
  3. Check for Java exceptions. If you're using the client version of the GLI, these will appear in the black GLI window (Windows) or in the terminal where you ran the GLI (Unix). If you're using the applet version of the GLI, these will appear in the Java Console (available from one of your browser menus -- for Firefox you may have to download this extension).
  4. Check for errors at the bottom of the log files of your webserver. If you're using Apache (recommended), look in the "error_log" file in the Apache "logs" directory.
  5. If you are having problems with the applet version, please check if you have the same problems with the client version.
If you think you have found a bug, or still can't get this functionality working, send a message to the Greenstone Users mailing list. Please include the following information:
  • The operating system of the server machine
  • The version of Greenstone installed on the server machine
  • The version of Java installed on the server machine
  • The operating system of the client machine
  • Whether you are using the client or applet version of the GLI
  • The actions you performed leading up to where the error or problem occurs
  • The complete text of any popup GLI error messages, exceptions or errors in the webserver log file