Difference between revisions of "How to set up WiKit under AOLserver"

From AOLserver Wiki
Jump to navigation Jump to search
m
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'' '''Prerequisites:''' '' * AOLserver 4.0.6 [http://www.aolserver.com/] (currently CVS aolserver_v40_bp branch) * Tclkit 8.4.6 [http://equi4.com/tclkit.html] * Wikit 2004/06/08 00:57:42 19564-63131 [http://equi4.com/wikit.html] '' '''Instructions:''' '' '''Step 1.  Build and install Tcl and AOLserver.''' You can use a binary distribution of Tcl provided it is a threaded build of Tcl, and build AOLserver with it. Building both Tcl and AOLserver is outside the scope of this document and should be covered in a separate document. '''Step 2.  Create directories for the wiki..''' Assuming that your AOLserver is installed in
+
'' '''Prerequisites:''' ''
 +
* AOLserver 4.0.6 [http://www.aolserver.com/] (currently CVS aolserver_v40_bp branch)
 +
* Tclkit 8.4.6 [http://equi4.com/tclkit.html]
 +
* Wikit 2004/06/08 00:57:42 19564-63131 [http://equi4.com/wikit.html]
 +
 
 +
'' '''Instructions:''' ''
 +
 
 +
'''Step 1.  Build and install Tcl and AOLserver.'''
 +
 
 +
You can use a binary distribution of Tcl provided it is a threaded build of Tcl, and build AOLserver with it.
 +
 
 +
Building both Tcl and AOLserver is outside the scope of this document and should be covered in a separate document.
 +
 
 +
'''Step 2.  Create directories for the wiki..'''
 +
 
 +
Assuming that your AOLserver is installed in "/home/aolserver" (if it isn't, obviously replace that with the relevant path for your installation) and that you will start with the "sample-config.tcl" that comes standard with AOLserver, we should create a place to install the wiki-related files.  Lets do that now:
 +
 
 +
    $ mkdir /home/aolserver/servers/server1/wiki
 +
    $ mkdir /home/aolserver/servers/server1/wiki/data
 +
 
 +
You will only need to make the "wiki/data" directory writable by the user that AOLserver will run as. 
 +
 
 +
Note that these directories do NOT live under the pageroot ("servers/server1/pages" in the sample-config.tcl) but rather at the same level as the pageroot.  This is for security reasons.
 +
 
 +
'''Step 3.  Download and install Tclkit and Wikit.'''
 +
 
 +
Download the latest version of Tclkit and Wikit.  At the time of this writing, I tested with Tclkit 8.4.6.  You can download binaries for several platforms:
 +
* http://equi4.com/pub/tk/8.4.6/
 +
 
 +
In this example, the server is running on x86 Linux.  Here's how you might download the necessary files:
 +
 
 +
<pre>
 +
    $ cd /home/aolserver/servers/server1/wiki
 +
 
 +
    $ wget -O tclkit-8.4.6-static.gz http://equi4.com/pub/tk/8.4.6/tclkit-linux-x86-static.gz
 +
    ... [ wget output ] ...
 +
 
 +
    $ gunzip tclkit-8.4.6-static
 +
 
 +
    $ chmod 755 tclkit-8.4.6-static
 +
</pre>
 +
 
 +
Install Wikit in a similar way:
 +
 
 +
<pre>
 +
    $ cd /home/aolserver/servers/server1/wiki
 +
 
 +
    $ wget http://equi4.com/pub/sk/wikit.kit
 +
</pre>
 +
 
 +
You will also need a thin wrapper script (see Appendix B at the bottom of this page) that will execute wikit.  Copy the script from Appendix B into a file named "wiki.sh" in the "wiki" directory then make it executable.
 +
 
 +
<pre>
 +
    $ cd /home/aolserver/servers/server1/wiki
 +
 
 +
    $ cat <<-'EOF' | sed -e 's/^ //' > wiki.sh
 +
    ... copy and paste contents of Appendix B ...
 +
    EOF
 +
 
 +
    $ chmod 755 wiki.sh
 +
</pre>
 +
 
 +
That's it!  Tclkit and Wikit are now downloaded and installed.
 +
 
 +
'''Step 4.  Configure AOLserver to load CGI support.'''
 +
 
 +
Starting with the "sample-config.tcl" that comes with AOLserver, you need to make a simple change to enable CGI and configure it to recognize requests for the wiki.
 +
 
 +
Start by adding the following three lines to the [[nscgi]] module section in your sample-config.tcl:
 +
 
 +
    ns_param  map "GET  /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
 +
    ns_param  map "POST /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
 +
    ns_param  map "HEAD /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
 +
 
 +
This tells AOLserver to execute "wiki/wiki.sh" for requests to the server where the URL starts with "/wiki".  This invokes our thin wrapper script.
 +
 
 +
Next, we need to instruct AOLserver to actually load the [[nscgi]] module by uncommenting the appropriate line in the "modules" section (around line 449 after inserting the three ns_params above):
 +
 
 +
    ns_section "ns/server/${servername}/modules"
 +
        ...
 +
        ns_param nscgi ${bindir}/nscgi.so
 +
        ...
 +
 
 +
'''Step 5. Start AOLserver, and enjoy!'''
 +
 
 +
That's all there is to it.  Start up your server, fire up your web browser and point it at your server:
 +
 
 +
    http://www.aolserver.com/wiki
 +
 
 +
(Replace "www.aolserver.com" with your IP or the hostname of your server.)
 +
 
 +
You should get back the home page of your new wiki!
 +
 
 +
----
 +
 
 +
'''Before using any of the files in the appendix, you will need to remove the first whitespace character from the beginning of each line, as those were inserted so that the wiki will display them as preformatted text.'''
 +
 
 +
'''Appendix A.  Patch to sample-config.tcl.'''
 +
 
 +
<pre>
 +
--- sample-config.tcl  2004-06-14 20:18:19.000000000 -0400
 +
+++ wiki-config.tcl    2004-06-23 16:48:23.000000000 -0400
 +
@@ -352,6 +352,9 @@
 +
  #ns_param  map "GET  /cgi /usr/local/cgi"    ;# CGI script file dir (GET).
 +
  #ns_param  map "POST /cgi /usr/local/cgi"    ;# CGI script file dir (POST).
 +
 
 +
+ns_param  map "GET  /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
 +
+ns_param  map "POST /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
 +
+ns_param  map "HEAD /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
 +
 
 +
  #
 +
  # Modules to load
 +
@@ -360,7 +363,7 @@
 +
  ns_section "ns/server/${servername}/modules"
 +
      ns_param nssock ${bindir}/nssock.so
 +
      ns_param nslog ${bindir}/nslog.so
 +
-    #ns_param nscgi ${bindir}/nscgi.so
 +
+    ns_param nscgi ${bindir}/nscgi.so
 +
      #ns_param nsperm ${bindir}/nsperm.so
 +
 
 +
  #
 +
</pre>
 +
 
 +
'''Appendix B.  wiki.sh wrapper script.'''
 +
 
 +
<pre>
 +
#!/bin/sh
 +
 +
DIR=`dirname $0`
 +
cd $DIR/data
 +
 
 +
WIKIT_BASE=${WIKIT_BASE:-http://${HTTP_HOST}${SCRIPT_NAME}/}
 +
export WIKIT_BASE
 +
 +
$DIR/tclkit-8.4.6-static $DIR/wikit.kit
 +
</pre>
 +
 +
[[Category:Documentation]]
 +
[[Category:Tutorial]]

Latest revision as of 23:25, 6 November 2006

Prerequisites:

  • AOLserver 4.0.6 [1] (currently CVS aolserver_v40_bp branch)
  • Tclkit 8.4.6 [2]
  • Wikit 2004/06/08 00:57:42 19564-63131 [3]

Instructions:

Step 1. Build and install Tcl and AOLserver.

You can use a binary distribution of Tcl provided it is a threaded build of Tcl, and build AOLserver with it.

Building both Tcl and AOLserver is outside the scope of this document and should be covered in a separate document.

Step 2. Create directories for the wiki..

Assuming that your AOLserver is installed in "/home/aolserver" (if it isn't, obviously replace that with the relevant path for your installation) and that you will start with the "sample-config.tcl" that comes standard with AOLserver, we should create a place to install the wiki-related files. Lets do that now:

   $ mkdir /home/aolserver/servers/server1/wiki
   $ mkdir /home/aolserver/servers/server1/wiki/data

You will only need to make the "wiki/data" directory writable by the user that AOLserver will run as.

Note that these directories do NOT live under the pageroot ("servers/server1/pages" in the sample-config.tcl) but rather at the same level as the pageroot. This is for security reasons.

Step 3. Download and install Tclkit and Wikit.

Download the latest version of Tclkit and Wikit. At the time of this writing, I tested with Tclkit 8.4.6. You can download binaries for several platforms:

In this example, the server is running on x86 Linux. Here's how you might download the necessary files:

    $ cd /home/aolserver/servers/server1/wiki

    $ wget -O tclkit-8.4.6-static.gz http://equi4.com/pub/tk/8.4.6/tclkit-linux-x86-static.gz
    ... [ wget output ] ...

    $ gunzip tclkit-8.4.6-static

    $ chmod 755 tclkit-8.4.6-static

Install Wikit in a similar way:

    $ cd /home/aolserver/servers/server1/wiki

    $ wget http://equi4.com/pub/sk/wikit.kit

You will also need a thin wrapper script (see Appendix B at the bottom of this page) that will execute wikit. Copy the script from Appendix B into a file named "wiki.sh" in the "wiki" directory then make it executable.

    $ cd /home/aolserver/servers/server1/wiki

    $ cat <<-'EOF' | sed -e 's/^ //' > wiki.sh
    ... copy and paste contents of Appendix B ...
    EOF

    $ chmod 755 wiki.sh

That's it! Tclkit and Wikit are now downloaded and installed.

Step 4. Configure AOLserver to load CGI support.

Starting with the "sample-config.tcl" that comes with AOLserver, you need to make a simple change to enable CGI and configure it to recognize requests for the wiki.

Start by adding the following three lines to the nscgi module section in your sample-config.tcl:

   ns_param   map "GET  /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
   ns_param   map "POST /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
   ns_param   map "HEAD /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"

This tells AOLserver to execute "wiki/wiki.sh" for requests to the server where the URL starts with "/wiki". This invokes our thin wrapper script.

Next, we need to instruct AOLserver to actually load the nscgi module by uncommenting the appropriate line in the "modules" section (around line 449 after inserting the three ns_params above):

   ns_section "ns/server/${servername}/modules"
       ...
       ns_param nscgi ${bindir}/nscgi.so
       ...

Step 5. Start AOLserver, and enjoy!

That's all there is to it. Start up your server, fire up your web browser and point it at your server:

   http://www.aolserver.com/wiki

(Replace "www.aolserver.com" with your IP or the hostname of your server.)

You should get back the home page of your new wiki!


Before using any of the files in the appendix, you will need to remove the first whitespace character from the beginning of each line, as those were inserted so that the wiki will display them as preformatted text.

Appendix A. Patch to sample-config.tcl.

 --- sample-config.tcl   2004-06-14 20:18:19.000000000 -0400
 +++ wiki-config.tcl     2004-06-23 16:48:23.000000000 -0400
 @@ -352,6 +352,9 @@
  #ns_param   map "GET  /cgi /usr/local/cgi"     ;# CGI script file dir (GET).
  #ns_param   map "POST /cgi /usr/local/cgi"     ;# CGI script file dir (POST).
  
 +ns_param   map "GET  /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
 +ns_param   map "POST /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
 +ns_param   map "HEAD /wiki ${homedir}/servers/${servername}/wiki/wiki.sh"
  
  #
  # Modules to load
 @@ -360,7 +363,7 @@
  ns_section "ns/server/${servername}/modules"
      ns_param nssock ${bindir}/nssock.so
      ns_param nslog ${bindir}/nslog.so
 -    #ns_param nscgi ${bindir}/nscgi.so
 +    ns_param nscgi ${bindir}/nscgi.so
      #ns_param nsperm ${bindir}/nsperm.so
  
  #

Appendix B. wiki.sh wrapper script.

 #!/bin/sh
 
 DIR=`dirname $0`
 cd $DIR/data

 WIKIT_BASE=${WIKIT_BASE:-http://${HTTP_HOST}${SCRIPT_NAME}/}
 export WIKIT_BASE
 
 $DIR/tclkit-8.4.6-static $DIR/wikit.kit