Hi,
I have been working towards setting up a dedicated server (Ubuntu) to host my Seaside app as per Ramon's Blog http://onsmalltalk.com/programming/smalltalk/scaling-seaside-redux-enter-the-penguin/ Till now, I have been successful in having Apache serve static content and Load balance between 3 images of my Seaside App. Sticky sessions are working and everything is going well so far. But I had a problem when installing Daemontools (which Ramon has written in his blog and also Lukas has written in Mailing lists), the recent versions of Ubuntu, dont support Daemontools out of the box. In one of the comments to Ramon's post, I could learn that some of the seasiders have used Monit to do much more than want Daemontools does. Could you please guide me how to go about. I came across a blog on Rails using Monit http://www.igvita.com/2006/11/07/monit-makes-mongrel-play-nice/ In that, what is the equivalent code to Seaside of the following code ? start program = "/usr/local/bin/ruby /usr/local/bin/mongrel_rails start -d -e production -p 8010 -a 127.0.0.1 -P /home/user/current/log/mongrel.8010.pid -c /home/user/rails/current"Till now, I have been starting the images manually by /seaside$ squeakvm -nodisplay seasidedemo "" port 9090 & and to kill it, i use $ pkill squeakvm or $ kill [PID of SqueakVM] I suppose, we will also have to change the following code if totalmem is greater than 60.0 MB for 5 cycles then restartWhen an image is running on my server (Pentium Dual Core 2.8 GHz with 1 GB RAM), it shows almost 3-4% CPU and 3-4% RAM , should we shift the memory cap from 60 MB to 100 MB / image ? Is there any other options we have ? Thanks for the help, Rajeev Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hi Rajeev,
Monit its simple and yet
powerful.
This is how the monitrc file looks
like to monitor a squeak image:
###############################################################################
## Monitoring DEVELOPMENT Service OJ7WRE ############################################################################### check process OJ7WRE with pidfile
/var/run/services/OJ7WRE.pid
group server start program = "/etc/init.d/OJ7WRE start" stop program = "/etc/init.d/OJ7WRE stop" if cpu > 60% for 2 cycles then
alert
if cpu > 80% for 5 cycles then restart if totalmem > 200.0 MB for 2 cycles then restart if loadavg(5min) greater than 10 for 8 cycles
then restart
if 5 restarts within 5 cycles then timeout ###############################################################################
the start and stop script is
doing more or less what you are doing manually. I send a kill -15 to close image
gently. Also I needed to make the pid file when the image starts and remove
before image quits. I have an object in the image dedicated to startup and
shutdown production stuff inside the image.
For a "more monitored" services you
can make monit to send you an email to your cell phone if it reach some point
(like a service restart or fail to start or CPU 100% for more than 5 min or
apache is down or whatever).
cheers,
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks Sebastian for your prompt reply. I am a Linux newbie, so I didn't understand completely what you conveyed. If you could please spare some time to explain in some more detail, it would help newbies like me.
I install monit using sudo aptitude install monit once installed /etc/monit/monitrc is the place where monitrc file is located. Then I do sudo pico /etc/monit/monitrc and its the place where I put code sent by you. Till now, I have understood. How to go about further, when it comes to Seaside view point. The monitrc file you have pasted, I suppose is just for 1 seaside image. Could you please explain how you created OJ7WRE in /etc/init.d . Is it a process ? By the way what is OJ7WRE ? How do you accomplish this, if you have a seaside_cluster with say 4 images? Thanks again for your time, Rajeev On Feb 7, 2008 2:28 AM, Sebastian Sastre <[hidden email]> wrote:
-- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Sebastian Sastre-2
Hi Sebastian,
I am figuring out a bit of what you sent me in your reply. OJ7WRE is the name of your Seaside service. I am now searching for init script for Squeak image. Till now, this is the nearest things I have got http://wiki.squeak.org/swiki/124 for RedHat Distro http://wiki.squeak.org/swiki/123 for Solaris Which one to go for ?, Is there any other thing much more specific to Debian / Ubuntu . Thanks for your help, Rajeev On Feb 7, 2008 2:28 AM, Sebastian Sastre <[hidden email]> wrote:
-- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Well done,
if you read the monit documentation
you will figure out quickly how to use it. And yes you have to set a name for
each process/image which monit only can discern by looking its pid file. That's
why I've made those squeak production images to make a pid file with the name of
the service (only if in unix like OS) and delete it when shutdown. And the
script that is named with the name of the service.
I'm also using two scripts one is
SERVICENAME and the other is SERVICENAMEg. The second is to open the image with
full display. This can be done in the same script by a different command like
startHeadfull instead of start and that comand uses the headfull invocation of
squeak.
So the scripts to start and stop
looks pretty much as those but I modify them to allow me to pass as argument a
configuration file (just a .st file defining a dictionary of options). I think
they will work for any linux. I needed to make a directory under /var/run to
store only pids of seaside images to make things more
simple.
cheers,
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks for your kind help Sebastian.
Following your instructions, I have managed to write init script for start and stop. I was lucky to get code from http://www.nabble.com/attachment/8445249/1/squeak_http_service and after some tweaking, I have the following code for /etc/init.d/seaside ######################################################################### #!/bin/sh # Script to start a Squeak(Seaside) Image which runs Kom HTTP Server in -nodisplay mode. # Because main purpose is to run as service from /etc/init.d/seaside, # this can be started by root, but runs under regular user # Check and run what user asked for. case "$1" in start) echo -n "Starting Seaside " if [ "$SQUEAK_HTTP_PID" != "" ]; then echo "SQUEAK_HTTP Already running, exiting" # exit 1 else # Change directory and run Squeak headless cd /home/rajeev/caartz /usr/bin/squeakvm -nodisplay caartz01 "" port 9091 & SQUEAK_HTTP_PID=`ps -eo pid,command | grep "squeak" | grep -v grep | awk '{ print $1 }'` cd /var/run echo "Seaside is Started and is running with PID" echo $SQUEAK_HTTP_PID echo $SQUEAK_HTTP_PID > squeak.pid fi ;; stop) echo -n "Shutting down Seaside " cd /var/run SQUEAK_HTTP_PID=`head squeak.pid` if [ "$SQUEAK_HTTP_PID" = "" ]; then echo "Seaside Not running!" else #kill -SIGINT $SQUEAK_HTTP_PID kill -HUP $SQUEAK_HTTP_PID rm -rf squeak.pid fi ;; pid) cd /var/run SQUEAK_HTTP_PID=`head squeak.pid` echo "You asked for PID: here:" echo $SQUEAK_HTTP_PID ;; *) echo "Usage: $0 {start|stop|pid}" exit 1 ;; esac ########################################################################## I then add the following code in monitrc check process squeakvm with pidfile /var/run/squeak.pid group server start program = "/etc/init.d/seaside start" stop program = "/etc/init.d/seaside stop" if cpu > 60% for 2 cycles then
alert
if cpu > 80% for 5 cycles then restart if totalmem > 200.0 MB for 2 cycles then restart if loadavg(5min) greater than 10 for 8 cycles
then restart #####################################################################if 5 restarts within 5 cycles then timeout And to my excitement, Monit works for the above set of code. 1) I am able to start a seaside image, grep for 'squeak' in the ps and assign its PID to a variable and then echo that into /var/run/squeak.pid (here squeak.pid is created or overwritten) 2) When I stop the image, the PID is read from /var/run/squeak.pid and the process is killed, then the file squeak.pid is deleted The setup works well. I did the following to test $ pkill squeakvm or $ sudo /etc/init.d/seaside stop In both cases, after daemon checking time of 60 seconds, Seaside image was started automatically. So far so good, now my only concern in this regard is how to run Multiple seaside/squeak images ? AFAIK, the default process name for all the squeak instances running are 'squeakvm' , how to change this to suit image name or the best thing would be to have seaside_9091 (port number.. the way mongrel_8010 is named) If we get unique process name, then using Monit would become easier. Thanks & Regards, Rajeev On Feb 7, 2008 6:46 PM, Sebastian Sastre <[hidden email]> wrote:
-- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Very good,
I think we can give a number count
in the name of the process. Lets say
seasideService1.1 in port
101001
seasideService1.2 in port
101002
seasideService1.3 in port
101003
seasideService2.1 in port
102001
seasideService2.2 in port
102002
seasideServiceN.1 in port
10N001
...
seasideServiceN.M in port
10N00M
for an automatic installation
of a service some script factory will be needed but is very easy to make
once we have the script to start stop images. Just writting the template script
with customized process name port and path.
I've not worked yet on the
balancer part but I think we can use HAProxy as Ramon's blog says making it to
balance load using the rigth set of services.
cheers,
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> for an automatic installation of a service some script
> factory will be needed but is very easy to make once we have > the script to start stop images. Just writing the template > script with customized process name port and path. This is what daemontools makes so easy to do. Ubuntu just stopped using inittab so daemontools doesn't appear to install correctly, but it's easily remedied by dropping this... start on runlevel 2 start on runlevel 3 start on runlevel 4 start on runlevel 5 stop on runlevel 0 stop on runlevel 1 stop on runlevel 6 respawn exec /command/svscanboot into /etc/event.d, much better than init.d style services and automatically monitored and restarted if they die. My run script for a squeak image with daemontools looks like this... #!/bin/bash exec squeakvm -mmap 100m -headless \ -vm-sound-null -vm-display-null \ /var/squeak/someApp/app.image "" port 3434 Creating a service with daemontools is merely a matter of creating a symbolic link in the /service directory to your run scripts directory, the service is automatically started and monitored within 5 seconds or so. > I've not worked yet on the balancer part but I think we > can use HAProxy as Ramon's blog says making it to balance > load using the rigth set of services. > > cheers, > Sebastian Sastre I wouldn't recommend that anymore, I'd use Apache now, you probably won't be able to find a version of HAProxy, and mod_proxy can do it just as well. Ramon Leon _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
>
> Creating a service with daemontools is merely a matter of > creating a symbolic link in the /service directory to your > run scripts directory, the service is automatically started > and monitored within 5 seconds or so. > Could work but you can make this to send you an email when, for instance, an image is getting high cpu for more than lets say 20 secods or such kind of scenarios? > > I've not worked yet on the balancer part but I think we can use > > HAProxy as Ramon's blog says making it to balance load > using the rigth > > set of services. > > > > cheers, > > Sebastian Sastre > > I wouldn't recommend that anymore, I'd use Apache now, you > probably won't be able to find a version of HAProxy, and > mod_proxy can do it just as well. > > Ramon Leon > server during the whole session. Apache was unable to achieve that at the time. So now apache can preserve session routing properly? Do you have any doc to configure mod_proxy that way? Thanks, Sebastian _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> > Creating a service with daemontools is merely a matter of
> creating a > > symbolic link in the /service directory to your run scripts > directory, > > the service is automatically started and monitored within 5 > seconds or > > so. > > > Could work but you can make this to send you an email when, > for instance, an image is getting high cpu for more than lets > say 20 secods or such kind of scenarios? I didn't say monit wasn't still useful, just that services are easier to create and automate with daemontools than with init.d. > > > HAProxy was choosed because it preserves the choice of > balancing with a server during the whole session. Apache was > unable to achieve that at the time. So now apache can > preserve session routing properly? Do you have any doc to > configure mod_proxy that way? > > Thanks, > Sebastian > Sort of, I haven't blogged about it, but we hashed out the necessary steps a while back http://lists.squeakfoundation.org/pipermail/seaside/2007-November/015071.htm l Ramon Leon http://onsmalltalk.com _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
>
> I didn't say monit wasn't still useful, just that services > are easier to create and automate with daemontools than with init.d. > Just asking to compare. I'm glad they moved to a more powerful model. ... > Sort of, I haven't blogged about it, but we hashed out the > necessary steps a while back > http://lists.squeakfoundation.org/pipermail/seaside/2007-Novem ber/015071.htm > l > > Ramon Leon > http://onsmalltalk.com > Reference very appreciated, cheers! Sebastian _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Sebastian,
In your first mail of this thread, you have given out the code that needs to be appended into monitrc. How could you create process named OJ7WRE ? Right now, I have got start and stop script working as explained my previous mail. My concern now are : 1] Is it possile to name or rename the process/Command in Linux (By default it is set 'squeakvm' ) ? Can this be done on Linux or is it possible to change something in SqueakVM so that the process name it assigns to the process is somewhat unique (Is it easy to tweak SqueakVM by an amateur like me ?) 2] As of now, I would like to give preference to Monit as I have got about 75% working. Remaining depends on point 1. 3] If [1] is not possible, I shall try to follow Ramon's instruction of creating event.d and then installing Daemontools. Thanks & Regards, Rajeev On Feb 9, 2008 11:18 PM, Sebastian Sastre <[hidden email]> wrote:
-- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
As far as I know for *nix systems process only have PID
number as formal reference so I don't get why do you need a name and identify
them by it.
I exposed I make squeak images to create a PID file in
/var/run/services with it's unique *service name* which match the name of the
script which starts/stops the process of that service, just to make them human
manageable. So the OJ7WRE is just the name of the script which starts/stops that
image and the name of the PID file that image creates/deletes when it
starts/shutsdown.
I've made all that just to be able to invoke with a
name the process of that image so monit can watch on its pid file to know if
it's alive or other details of the process.
I plan to create scripts-paths-images automagically but
they are manually created by now.
cheers,
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Hi Sebastian,
I had got confused with the process name in "check process 'someProcessName' ..... to be the same as that shown when we use ps -A or top (which shows squeakvm for all the squeak images). In other examples (such as for Apache/ sshd etc), they have a single process running and they are assigned apache2 and sshd as process name in monitrc file. I tried with the following in monitrc check process caartz01 with pidfile /var/run/caartz01.pid ............... ............... check process caartz02 with pidfile /var/run/caartz02.pid ............... ............... check process caartz03 with pidfile /var/run/caartz03.pid ............... ............... and I restarted Monit. All the squeak-seaside images started on their own. files qith pid is saved as explained by one of my previous mails in this thread. I am happy that there is no real need to change the process name of squeak in general :) . Sorry for the trouble given due to my misconception. So, I am nearing towards deployment of my Seaside App :) Thanks again, Rajeev On Feb 10, 2008 10:58 PM, Sebastian Sastre <[hidden email]> wrote:
-- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
You intuitively tried to find process by names as we humans name things to
identify them but those *nix boxes are not smart things to interact with. I'm glad you find the way. Cheers ! Sebastian Sastre ________________________________ De: [hidden email] [mailto:[hidden email]] En nombre de Rajeev Lochan Enviado el: Domingo, 10 de Febrero de 2008 15:52 Para: Seaside - general discussion Asunto: Re: [Seaside] Monit on Ubuntu / Debian to monitor Seaside images Hi Sebastian, I had got confused with the process name in "check process 'someProcessName' ..... to be the same as that shown when we use ps -A or top (which shows squeakvm for all the squeak images). In other examples (such as for Apache/ sshd etc), they have a single process running and they are assigned apache2 and sshd as process name in monitrc file. I tried with the following in monitrc check process caartz01 with pidfile /var/run/caartz01.pid ............... ............... check process caartz02 with pidfile /var/run/caartz02.pid ............... ............... check process caartz03 with pidfile /var/run/caartz03.pid ............... ............... and I restarted Monit. All the squeak-seaside images started on their own. files qith pid is saved as explained by one of my previous mails in this thread. I am happy that there is no real need to change the process name of squeak in general :) . Sorry for the trouble given due to my misconception. So, I am nearing towards deployment of my Seaside App :) Thanks again, Rajeev On Feb 10, 2008 10:58 PM, Sebastian Sastre <[hidden email]> wrote: As far as I know for *nix systems process only have PID number as formal reference so I don't get why do you need a name and identify them by it. I exposed I make squeak images to create a PID file in /var/run/services with it's unique *service name* which match the name of the script which starts/stops the process of that service, just to make them human manageable. So the OJ7WRE is just the name of the script which starts/stops that image and the name of the PID file that image creates/deletes when it starts/shutsdown. I've made all that just to be able to invoke with a name the process of that image so monit can watch on its pid file to know if it's alive or other details of the process. I plan to create scripts-paths-images automagically but they are manually created by now. cheers, Sebastian Sastre ________________________________ De: [hidden email] [mailto:[hidden email]] En nombre de Rajeev Lochan Enviado el: Domingo, 10 de Febrero de 2008 00:41 Para: Seaside - general discussion Asunto: Re: [Seaside] Monit on Ubuntu / Debian to monitor Seaside images Sebastian, In your first mail of this thread, you have given out the code that needs to be appended into monitrc. How could you create process named OJ7WRE ? Right now, I have got start and stop script working as explained my previous mail. My concern now are : 1] Is it possile to name or rename the process/Command in Linux (By default it is set 'squeakvm' ) ? Can this be done on Linux or is it possible to change something in SqueakVM so that the process name it assigns to the process is somewhat unique (Is it easy to tweak SqueakVM by an amateur like me ?) 2] As of now, I would like to give preference to Monit as I have got about 75% working. Remaining depends on point 1. 3] If [1] is not possible, I shall try to follow Ramon's instruction of creating event.d and then installing Daemontools. Thanks & Regards, Rajeev On Feb 9, 2008 11:18 PM, Sebastian Sastre <[hidden email]> wrote: > > I didn't say monit wasn't still useful, just that services > are easier to create and automate with daemontools than with init.d. > Just asking to compare. I'm glad they moved to a more powerful model. ... > Sort of, I haven't blogged about it, but we hashed out the > necessary steps a while back > http://lists.squeakfoundation.org/pipermail/seaside/2007-Novem ber/015071.htm <http://lists.squeakfoundation.org/pipermail/seaside/2007-November/015071.ht m> > l > > Ramon Leon > http://onsmalltalk.com > Reference very appreciated, cheers! Sebastian _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside -- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside -- Rajeev Lochan Co-founder, AR-CAD.com http://www.ar-cad.com +91 9243468076 (Bangalore) 080 65355873 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |