AcePerl

 view release on metacpan or  search on metacpan

docs/ACEDB.HOWTO  view on Meta::CPAN


ACEDB comes with two servers called "saceserver" and "sgifaceserver".
The difference between the two is that sgifaceserver has the ability
to serve graphical pictures.  Aceserver is text-only. In general, you
will want to use sgifaceserver unless you know you will never need to
serve pictures.  If you download a binary distribution of ACEDB, the
two executables may have the name of the operating system appended to
them.  Never fear.  Just rename the files to "saceserver" and
"sgifaceserver."

A full description of installing s(gif)aceserver is given in the ACEDB
web pages at:

  http://www.acedb.org/Development/wdoc/Socket_Server/SOCKET_aceserver.html

However, it is a rather technical description.  Here's a brief summary
of what you need to do:

1) Set up server password permissions:
	a. Choose an administrative username and password.  For example "admin"
	   and "acepass"

	b. Generate a "hash" of the username and password using the makeUserPasswd
	   program (this comes with the acedb binaries):
               % makeUserPasswd admin
		// Please enter passwd: ******
		// Please re-enter passwd: ******
		// The following line is a valid entry for wspec/serverpasswd.wrm

		admin e5cc20aa1a8f3e7e5b29728bbd1355d8

        c. Find the file named serverpasswd.wrm located in the wspec/ subdirectory
	   of the acedb database directory.  Add these two lines to the end of the file:

                admin: admin
	        admin e5cc20aa1a8f3e7e5b29728bbd1355d8

            The first line tells the server that the "admin" user has administrative
            access, and can start and stop the server.  The second line says that
	    "admin" has the password encoded in the numbers.

        d. If you want to create additional users with read-only or read/write,
           permissions, you can do so by generating more user names and password
	   hashes with makeUserPasswd, and entering them into the serverpasswd.wrm
	   file as described before.  Here is an example that grants "fred" and "ethel"
           read/write access, and grants "ricky" read-only access:

           admin: admin
           write: fred ethel
           read: ricky

 	   admin e5cc20aa1a8f3e7e5b29728bbd1355d8
           fred 08b622ddf7eb7c8e44cdb3bd6362f966
           ricky 64c12094434c3c4a1a24cdd21ad06485
           ethel f95557500f46122aacd59ce920aae6e8

2) Try to start the server under your own account, using saceclient.

Assuming that you have installed the acedb databases using your own
user permissions, you can try to run the web server as yourself.  Open
up two command windows on your system.  In one type this command:

 	% ~acedb/bin/sgifaceserver ~acedb/elegans 5000

This is telling the server to run on port 5000 and to read data from
the database directory located at ~acedb/elegans.  If all is well, you
will see messages like this:

   // Database directory: /usr/local/acedb/elegans
   // Shared files: /usr/local/acedb
   // #### Server started at 2003-05-12_11:54:13
   // #### host=brie3.cshl.org  listening port=5000
   // #### Database dir=/usr/local/acedb/elegans/
   // ####  Working dir=/usr/local/acedb/elegans/
   // #### clientTimeout=600 serverTimeout=600 maxbytes=102400 autoSaveInterval=600

The messages will stop, indicating that the server is waiting for
incoming connections.

In the other window, launch saceclient with this command:

      % ~acedb/bin/saceclient localhost -port 5000

It will prompt you for a userid (type "admin") and a password (type
the password).  If all goes well, you will get this prompt:

      acedb@localhost> 

and the server will accept queries.  For example, try the command
"Find Model".

3) Try to communicate with the server using aceperl.

When you installed AcePerl, it should have installed a small interface
script named ace.pl.  Confirm that it can talk to the server:

    % ace.pl -host localhost -port 5000

By default, you will get an "anonymous" read only connection, and you
will see the prompt: 

    aceperl>

indicating that the database is ready to accept queries.

4) Shut down the server.

When you are ready, shut down the server like this:

   % ace.pl -host localhost -port 5000 -user admin -pass acepass
   aceperl> shutdown now

5) Try running the server as the "acedb" user.

If you are going to be running the acedb server a lot, it is better to
run it under the "acedb" account than under your personal login.  The
reason for this is that bugs in the acedb server code may
inadvertently expose your personal files to snooping or deletion if
the server is running under your personal ID.

To run the server as acedb, you must make its database files writable
by the acedb user.  To do this, become the root user, and run the
following commands:

  # chown -R acedb ~acedb/elegans/database
  # chgrp -R acedb ~acedb/elegans/database
  # chmod -R +rw ~acedb/elegans/database

Replace the path ~acedb/elegans with the path to the database that you
want to be accessible.  What this is doing is to make the "database"
subdirectory owned by the acedb user and writable by it.

Still running as root, become the acedb user:

  # su acedb

Now confirm that you can still launch the server:

  % ~acedb/bin/sgifaceserver ~acedb/elegans 5000

and talk to it:

  % ace.pl -host localhost -port 5000

Congratulations.  You're almost done.  The last step is to arrange for
the acedb socket server to start up automatically when needed.

GETTING THE SERVER TO START AUTOMATICALLY

There are two recipes for this, depending on whether your system uses
standard "inetd" "super daemon" to start up services on an as-needed
basis, or uses the new enhanced version called "xinetd."  The way to
tell is to look in your /etc directory.  If you see a file named
inetd.conf, then you are using the traditional inetd daemon.  If you
see instead a directory named xinetd.d/ then you are using xinetd.

1) Configuring for inetd:

  a) Find the file /etc/services, and add the following line to the
      end of the file:

     elegans   5000/tcp

     This is defining a new service named "elegans" which runs on
     port 5000.  You can change this symbolic name to anything you
     like.  If you have multiple acedb databases running, give each
     one a distinctive name and port number.  Avoid using any port
     numbers that are already mentioned in the file.

   b) Find the file /etc/inetd.conf, and add the following line:

    elegans  stream  tcp wait acedb  /usr/local/acedb/bin/sgifaceserver
            sgifaceserver /usr/local/acedb/elegans

    This is all one line, but has been word-wrapped to fit.

    The first field refers to the service named "elegans" that you
    defined in /etc/services and is necessary for inetd to associate
    the service with the proper port number.  Modify as you see fit.

   c) Tell inetd to reread its configuration files.  Use "ps" to find
      the ID of the inetd daemon like this:



( run in 0.763 second using v1.01-cache-2.11-cpan-f56aa216473 )