Login

Installing a Gemstone Seaside Server on Ubuntu 10.10

I'll assume you've already installed Apache and now want to install Gemstone behind it as a Seaside server. Let's install a few things that we're going to need later, just to get the dependencies out of the way. Login to your server/workstation as an admin user, someone who can sudo.

sudo aptitude install bc zip build-essential apache2-threaded-dev ia32-libs

Now let's setup the user we're going to run Gemstone under.

sudo adduser glass

Add him to the admin group so he can sudo.

sudo usermod -a -G admin glass

Login as this user.

su glass
cd

Download Gemstone and install it.

wget http://seaside.gemstone.com/scripts/installGemstone.sh
chmod +x installGemstone.sh 
./installGemstone.sh

Download some init scripts so we can setup Gemstone as a service rather than manually starting it.

wget http://onsmalltalk.com/downloads/gemstone_initd_scripts.tgz
tar xf gemstone_initd_scripts.tgz

Edit each of these scripts and change the line RUNASUSER=USER to RUNASUSER=glass and change the first line to #!/bin/bash instead of #/bin/sh as the Gemstone scripts need bash and Ubuntu changed the bin/sh link to point to dash instead of bash which won't work.

Install the init scripts. There's a shorter way to write these, but it will fit better on the blog if I do each one separately.

sudo mv gemstone_initd_scripts/gemstone /etc/init.d/
sudo mv gemstone_initd_scripts/gs_fastcgi /etc/init.d/
sudo mv gemstone_initd_scripts/netldi /etc/init.d/
chmod a+x /etc/init.d/gemstone 
chmod a+x /etc/init.d/gs_fastcgi
chmod a+x /etc/init.d/netldi 
sudo chown root:root /etc/init.d/gemstone
sudo chown root:root /etc/init.d/gs_fastcgi
sudo chown root:root /etc/init.d/netldi  
sudo update-rc.d gemstone defaults
sudo update-rc.d gs_fastcgi defaults
sudo update-rc.d netldi defaults

Start just the gemstone and netldi services.

sudo /etc/init.d/gemstone start
sudo /etc/init.d/netldi start

Grab GemTools and fire it up. I'm installing on my local machine so I can just fire this up here; if you're installing on a remote server, refer to my previous post about setting up X11Forwarding and running GemTools on a remote host.

wget http://seaside.gemstone.com/squeak/GemTools-1.0-beta.8-244x.app.zip
unzip GemTools-1.0-beta.8-244x.app.zip
GemTools-1.0-beta.8-244x.app/GemTools.sh

Edit the connection to point at localhost and login to Gemstone and open Monticello; open the MetacelloRepository; load either ConfigurationOfSeaside28 or ConfigurationOfSeaside30. I'm still on 2.8 so that's what I'm loading. If you're going to load 3.0, you'll need to edit the gs_fastcgi script accordingly as it's built to startup 2.8. Just change the DAEMON line to runSeasideGems30 instead of runSeasideGems.

Click the admin button on the gem launcher and check commit on almost out of memory option (just in case loading anything takes up too much temp space), then run ConfigurationOfSeaside28 load in the workspace. Once Seaside is loaded, we can continue and start up the Seaside gems.

sudo /etc/init.d/gs_fastcgi start

Next we need to setup Apache to be able to use FastCGI and enable a few modules we'll need and will need to first build the FastCGI module.

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
echo "LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so" > fastcgi.load
sudo mv fastcgi.load /etc/apache2/mods-available/
sudo a2enmod fastcgi expires proxy proxy_http proxy_balancer deflate rewrite

And fix the host file so FastCGI doesn't wig out over the ip6 address you're not even using.

sudo nano /etc/hosts

Comment out ipv6 line like so.

#::1     localhost ip6-localhost ip6-loopback

Now create a configuration for the site.

sudo nano /etc/apache2/sites-available/gemstone

Using the below config and modifying where necessary.


ServerAdmin your@someplace.com

Listen 8081
Listen 8082
Listen 8083

FastCgiExternalServer /var/www1 -host localhost:9001 -pass-header Authorization
FastCgiExternalServer /var/www2 -host localhost:9002 -pass-header Authorization
FastCgiExternalServer /var/www3 -host localhost:9003 -pass-header Authorization

<VirtualHost *:80>
    ServerName yourComputerName
    RewriteEngine On
    DocumentRoot /var/www/

    #http expiration
    ExpiresActive on
    ExpiresByType text/css A864000
    ExpiresByType text/javascript A864000
    ExpiresByType application/x-javascript A864000
    ExpiresByType image/gif A864000
    ExpiresByType image/jpeg A864000
    ExpiresByType image/png A864000
    FileETag none

    # http compression
    DeflateCompressionLevel 9
    SetOutputFilter DEFLATE
    AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml$
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Let apache serve any static files NOW
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -f
    RewriteRule (.*) %{DOCUMENT_ROOT}$1 [L]

    <Proxy *>
       AddDefaultCharset off
       Order allow,deny
       Allow from all
    </Proxy>

    ProxyPreserveHost On

    #main app
    ProxyPass / balancer://gemfarm/
    ProxyPassReverse / balancer://gemfarm/

    <Proxy balancer://gemfarm>
        Order allow,deny
        Allow from all
        BalancerMember http://localhost:8081
        BalancerMember http://localhost:8082
        BalancerMember http://localhost:8083
    </Proxy>
</VirtualHost>

<VirtualHost *:8081>
        DocumentRoot /var/www1
</VirtualHost>

<VirtualHost *:8082>
        DocumentRoot /var/www2
</VirtualHost>

<VirtualHost *:8083>
        DocumentRoot /var/www3
</VirtualHost>

Make a few symbolic links for those www directories, FastCGI seems to want these to all be different and Apache will complain if they don't actually exist.

sudo ln -s /var/www /var/www1
sudo ln -s /var/www /var/www2
sudo ln -s /var/www /var/www3

And enable the new site and restart Apache.

sudo a2ensite gemstone
sudo /etc/init.d/apache2 restart

Hopefully you've gotten no errors at this point and you can navigate to http://yourMachineName/seaside/config and see that everything is working. Gemstone is now installed as a service, as is netldi and the Seaside FastCGI gems, and they'll start up automatically when the machine starts.

I'm not thrilled with running the Seaside gems this way because if they die nothing will restart them. I'll be following up later with a post on running the Seaside gems and maintenance gem under Monit which will ensure they're restarted should a gem crash for any reason. Gemstone itself and netldi I'm not worried about and this approach should work fine.

Since I did this on my workstation which already had apache installed as well as other things I run, I may have missed a dependency or two that I already had installed and didn't notice. If the above procedure doesn't work for you for any reason, please let me know what I overlooked.

Comments (automatically disabled after 1 year)

Bart Veenstra 1429 days ago

Very coool! I alread setup a gemstone server using the instructions on the glassdb page, but that did not include the automatic starting of gemstone and other services. Do you run this as a headless server? maybe you can add instructions on how to access it from outside the box (as I would run it on a headless VM)

Ramon Leon 1429 days ago

Already mentioned how to access headless server in the previous post. Mentioned again about halfway through the article when discussing launching GemTools.

Nick Ager 1419 days ago

I'm eagerly anticipating you upcoming blog post on integrating Gemstone and Monit.

Max Leske 1335 days ago

Thanks mate! A huge help.

BTW, you missed the apache rewrite module.

Cheers, Max

Ramon Leon 1335 days ago

Thanks, fixed.

porno izle 1114 days ago

uu beybi great job. porno izle.

about me|good books|popular posts|atom|rss