Hi,
I've been playing with Squeak to develop web based applications. My intentions are to be able to develop some web based framework which will require that Squeak be running all the time.
I'm running Squeak on a linux server. Is it mandatory for the X interface to be running? Can Squeak be started as a daemon process? If not, how would you suggest to configure the machine so each time it's rebooted, Squeak will be launched?
Thanks, Daniel Salama
On Thursday 10 March 2005 2:53 pm, Daniel Salama wrote:
I've been playing with Squeak to develop web based applications. My intentions are to be able to develop some web based framework which will require that Squeak be running all the time.
I'm running Squeak on a linux server. Is it mandatory for the X interface to be running?
no
Can Squeak be started as a daemon process?
Yes, I do.
just use
-vm-display-null -vm-sound-null
see the man page.
Daniel Salama schrieb:
I'm running Squeak on a linux server. Is it mandatory for the X interface to be running?
As Ned already said, no it's not necessary, but it is sometimes convenient to be able to see what is going on with the image, to file in some code or do maintenance without the need to edit startup scripts and to restart squeak. If you install a VNC[1][2] server on your Linux machine you can have squeak running headfull (with a display), but the display will only be visible using a VNC client (eg. on another machine). So you can attach/detach a display to squeak whenever you want. There is even no need to install a VNC server on the Linux machine if you use the RFB (Remote Framebuffer) goodie[3] by Ian Piumarta (which happens to be my personal Squeak pearl of the week). This goodie still works in a 3.7 image, but the menus behave somewhat strange.
Can Squeak be started as a daemon process? If not, how would you suggest to configure the machine so each time it's rebooted, Squeak will be launched?
On Debian you can use start-stop-daemon in rcX.d scripts to launch/shutdown programs that do not fork.
Alex
[1]http://www.tightvnc.com/ [2]http://www.realvnc.com/ [3]http://www-sor.inria.fr/~piumarta/squeak/goodies.html#html/goodies.m4.1.0
Alexander Lazarević wrote:
If you install a VNC[1][2] server on your Linux machine you can have squeak running headfull (with a display), but the display will only be visible using a VNC client (eg. on another machine). So you can attach/detach a display to squeak whenever you want.
I am curious about these statements. I would like to understand fully what you mean. Do you mean to start Squeak on a display other than 0:0 (in which case you would have to have the VNC server started first)? If so, I understand how to do this. However, if you mean that you can start Squeak headfull on the default display and then willy-nilly connect to it in Linux I am perplexed how you would accomplish this. As far as I understand VNC servers in Linux (which is little) you cannot set up a server to share the default display. If on the other hand you mean that you can tell a running Squeak image to switch its display to some other display I am even more lost. How would that be accomplished in Linux? I am not picking at your statement here. I truly am curious about how to accomplish this.
Thanks.
On Friday 11 March 2005 11:21 am, Jason Rogers wrote:
If you install a VNC[1][2] server on your Linux machine you can have squeak running headfull (with a display), but the display will only be visible using a VNC client (eg. on another machine). So you can attach/detach a display to squeak whenever you want.
Another way to do this is to connect to a *remote* X server on demand.
You can use the OSProcess plugin to switch between headed and headless mode using the X display plugin. Of course, then you have to have at least the X client libraries on the local machine, but you don't have to be running a server.
Ned Konz schrieb:
Another way to do this is to connect to a *remote* X server on demand.
You can use the OSProcess plugin to switch between headed and headless mode using the X display plugin.
Some disadvantages I see with this solution are: - you have to have a running X server on the remote machine. There are X servers for windows, but it is much easier to install the small TightVNC client on those machines - if the X server gets killed I _assume_ the client (squeak) dies with a "connection with X server lost" fatal error (I don't know if the X display plugin catches this error). This does not happen if you use VNC and kill the VNC client - you have to tell squeak where to find the X server. If your remote machine gets its address via DHCP you might need to change this everytime. With VNC you just connect to VNC server or squeak.
Of course, then you have to have at least the X client libraries on the local machine, but you don't have to be running a server.
I found RFB to be a very good alternative.
Alex
On Fri, Mar 11, 2005 at 09:38:28PM +0100, Alexander Lazareviæ wrote:
Ned Konz schrieb:
Another way to do this is to connect to a *remote* X server on demand.
You can use the OSProcess plugin to switch between headed and headless mode using the X display plugin.
Some disadvantages I see with this solution are:
- you have to have a running X server on the remote machine. There are X
servers for windows, but it is much easier to install the small TightVNC client on those machines
- if the X server gets killed I _assume_ the client (squeak) dies with a
"connection with X server lost" fatal error (I don't know if the X display plugin catches this error). This does not happen if you use VNC and kill the VNC client
You are correct, the XDisplayControlPlugin does not handle any errors in the X session. In addition to the possibility of a "connection with X server lost" error, I think that it is possible to cause a fatal error by connecting to an X server with a different display depth. So I agree, this would not be a robust solution for a web application, and it would be better to use the VNC approach.
Dave
Here's what I use:
Install vnc-server RPM. Then edit
/etc/sysconfig/vncservers VNCSERVERS="1:squeakvnc"
This will cause /etc/init.d/vncserver to start a vnc server on display :1 for the user squeakvnc.
Squeak itself is started in $(HOME)/.vnc/xstartup for the user "squeakvnc". Very straight-forward.
- Bert -
On Fri, Mar 11, 2005 at 02:21:35PM -0500, Jason Rogers wrote:
Alexander Lazareviæ wrote:
If you install a VNC[1][2] server on your Linux machine you can have squeak running headfull (with a display), but the display will only be visible using a VNC client (eg. on another machine). So you can attach/detach a display to squeak whenever you want.
I am curious about these statements. I would like to understand fully what you mean. Do you mean to start Squeak on a display other than 0:0 (in which case you would have to have the VNC server started first)? If so, I understand how to do this. However, if you mean that you can start Squeak headfull on the default display and then willy-nilly connect to it in Linux I am perplexed how you would accomplish this. As far as I understand VNC servers in Linux (which is little) you cannot set up a server to share the default display. If on the other hand you mean that you can tell a running Squeak image to switch its display to some other display I am even more lost. How would that be accomplished in Linux? I am not picking at your statement here. I truly am curious about how to accomplish this.
You could do that with OSProcess. Presumably you could make this an administrative function in a Seaside application if you wanted to occasionally reopen the display on an X server (enter password, specify X display, click OK).
"Connect the Squeak display to a different X window display" OSProcess thisOSProcess displayOnXServer: 'willy.nilly.org:0'
"Connect to the local X display" OSProcess thisOSProcess displayOnXServer: 'unix:0'
"Make Squeak go headless for five seconds, then reappear" OSProcess thisOSProcess decapitate. (Delay forSeconds: 5) wait. OSProcess thisOSProcess recapitate.
Dave
Jason Rogers schrieb:
Alexander Lazarević wrote: I am curious about these statements. I would like to understand fully what you mean. Do you mean to start Squeak on a display other than 0:0 (in which case you would have to have the VNC server started first)? If so, I understand how to do this.
Good, because this is what I meant! :)
However, if you mean that you can start Squeak headfull on the default display and then willy-nilly connect to it in Linux I am perplexed how you would accomplish this. As far as I understand VNC servers in Linux (which is little) you cannot set up a server to share the default display. If on the other hand you mean that you can tell a running Squeak image to switch its display to some other display I am even more lost. How would that be accomplished in Linux?
I think David described how to do this with his plugin.
Alex
Can Squeak be started as a daemon process? If not, how would you suggest to configure the machine so each time it's rebooted, Squeak will be launched?
On Debian you can use start-stop-daemon in rcX.d scripts to launch/shutdown programs that do not fork.
Yeah. Here's my startup script to run my local Swiki. You'll need to tweak the paths, usernames, etc. but this should show how to do it. start-stop-daemon is great!
After installing this script in /etc/init.d, you need to cause it to get run. I use file-rc, and so I edit /etc/runlevel.conf to accomplish this. With the default setup, you have to create symbolic links in the /etc/rc?.d directories.
Overall, there certainly are an annoying number of steps to getting something to start after every reboot, but it is all straightforward. Given start-stop-daemon, you can make Squeak auto-start at boot time much like you'd do so for any other Unix program (sendmail, apache, squid, whatever).
-Lex
====
#! /bin/sh # # lexswiki Startup script for Lex's Swikis #
NAME=lexswiki DESC="Lex's Swikis" PIDFILE=/var/run/$NAME.pid SQUEAKVM=/usr/bin/squeakvm
SSDAEMON_ARGS="--pidfile $PIDFILE --exec $SQUEAKVM"
[ ! -f /etc/default/$NAME ] || . /etc/default/$NAME
[ -x $SQUEAKVM ] || exit 0
set -e
case "$1" in start) echo -n "Starting $DESC..." start-stop-daemon $SSDAEMON_ARGS --start --background --make-pidfile --chuid lex --chdir /home/lex/swiki -- -headless echo "" ;; stop) echo -n "Stopping $DESC..." start-stop-daemon $SSDAEMON_ARGS --stop rm -f $PIDFILE # because start-stop-daemon doesn't do this echo "" ;; restart) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|restart}" exit 3 ;; esac
exit 0
Lex Spoon schrieb:
After installing this script in /etc/init.d, you need to cause it to get run. I use file-rc, and so I edit /etc/runlevel.conf to accomplish this. With the default setup, you have to create symbolic links in the /etc/rc?.d directories.
Which is also easy to do like
update-rc.d lexswiki defaults
Alex
Daniel Salama wrote:
... how would you suggest to configure the machine so each time it's rebooted, Squeak will be launched?
Daniel,
You might want to have a look at Dan Bernstein's daemontools (http://cr.yp.to/daemontools.html). Once installed, daemontools monitors processes defined under a /service directory, bringing them up automatically on boot. The benefit over a simple init script is that daemontools continues to monitor launched processes, resurrecting any that die unexpectedly.
Regards, Danny.
On Sat, 02 Apr 2005 20:36:51 +0100, Danny Woods dannywoodz@yahoo.co.uk wrote:
You might want to have a look at Dan Bernstein's daemontools (http://cr.yp.to/daemontools.html). Once installed, daemontools monitors processes defined under a /service directory, bringing them up automatically on boot. The benefit over a simple init script is that daemontools continues to monitor launched processes, resurrecting any that die unexpectedly.
+1 from me. We use it on the SqF box as well. The startup script is 'run' and is simply something like:
#!/bin/sh setuidgid squeakuser squeak -headless foo.image
(setuidgid is a utility from daemontools that sets the uid&gid to that of 'squeakuser', then starts the rest of the command line).
A process will monitor this script, and as soon as it exits (because squeak dies) it will be restarted. Can't get it much simpler than that :)
squeak-dev@lists.squeakfoundation.org