Archive for category Miscellaneous

Installing WebObjects on RHEL Centos 5.3

Hi,

I like totally ripped most of these instructions from this site, Installing WO 5.3 or WO 5.4 on Linux , so please give your google adsense love clicks to it. Here is how we did it here…..the main differences are in our apache config and our developer wrote a better init.d script…..as quoted by him. NOW READ !!

0. Before you begin you will require:

  • Installed Sun JDK
  • Installed Apache and development header files
  • Add Dag’s rpmfusion repository. Do not enable it though, we will call it when we need it.

1. Get the WebObjects installer from mDimension’s Web site :

wget http://webobjects.mdimension.com/wolips/WOInstaller.jar

2. Install WebObjects 5.4.3 into /opt

sudo java -jar WOInstaller.jar 5.4.3 /opt

3. Create a user to run wotaskd and JavaMonitor (we are going to follow Mac OS X convensions here)

sudo groupadd appserverusr
sudo useradd -g appserverusr appserver

4. Fix permissions

sudo mkdir /var/log/webobjects
sudo chown appserver:appserverusr /var/log/webobjects
sudo chown -R appserver:appserverusr /opt/Local
sudo chown -R appserver:appserverusr /opt/Library
sudo chmod 750 /opt/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor
sudo chmod 750 /opt/Library/WebObjects/JavaApplications/wotaskd.woa/Contents/Resources/SpawnOfWotaskd.sh
sudo chmod 750 /opt/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd

5. Edit .bash_profile for the appserver user and add the NEXT_ROOT environment variable

export NEXT_ROOT=/opt

6. Change to the appserver user and launch wotaskd and JavaMonitor to ensure everything is working

su - appserver
/opt/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd &
/opt/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &

7. You should now be able to browse to JavaMonitor at:

http://your.host.name:56789/

8. If you have made it this far you can shut down wotaskd and JavaMonitor and add in the scripts to bring them up on boot.

kill `ps aux | awk '/WOPort 56789/ && !/awk/ {print $2}'`
kill `ps aux | awk '/WOPort 1085/ && !/awk/ {print $2}'`

9. Download the attached start-up script and place it in /etc/init.d

10. Instruct the init script to run the script at boot

chkconfig --add webobjects
/etc/init.d/webobjects start

11. Download and unpack the Wonder source required for the apache adaptor

wget http://webobjects.mdimension.com/wonder/Wonder-latest-Source.tar.gz
tar zxvf Wonder-latest-Source.tar.gz
cd Wonder/Utilities/Adaptors

12. Edit the make.config file to set the environment we are building on

# Set the platform you are building on
ADAPTOR_OS = LINUX

13. Build and install the module

make
cd Apache2.2
apxs -i -a -n WebObjects mod_WebObjects.so

14. Add the following configuration to /etc/httpd/conf.d/webobjects.conf

<IfModule mod_WebObjects.c>

# Path to the Document Root of your Webserver,
# it should contain a directory named WebObjects
WebObjectsDocumentRoot /var/www/html

# You can change the 'cgi-bin' part of WebObjectsAlias to whatever you
# prefer (such as Apps), but the 'WebObjects' part is required.
WebObjectsAlias /cgi-bin/WebObjects

# We set a specific allow rule to prevent default restrictions from denying
# access to the module
<Location /cgi-bin/WebObjects>
    Allow from All
</Location>

# Point /WebObjects requests to the installed document root
Alias /WebObjects /var/www/html/WebObjects
<Location /WebObjects>
    Options -Indexes
    Allow from All
</Location>

# Here are the 3 possible configuration modes.
# The apache module uses one of them to get information
# about your deployed applications.
# 1085 is the reserved port on which wotaskd processes listen to by default.

# Host List Configuration
# wotaskd is started automatically on supported platforms,
# so this is the default mode.
# The apache module gets its configuration from the wotaskds
# listed on the configuration line
# For multiple hosts:
# WebObjectsConfig http://<name-of-a-host>:<port-on-a-host>,http://<name-of-another-host>:<port-on-a-host> <interval>
# For localhost:
WebObjectsConfig http://localhost:1085 10

# Multicast Configuration
# The apache module gets its configuration from all wotaskds
# that respond to the multicast call on the subnet
# WebObjectsConfig webobjects://239.128.14.2:1085 10

# File Configuration
# The apache module gets its configuration from one file
# WebObjectsConfig file://<path-to-a-xml-config-file> 10

# To enable public access to the WOAdaptorInfo page, uncomment the following line
WebObjectsAdminUsername public

# To enable the WOAdaptorInfo page with restricted access,
# uncomment the next two lines and set the user and password
# To access the WOAdaptorInfo page with restricted access, use
# a URL like: http://webserver/cgi-bin/WebObjects/WOAdaptorInfo?user+password.
# WebObjectsAdminUsername user
# WebObjectsAdminPassword password

# To change the logging options, read the following comments:
# The option name is "WebObjectsLog" and the first value indicates the path
# of the log file.
# The second value indicates the log level. There are five, in decreasing
# informational order:
#       "Debug",    "Info",    "Warn",    "Error",    "User"
#
# Note: To enable logging, touch '/tmp/logWebObjects'
# as the administrative user (usually root).
#
# The following line is the default:
WebObjectsLog /tmp/WebObjects.log Debug
</IfModule>

15. Copy the static content into the Apache document root

cd /opt/Library/WebObjects/WODocumentRoot
cp -R WebObjects /var/www/html/

all done!

The init.d script

————————————-

#!/bin/bash
#
# chkconfig: 345 90 10
# description: Provides WebObjects services

USER=”appserver”
NEXT_ROOT=”/opt”
WOTASKD_LOG=”/var/log/webobjects/wotaskd.log”
MONITOR_LOG=”/var/log/webobjects/JavaMonitor.log”

export NEXT_ROOT

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network

# Check that networking is up.
[ “${NETWORKING}” = “no” ] && exit 0

start() {
echo -n “Starting wotaskd and Monitor: ”
daemon –user=$USER “$NEXT_ROOT/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 >> $WOTASKD_LOG 2>&1 &”
daemon –user=$USER “$NEXT_ROOT/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 >> $MONITOR_LOG 2>&1 &”
echo
}

stop() {
echo -n “Shutting down wotaskd and Monitor: ”
WOTASKD_PID=`ps aux | awk ‘/WOPort 1085/ && !/awk/ {print $2}’`
kill $WOTASKD_PID
MONITOR_PID=`ps aux | awk ‘/WOPort 56789/ && !/awk/ {print $2}’`
kill $MONITOR_PID
echo
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status $processname
RETVAL=$?
;;
restart)
stop
start
;;
*)
echo $”Usage: $0 {start|stop|status|restart}”
;;
esac

exit $RETVAL

———————————————–

Tags:

Hello world! Pants Off!

This will be a blog for handy tips and our way of giving something back to the Interweb after taking so, so much from it. 😀