To run Seaside on GemStone/S, you need a 64-bit OS running on 64-bit hardware. This tutorial will walk through the process of setting up a hosted virtual private server on Slicehost. My client machine is a MacBook Pro, and I haven’t tested the process from anything else.
Setup the client machine
In these instructions we will be using your local (“client”) machine to connect to the new virtual private server (“server”) machine. On the client we need a web browser, a telnet/SSH client, and Internet connectivity. I assume you have a web browser and Internet connectivity. If you are on a Macintosh running OSX or if you are on Linux (or another Unix variant) then you should have a SSH client. If you are on Windows, I recommend PuTTY as a SSH client.
Get a Slicehost account
- Open a web browser on http://www.slicehost.com/
- Click the “SIGN UP” button
- Provide your name, email, and billing information
- Put email@example.com down as the referral😉
- Leave the Slice Size as 256 (or more if you want)
- Leave the Linux Distribution as “Ubuntu 8.04.1 LTS (hardy)”
- Enter “glass” (without the quotes) as the name for your slice
- Agree to the terms of service and click “Build my Slice!”
- Watch for an email reporting that your slice is built
Add your server IP to your client hosts file
In these instructions, we will use the hostname “slice” to identify the server as this is easier than using a full IP address
- On Linux or Macintosh, open a local Terminal window and enter the following:
sudo vi /etc/hosts
- On Windows, open a command shell (Start / Run… / cmd), and enter the following:
Edit the file to include your new IP address (as identified in the email from Slicehost) and save the file.
184.108.40.206 slice # Slicehost server for GLASS
Secure your server
Follow these instructions, with a few changes.
- First, replace “demo” with “glass” as the admin user.
- Second, after you create the “glass” users, set the default group to “adm”:
usermod -g adm glass
- As you are setting up iptables, add the following three lines for GemStone’s use later:
-A INPUT -p tcp -m tcp --dport 8008 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 50377 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 50378 -j ACCEPT
- After you finish these changes, you can reboot the machine:
This will terminate your session and end your SSH connection.
Update your server
Log back into your server using the port you opened when you secured the server and the user you created. Note that the “slice” in the following line will be resolved based on our local hosts file that was edited earlier. If you did not modify your hosts file, you would need to enter a full IP address instead of “slice”.
ssh -p 30000 glass@slice
If you properly secured your server, then this should log you in without a password. Now, follow these instructions, with a couple minor changes and additions to update your server.
- .bashrc — I want a slightly different color for my command prompt:
export PS1='\[\e[0;35m\]\h\[\e[0;34m\] \w\[\e[00m\]$ '
- Also, I like to be able to see directories with a shortcut:
alias ll="ls -alF"
- locales — To reduce the risk, update the locale after everything else (especially, upgrading the server which might include a fix for this problem).
- When setting the locale, chose what is right for you (I use “en_US” instead of “en_GB”).
- Time Zone — Select a timezone using the following command and then answering the questions:
- Now apply the selection (shown on the last line) as the system default:
sudo mv /etc/localtime /etc/localtime.bak
sudo ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
Install GemStone/S 64 Bit
On the server, navigate to your home directory:
Download the GemStone/S install script:
Make the script executable. If copy & paste doesn’t work, then go ahead and type the line by hand:
chmod 700 installGemStone2.3-Linux.sh
Install a couple packages that the GemStone script requires:
Now run the script (again, if copy & paste doesn’t work, then type the line by hand):
Among other things, the script will have changed some shared memory kernel settings and we need to reboot for these changes to take effect:
From your client machine, log back into your server.
ssh -p 30000 glass@slice
At this point we need to make a tweek to the configuration file to reflect the Slicehost configuration.
The system configuration file specifies a 500MB shared page cache, which is twice our total RAM. Add a new line to the end of the system config file:
echo "SHR_PAGE_CACHE_SIZE_KB = 100000;" \ >> /opt/gemstone/product/seaside/data/system.conf
Define some environment variables, start GemStone, and start a web server:
source /opt/gemstone/product/seaside/defSeaside startGemstone startSeaside_Hyper 8008
Now using a web browser on your client machine, navigate to Seaside:
This should show the Dispatcher Viewer in your client browser. Note that we are using a non-standard port (8008) to reach our Smalltalk web server (Hyper). At this point, using your client web browser you can “Toggle Halos” and open a Class Browser (click on the Notepad icon next to the word “WADispatcherViewer”).
To stop the Smalltalk web server, return to your client SSH session and press <Ctrl>+<C>. At this point you can stop GemStone and logout.
We have installed GemStone/S on a Slicehost server and served Seaside pages from it. Further posts will look at additional configurations, including running a maintenance gem that will expire (and garbage collect) old sessions.