Joe's spitting in the sawdust Erlang tutorials
Tutorial number 4
Last edited 2003-11-26
Setting up a wiki
|
This tutorial shows you how to setup a an Erlang
wiki server. All the code is in wiki.tgz.
Please, report all errors, omissions or improvements to the
author.
The wiki runs as a system daemon. Setting up a system daemon was
described in detail here.
Step by step instructions |
- Down load the file wiki.tgz
- Create a directory to store the wiki program and data base then
unpack wiki.tgz in this directory. Note: I have chosen the directory
name /home/joe/installed, when you follow these instructions
you will have to change this path to point to your local installation
directory.
Unpack the distribution and run make, like this:
> mkdir /home/joe/installed
> cp wiki.tgz /home/joe/installed
> cd /home/joe/installed
> tar -xzvf wiki.tgz
> ... wiki is unpacked into a sub-directory called wiki
> cd wiki
> make
|
- Edit the environment variables in the
start of the script wiki.sh .
This file starts
## You will have to edit the following three variables
## $ROOT = path to the wiki code and store
## $PORT = port to run as
## $ERL = location of erlang
ROOT=/home/joe/wiki
PORT=4999
ERL=/home/joe/installed/otp_src_R8B-2/bin/erl
|
Edit these environment variables to reflect the values you want on
your system.
> cd /home/joe/installed/wiki
> emacs wiki.sh
... edit environment variables
|
> cd /home/joe/installed/wiki
./wiki.sh debug
Erlang (BEAM) emulator version 5.1.2 [source]
Eshell V5.1.2 (abort with ^G)
1> Start:{'4992','/home/joe/installed/wiki/store'}
Starting a port server on 4992...
|
Fire up a web browser and surf to
http://localhost:4992/wiki/.
These instructions have been tested on red hat 7.3
In the end of the file /etc/rc.d/rc.local add
the following line:
# start my local demons
/etc/rc.d/joe_services.sh &
|
This runs the script /etc/rc.d/joe_services.sh in
the background. Note the & is very important - running this in the
foreground can be disastrous and may deadlock your system :-)
joe_services.sh is as follows:
#!/bin/sh
## start my local demons
for i in /home/joe/services/*.sh
do
/bin/su joe $i start
done
|
This script is run as root. The command
su joe $i start runs the shell script $i as
user joe - note not as root.
The directory /home/joe/services must contain
the file wiki.sh.
|