views:

496

answers:

6

Hi!

I've got rather distinct question - I'd like to run Smalltalk on a production server without using graphical interface. Is this possible with VW or Pharo (maybe even Squeak)?

I've got a VPS hosting without X and would like to have few websites running on Smalltalk, while developing them localy with full-blown Smalltalk env, including GUI.

Thanks, Damir

+6  A: 

If I had root access on the VPS I would personally install Xvnc it doesn't add too much bloat on the server and it's much easier to manage Squeak and Pharo with a GUI.

You can launch each Squeak instance in it's own Xvnc display without relying on a Window Manager by having Squeak take up the whole screen.

You need only minimal X support files. On an headless Ubuntu apt-get install tightvncserver pulls only 19.8 Mb of packages. And unlike RFBServer it will just work with any Squeak/Pharo image.


Here's how I do this:

For each VM launch an Xvnc session. You can have has many displays as you need. Display :0runs on the VNC port 5900, display :1on 5901 and so on.

To statrt Xvnc on display :0

Xvnc :0 -nolisten tcp -geometry 1024x726 -depth 24 &

Then launch Squeak on that display

squeak -display :0 -- ~/fullscreen.st  &

fullscreen.st is a simple Smalltalk statup script that adjusts Squeak to the size of the screen

"fullscreen.st"
ScreenController new fullScreenOn

A note on security

By default Xvnc accept connections without a password so I suggest you take at least one of the following precautions.

  • Forces Xvnc to listen on loopback. I use an LD_PRELOAD trick similar to this for that purpose and connect using ssh port forwarding.
  • Block the port on your firewall
  • Read on the -rfbauth argument to setup Xvnc password authentication.
Alexandre Jasmin
I don't need X and WM installed to run Xvnc?
Damir Horvat
I'm doing something like this on a linux VM. I don't remember all the details but I'm taking a look right now.
Alexandre Jasmin
Thanks! I'd really appreciate this solution!
Damir Horvat
Great. I've added some details
Alexandre Jasmin
Great, ssh forwarding does the trick. Thank you.
Damir Horvat
@Damir Since you appear to be using this I felt I had to add a minimum of details about security. Hope that helps.
Alexandre Jasmin
+5  A: 

Don't forget that there are also Smalltalk environments that are specifically designed for headless operation on a server, e.g.:

  • GNU Smalltalk (Unix scripting style, Free Software)
  • GemStone/S (App Server style, Proprietary but gratis for small installations)

One of the specific design goals of Pharo is to divorce the development environment from the core image, for easier deployment, however I don't know how far this effort has come nor whether it also includes removing the GUI entirely.

I'm not sure about VisualWorks, but I wouldn't be surprised if they had a headless mode.

A little bit further out in left field, some people consider Ruby to be "Smalltalk for the Unix server". Although, of course Ruby is a much different and much less beautiful language than Smalltalk.

Have you tried asking on the Seaside mailing lists? They must deal with this stuff all the time. Avi Bryant's company Smallthought Systems, for example, runs both DabbleDB and trendly off Squeak.

Jörg W Mittag
Smalltalk/X is the "Smalltalk for the Unix server" ;-)Actually it is propably the best Smalltalk to build server-like applications, as it compiles into machine-code dlls, which are linked to an executable. No image. Generates nullsoft packages for deployment.
blabla999
And, by the way: Jan Vrani's SmallRuby (a Ruby running inside a Smalltalk VM, compiling to ST-Bytecodes) runs faster than the original !
blabla999
@blabla999: Be vary careful with those statements. SmallRuby does not yet pass the RubySpec suite. In fact, AFAIK, it doesn't even implement enough of the Ruby Specification to even *run* the specsuite. It cannot even run all of the benchmarks in the Ruby Benchmark Suite, which only exercises maybe 30% of Ruby. In the past, almost all Ruby implementations have slowed down *significantly* (sometimes by a factor of up to 100x in extreme cases) when they approached 100% pass rate on the RubySpec. As Kent Beck likes to say: I can be as fast as I want, if I don't have to be correct.
Jörg W Mittag
+7  A: 

As answered in How is the Deployment in different Programming Languages?:

Smalltalk:
Deploying a Squeak or Pharo web application using Seaside and Apache httpd is described in the documentation, chapter Deployment with Apache.

stesch
+1 for the link to the Seaside book!
Frank Shearar
+3  A: 

About VW there series of screencasts with deployment notes http://www.cincomsmalltalk.com/userblogs/cincom/blogView?content=smalltalk_daily_deployment

mou
+11  A: 

Yes, it is possible to deploy Pharo in a "headless" way. Just send the -headless and that's all. Example:

#!/bin/sh

NOHUP="/usr/bin/nohup"
SQUEAK_VM="/usr/bin/squeakvm"
SQUEAK_OPTS="-mmap 100m -vm-sound-null -vm-display-X11 -headless"
SQUEAK="$SQUEAK_VM $SQUEAK_OPTS"
IMAGES_HOME="/home/miguel/squeak/images/azteca"
SCRIPTS_HOME="/home/miguel/squeak/scripts/azteca"
LOGS_HOME="/home/miguel/squeak/logs/azteca"
START_PORT=8080
END_PORT=8093


# Start the Magma image
echo "Starting Magma image"
$NOHUP $SQUEAK $IMAGES_HOME/magma.image $SCRIPTS_HOME/magma.st >> $LOGS_HOME/magma.nohup &

# Start the Seaside images
for PORT in `seq $START_PORT $END_PORT`; do
  echo "Starting Seaside image on port: $port"
  $NOHUP $SQUEAK $IMAGES_HOME/seaside.image $SCRIPTS_HOME/seaside.st
  port $PORT >> $LOGS_HOME/seaside.nohup &
done

It is common to deploy a PharoCore image running Seaside, with in headless mode and running RFBServer (remote buffer server) which is actually a VNC server. Then, you can connect to that image trough a VNC client and you can browse and use the Smalltalk image as if it were locally.

I suggest you to read

http://miguel.leugim.com.mx/index.php/2009/09/18/deploying-seaside-applications/

Or the new seaside book.

Cheers

Mariano Martinez Peck
A: 

Take a look at Smalltalk/X.

blabla999