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 slicehost@jgfoster.net 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:
notepad C:\WINDOWS\system32\drivers\etc\hosts
Edit the file to include your new IP address (as identified in the email from Slicehost) and save the file.
209.20.83.1 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:
reboot
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:
tzselect
- 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:
cd ~
Download the GemStone/S install script:
wget http://seaside.gemstone.com/scripts/installGemstone2.3-Linux.sh
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:
install bc
install zip
Now run the script (again, if copy & paste doesn’t work, then type the line by hand):
./installGemStone2.3-Linux.sh
Among other things, the script will have changed some shared memory kernel settings and we need to reboot for these changes to take effect:
sudo reboot
Configuring GemStone/S
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
Start GemStone/S
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:
http://slice:8008/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.
stopGemstone
exit
Conclusion
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.
11 comments
Comments feed for this article
September 8, 2008 at 9:39 am
GLASS on Slicehost « (gem)Stone Soup
[…] 8, 2008 in Gemstone James has a post and a couple of screencasts on getting GLASS running on Slicehost. […]
November 15, 2008 at 2:58 pm
isaiah
In the GemStone/S documentation they recommend atleast 1GB of ram. Say i got 256mb ram on my slice, would glass still run reasonable well ?
November 16, 2008 at 4:20 am
James Foster
Yes, 256 is fine. In fact, you can see in step #4 above under “Get a Slicehost Account” that is what I am using.
December 15, 2008 at 11:47 am
Install Gemstone/S 64 on a KVM virtual machine | The command line
[…] instructions are very similar to the slicehost setup from James Foster’s post, but this time on a KVM virtual […]
January 21, 2009 at 8:21 am
Using GemTools to Access and Update GLASS « Programming Gems (on GemStone)
[…] next step is to start the NetLDI service. This service listens on a port (during our initial setup the script defined 50377 as the port for NetLDI), starts gems in guest mode with the glass account, […]
July 21, 2009 at 6:48 pm
Kent Beck
James,
Thank you for the detailed instructions. Everything seemed to go perfectly until I got to the:
http://slice:8008/seaside/
step. My browser just waits a while and then gives me:
Error 101 (net::ERR_CONNECTION_RESET): Unknown error.
I’m at a bit of loss to even figure out how to debug this. Any suggestions?
Kent
July 21, 2009 at 7:07 pm
James Foster
Kent, My suspicion is that the firewall is blocking the request. I’d try using telnet to see if the connection works. From within the slice try ‘telnet hostname 8008’. That should connect. If you are really adventuresome, you can type ‘GET /seaside’ and press return twice. That should give some nonsense back and disconnect you. Next try the same command from outside. If it works differently, then something is blocking the connection and I’d review the “Secure Your Server” section above.
James
July 21, 2009 at 7:37 pm
Kent Beck
Sorry to be dense here. I suspect you are right, that I did something wrong in setting up the firewall.
I see what you’re trying to do with debugging. Unfortunately, telnet tries to interpret “8008” as a host name, not a port number.
I’ll eyeball the iptables step again. I suppose another approach is to go back to a completely open firewall, make sure access works, then add rules one at a time until access doesn’t work again.
July 21, 2009 at 8:56 pm
James Foster
I updated the comment to add a hostname to the telnet command.
July 21, 2009 at 7:51 pm
Kent Beck
I got it figured out. The rules you suggest adding to iptables need to be at the beginning of the file, not at the end. Thanks for the help.
January 12, 2010 at 4:56 pm
GemStone on SliceHost « Programming Gems (on GemStone)
[…] 12, 2010 in Uncategorized Some time ago I prepared some instructions for setting up GemStone on SliceHost.com. Since then some things have changed and I’ve had […]