You are currently browsing the category archive for the ‘Slicehost’ category.
GemStone/S 64 Bit 2.3.0 is now available via anonymous FTP from ftp://ftp.gemstone.com/pub/GemStone64/2.3.0/. Since we have been using beta versions up until now, we should reinstall our server with the new executables and database (there is no officially supported path to move from beta to released code). If you have not yet setup GemStone/S on your server, then you should be able to do so following these instructions. If you already installed a beta version of GemStone/S, then you will need to follow the instructions in this post.
First, log in to your Slice. I have an alias ‘slice’ that takes care of the ssh address and port. Once logged in, run the following command that sets the needed environment variables:
Now we will stop any GemStone processes:
runSeasideGems stop stopGemstone stopnetldi
Next, we will move to the proper directory and get the new version of GemStone/S:
cd /opt/gemstone wget ftp://ftp.gemstone.com/pub/GemStone64/2.3.0/GemStone64Bit2.3.0-x86_64.Linux.zip unzip GemStone64Bit2.3.0-x86_64.Linux.zip
Now we remove the link to our old product tree and set up a link to the new product tree:
rm product ln -s /opt/gemstone/GemStone64Bit2.3.0-x86_64.Linux product
To verify that we have the new product, launch Topaz and check that the build number is 20209:
At this point we can update the config file, copy an extent, and start the server:
echo "SHR_PAGE_CACHE_SIZE_KB = 100000;" \ >> /opt/gemstone/product/seaside/data/system.conf cp $GEMSTONE/bin/extent0.seaside.dbf $GEMSTONE_DATADIR/extent0.dbf chmod +w $GEMSTONE_DATADIR/extent0.dbf startnetldi -g -a glass -p 50378:50378 startGemstone runSeasideGems start gslist -cvl
If all goes well, then you should have a new database running Seaside. Try it out by browsing to the site from your client:
At this point follow these instructions to see if Dale has any updates to GLASS.
In a recent post I described how to set up Apache and GemStone/S on Slicehost and we ended with running Seaside. This post will describe how to connect to your GLASS system from GemTools and update Seaside (and related packages) to the latest release.
In a local shell, we log in to the Slicehost server using SSH (earlier I described an alias ‘slice’ that I have for this command):
ssh -p 30000 glass@slice
Once connected we run a script to set some environment variables and verify that the system is running:
gslist does not show the appropriate processes, start them:
The 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, and uses a special port range (in our case one port, 50378, use more if there will be many concurrent connections) to communicate with the newly-started gem.
startnetldi -g -a glass -p 50378:50378
Now we can return to our client environment and start GemTools. GemTools is a Squeak application available from the downloads page at seaside.gemstone.com. In GemTools we need to identify the GLASS host by IP address or host name. In my case I’ve added ‘slice’ to my hosts file so I can give the host name. Click the “Login” button to connect to GemStone.
On the Transcript window there are a row of buttons. Click “Monticello” to open a Monticello browser. In this browser we have a list of the packages currently installed in our system. Select the GLASS package on the left pane and note the list of servers for that package in the right pane. Select the http server and click the “Open” button. This will open a new window with the packages available on that server in the left pane and a list of versions in the right pane. Select the latest one (at the top), and click the “Load” button. Each of these steps is somewhat slow, so be patient. Once the package is loaded, you can close the Monticello browsers.
From the Transcript, you can click “Browse” to browse code and you can execute Smalltalk code in the text entry widget.
This use of GemTools will form the basis of much of what we do later in developing a Seaside application in GLASS.
In a recent post I described the process for installing and configuring Apache and FastCGI on Slicehost. This 4-minute screencast shows me going through the process. At the end we are running Seaside on GemStone/S with Apache serving static pages and redirecting requests for dynamic pages to a round-robin series of Gems configured to handle the requests through FastCGI.
A compressed version (320×240) is available on YouTube:
In an earlier post I described how to set up a Slicehost server to run GemStone/S and we demonstrated serving web pages using a Smalltalk web server. In this post we look at installing and configuring Apache and FastCGI so that you can run Seaside in GemStone/S behind Apache.
Start by logging in to your Slice (I’ve created an alias name ‘slice’ for this command):
ssh -p 30000 glass@slice
Next, install Apache:
install apache2 apache2.2-common apache2-mpm-prefork apache2-utils \ libexpat1 ssl-cert apache2-threaded-dev
Now you should be able to navigate to your site and see the words “It Works!” by entering the following in a browser:
GLASS can be configured to use FastCGI and we need to download, build, install, and enable it:
wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz tar zxvf mod_fastcgi-current.tar.gz cd mod_fastcgi* cp Makefile.AP2 Makefile make top_dir=/usr/share/apache2 sudo make install top_dir=/usr/share/apache2
Create a file that will load the FastCGI module (we will enable it later):
echo "LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so" \ > fastcgi.load sudo mv fastcgi.load /etc/apache2/mods-available/
Now we need to configure Apache to route requests to GemStone/S. Apache has a rich set of configuration options, including places to put config files. The basic model is that Apache reads /etc/apache2/apache2.conf and that file has a series of includes that pull in other files. Following the general spirit of how Apache seems to expect things, we can add a configuration file that references another config file:
echo "Include /opt/gemstone/etc/apache2.conf" > glass sudo mv glass /etc/apache2/sites-available/
Now we need to create some directories and set some permissions.
chmod 775 /opt/gemstone cd /opt/gemstone mkdir etc www www/glass1 www/glass2 www/glass3
Now we can create our Apache config file named /opt/gemstone/etc/apache2.conf and past the following lines (edit the second line that has an email address):
ServerName glass ServerAdmin email@example.com Listen 8081 Listen 8082 Listen 8083 FastCgiExternalServer /opt/gemstone/www/glass1/seaside \ -host localhost:9001 -pass-header Authorization FastCgiExternalServer /opt/gemstone/www/glass2/seaside \ -host localhost:9002 -pass-header Authorization FastCgiExternalServer /opt/gemstone/www/glass3/seaside \ -host localhost:9003 -pass-header Authorization <VirtualHost *:80> DocumentRoot /opt/gemstone/www CustomLog /opt/gemstone/log/glass-access.log combined ErrorLog /opt/gemstone/log/glass-error.log LogLevel info <Directory "/opt/gemstone/www"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <Proxy /seaside> AddDefaultCharset off Order allow,deny Allow from all </Proxy> ProxyPreserveHost On #make proxy rewrite urls in the output ProxyPass /seaside balancer://gemtrio ProxyPassReverse /seaside balancer://gemtrio <Proxy balancer://gemtrio> Order allow,deny Allow from all BalancerMember http://localhost:8081/seaside BalancerMember http://localhost:8082/seaside BalancerMember http://localhost:8083/seaside </Proxy> </VirtualHost> <VirtualHost *:8081> CustomLog /opt/gemstone/log/glass-vhost-8081-access.log combined ErrorLog /opt/gemstone/log/glass-vhost-8081-error.log LogLevel warn DocumentRoot /opt/gemstone/www/glass1 </VirtualHost> <VirtualHost *:8082> CustomLog /opt/gemstone/log/glass-vhost-8082-access.log combined ErrorLog /opt/gemstone/log/glass-vhost-8082-error.log LogLevel warn DocumentRoot /opt/gemstone/www/glass2 </VirtualHost> <VirtualHost *:8083> CustomLog /opt/gemstone/log/glass-vhost-8083-access.log combined ErrorLog /opt/gemstone/log/glass-vhost-8083-error.log LogLevel warn DocumentRoot /opt/gemstone/www/glass3 </VirtualHost>
Now we are ready to enable the new site and restart Apache:
sudo a2enmod proxy_balancer sudo a2enmod proxy_http sudo a2enmod fastcgi sudo a2dissite 000-default sudo a2ensite glass sudo apache2ctl restart
Create a new home page:
echo '<html><body><h1><a href="seaside">Seaside Rocks!</a></h1></body></html>' \ > /opt/gemstone/www/index.html
If there are no errors, then you should be able to view the new home page by refreshing your web browser. Now we need to start GemStone and start some Gems:
source /opt/gemstone/product/seaside/defSeaside startGemstone runSeasideGems start
At this point you should be able to refresh your browser and follow the link to Seaside. You can log out of the Slicehost virtual private server at this point and leave GemStone/S running.
In my earlier post I have instructions for installing GemStone/S on a Slicehost virtual private server. In that example, I took the default Linux distribution of Ubuntu 8.04.1 LTS (hardy). People often ask if GemStone/S requires a particular distribution. The answer is “No.” Instead, GemStone identifies which distribution is tested (SuSE Linux ES 10), and which libraries are assumed (kernel version 126.96.36.199-0.9-smp and glibc 2.4-31.5). Because Linux is free and open source, there are a wide variety of variations.
In fact, the discussion of Linux Distributions is sufficiently complex that it has its own page on Wikipedia. As long as a distribution includes the required libraries, it should support GemStone/S. The variations are in how the system is managed and how the packages are installed. If you have a Linux Distro that you like, then presumably you know how to use it. If you don’t have much experience (and I’m in that camp), then it might be better to use something known to work (and for which there are good resources to help). In my Slicehost example, I took the default and found that there were excellent instructions on how to set up the server.
If you use another distribution, feel free to post your experience in the comments.
Based on the earlier instructions, we have three screencasts on how to set up GLASS on Slicehost.
Update: You can get them from YouTube in 320×240 resolution (see below) or you can get them in 800×600 resolution from these links: Slicehost-1.mov (50 MB), Slicehost-2.mov (55 MB), and Slicehost-3.mov (53 MB).
In Part 1, we obtain a Slicehost account and secure our new server:
In Part 2, we update the server and do some basic configuration:
IN Part 3, we install GemStone/S, start a Seaside server, and browse code:
If you have problems with YouTube, check out the Vimeo list.
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 firstname.lastname@example.org 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.
188.8.131.52 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.