[squeak-dev] Controlling a headless server Squeak through VNC

David T. Lewis lewis at mail.msen.com
Sat Dec 3 21:03:10 UTC 2022


During a recent board discussion, Tim asked about experiences in using VNC
to control server images. There are various ways to do this, but here is how
it is done for the https://squeaksource.com server. The easiest way to see
how it works is to try it out on your own computer, so here is what to do:

- Start with a fresh Squeak image.
- Open a Monticello Browser, and add repository http://source.squeak.org/ss.
- Open the repository and navigate to category update.sscom.
- Select update.sscom-dtl.5.mcm and load it.

When loading is complete, you will see a notifier saying that SqueakSource
is running on port 8888, as well as a pinnable morph for controlling the
RFBServer (for VNC connections).

Pin the RFB control morph so that it stays active. If you close it by
accident, do "RFBServer menu openInWorld" to get it back.

Save the image once and restart it to make sure the startup initialization
is working.

You can now open a web browser on http://localhost:8888 to connect to
the SqueakSource web interface. Only one account will be present in the
repository, this is your administrative user with user name 'admin' and
password 'password'. Changing that password (from the web interface) is
a good idea.

The following will work only on Unix/Linux/OSX:

In the RFBServer menu, in the passwords menu, select "allow empty passwords"

In a terminal window (outside of Squeak), identify the pid of the Squeak VM
process (pgrep -l squeak).

>From the terminal, send a SIGUSR2 signal to the VM process. If the Squeak
VM pid is 1234, then the command is "kill -SIGUSR2 1234".

Back in the Squeak image, you will see the VNC control change from
"RFBServer (stopped)" to "RFBServer :1" to indicate that it is accepting
VNC connections on display number 1. It will stay in this state for the
next 60 seconds.

>From a VNC client program running on the local machine, connect to
localhost:1, and you should have an active connection to the Squeak image.

If you want to run your SqueakSource image on another server, run the
VM with -vm-display-null and use ssh port forwarding if needed to access
the VNC ports.

For example, I have a unix account on the server that hosts squeaksource.com.
When I want to open the running SqueakSource image through VNC, I first
log in to the Linux server with a command like this (except that 10.1.2.3
is not the real address that we are using).
 
$ ssh -L8888:localhost:8888 -L5900:localhost:5900 -L5901:localhost:5901 10.1.2.3

Once logged in, I locate the Squeak VM process and send SIGUSR2 to it. I keep
the login session open to handle the port forwarding while I use VNC.

Then back on my local computer, I open a VNC connection to localhost:1 to
get a connection to the running image. This step needs to be done within 60
seconds of the SIGUSR2, after than no further connections will be accepted.

I used to use a VNC password (settable from the RFBServer menu) but I decided
that it was too much hassle given the 60 second connection enablement window,
which can only be started by someone with login access to the server and
sufficient privilege to send signals to the VM process.

If you want to copy any of these ideas for use in some other Squeak server
application, the interesting bits are in class SSImageInit, especially
SSImageInit class>>enableFRBServerOnSigUsr2.

I should note that RFBServer is written by Ian Piumarta. I don't recall
where it was originally hosted, but a copy of RFB-ikp.8.mcz is in our
source.squeak.org/ss repository, along with later updates that are currently
in use for SqueakSource.

Dave


More information about the Squeak-dev mailing list