Hello

I just wanted to share a script i've been working on for the past week or so - it completely automates the process - from start to finish - of setting up a clean server to be a webobjects deployment server.  From a blank debian install with nothing selected in tasksel (as in, no standard system) to having wotaskd, javamonitor, etc running, and apache with an adapter built and installed.

I have tested this on 32 bit debian.  It should work on 64 bit debian bar the other error which I experienced that I have already posted on this list about, which I will do more testing on once i have the time.  I will also update the wiki with information about this script and my experiences with linux deployment in general.

It should be possible to get this to go on ubuntu without too much effort.

This comes with absolutely no warranty.  Please DO NOT run this on a server that is already in production as it may break any apache config you have set up.  This is intended to be run only on a clean server that will be used for webobjects deployment.

Have fun..let me know how it goes if anyone has any luck with it

Regards,
Richard Stephens
Ph: 07 3136 3426
Mob: 0410 111 570



.
#!/usr/bin/perl

#NOTE: this script is a quick hack and is VERY beta
#      USE AT YOUR OWN RISK
#
# TODO:
#      - edit sources list rather than replacing it
#      - provide error checking after each step so we don't keep going if something fails
#      - provide option to isntall 5.4 and to install to somewhere other than /usr/local/apple
#      - get it to work on ubuntu as well as debian
#      - get it to use a configuration strategy that fits with apache's moduler configuration style a bit better
$s = rename("/etc/apt/sources.list", "/etc/apt/sources.list.old");
if ($s)
{
	print("renamed sources list\n");
}
else
{
	print("failed to rename sources list\n");
	exit;
}

open(fh, ">/etc/apt/sources.list");
print fh <<"ENDTEXT";
deb http://ftp.debian.org/debian/ etch main contrib non-free
deb-src http://ftp.debian.org/debian/ etch main contrib non-free

deb http://security.debian.org etch/updates main contrib non-free
ENDTEXT

close(fh);

system("apt-get -y update");

system("apt-get -y install sun-java5-jdk build-essential apache2 apache2-threaded-dev lsof psmisc");

system("wget http://webobjects.mdimension.com/wolips/WOInstaller.jar";);

system("java -jar WOInstaller.jar 5.3.3 /usr/local/apple");

system("mkdir /usr/local/apple/System");

system("ln -s /usr/local/apple/Library /usr/local/apple/System/Library");

print "end.\n";
print "\n";
#!/usr/bin/perl



system("chmod +x  /usr/local/apple/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd");
system("chmod +x  /usr/local/apple/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor");

print "end.\n";
print "\n";
#!/usr/bin/perl


open(fh, ">/etc/init.d/wotask.sh");
print fh <<"ENDTEXT";
#!/bin/sh

NEXTROOT=/usr/local/apple

case "\$1" in
        start)

           export PATH=/usr/local/bin:\$PATH
           export NEXT_ROOT=\${NEXTROOT}
           \${NEXTROOT}/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd &
           echo -n ' wotaskd'

           ;;
        stop)
           lsof -i tcp:1085 |grep LISTEN | sort -u | awk '{print"kill -9 " \$2}'                                | sh
                ;;
        *)
           echo ""
           echo "Usage: `basename \$0` { start | stop }"
           echo ""
           exit 64
                ;;
esac

ENDTEXT

close(fh);

open(fh, ">/etc/init.d/javamonitor.sh");
print fh <<"ENDTEXT";
#!/bin/sh
NEXTROOT=/usr/local/apple

case "\$1" in
        start)
           export PATH=/usr/local/bin:\$PATH
           export NEXT_ROOT=\${NEXTROOT}
           \${NEXTROOT}/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &
           echo -n 'JavaMonitor'
                        ;;
        stop)
           lsof -i tcp:56789 |grep LISTEN | sort -u |awk '{print"kill -9 "\$2}' | sh
            ;;
        *)
           echo ""
           echo "Usage: `basename \$0` { start | stop }"
           echo ""
           exit 64
            ;;
esac


ENDTEXT

close(fh);

system("chmod +x /etc/init.d/wotask.sh");
system("chmod +x /etc/init.d/javamonitor.sh");

system("update-rc.d wotask.sh defaults");
system("update-rc.d javamonitor.sh defaults");

print "end.\n";
print "\n";
#!/usr/bin/perl

system("wget http://webobjects.mdimension.com/wonder/Wonder-latest-Source.tar.gz";);
system("tar zxvf Wonder-latest-Source.tar.gz");


print "end.\n";
print "\n";
#!/usr/bin/perl


open(fh, ">>Wonder/Utilities/Adaptors/make.config");
print fh <<"ENDTEXT";

OS = LINUX
APXS = /usr/bin/apxs2
APXS2.2 = /usr/bin/apxs2
ADAPTORS = Apache2.2
ADAPTOR_OS = LINUX
ENDTEXT
chdir("Wonder/Utilities/Adaptors");
system("make");

close(fh);
chdir("../../../");
#!/usr/bin/perl

system("cp Wonder/Utilities/Adaptors/Apache2.2/apache.conf /etc/apache2/mods-available/webobjects.conf");

open(WCO, "/etc/apache2/mods-available/webobjects.conf");
open(WCN, ">/etc/apache2/mods-available/webobjects.conf.new");

while ($line = <WCO>)
{
	chomp($line);
	if ($line =~ m/LoadModule/)
	{
		print WCN  "#".$line."\n";
	}
	else
	{
		print WCN $line;
		print WCN "\n";
	}

	
}
close(WCO);
close(WCN);

system("rm /etc/apache2/mods-available/webobjects.conf");
system("mv /etc/apache2/mods-available/webobjects.conf.new /etc/apache2/mods-available/webobjects.conf");

open(fh, ">/etc/apache2/mods-available/webobjects.load");
print fh <<"ENDTEXT";
LoadModule WebObjects_module /usr/lib/apache2/modules/mod_WebObjects.so

ENDTEXT
close(fh);

system("a2enmod webobjects");

system("rm /etc/apache2/sites-enabled/000-default");
system("cp -v Wonder/Utilities/Adaptors/Apache2.2/mod_WebObjects.* /usr/lib/apache2/modules/");

system("chmod +x /usr/local/apple/Library/WebObjects/JavaApplications/wotaskd.woa/Contents/Resources/SpawnOfWotaskd.sh");

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-deploy mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-deploy/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to