Solaris CoolStack 1.3 released

CoolStack is a collection of some of the most commonly used open source applications optimized for the Sun Solaris platform. The latest version of this software suite, Cool Stack 1.3, has just been released. Here is a brief overview:

Notable Additions

  • Python 2.5.2
  • Nginx 0.6.31
  • New Apache modules including mod_python, mod_ruby, mod_dtrace etc.

Updated Versions

  • Apache 2.28
  • Tomcat 5.5.26
  • MySQL 5.1.24
  • PHP 5.2.6
  • Memcached 1.2.5
  • Ruby 1.8.6p114 with Ruby Gems 1.1.1 and Rails 2.0.2

Other Enhancements

  • Ruby performance improvements in the order of 20-30% (with a further 8-15% coming down the line when Ruby 1.8.7 is released)
  • Better support for installing Ruby Gems that require native compilation on SPARC systems

The addition of Nginx an Python support along with the performance improvements in Ruby as well as the additional Apache modules are all very useful additions and have yet again come at just the right time for our organisation. Well done to Shanti and his team for providing almost exactly everything we were hoping for in this release, again!

Smaller C compiler package for Solaris

Over the course of recent months, I have deployed a number of Ruby applications onto Solaris, many of which use a handful of Gem packages. Most of the Gem packages are written in Ruby but a handful are not (e.g. Mongrel, FastThreads and Hpricot) and require native compilation on the host system (part of the installation process).

In order to complete the installation of these Gem packages, you need some form of C compiler. Ordinarily, I would choose GCC, but because the Ruby binaries (and most of the other supporting software packages) I use (i.e. Solaris Coolstack) were compiled using Sun Studio, using GCC is not really an option. So, instead I have to install Sun Studio.

Now, don’t get me wrong, I’ve nothing against the Sun Studio product per say (actually, it’s a superb product). My problem is rather that, in order to install a basic C compiler on my system, I have to download, unzip, untar and then install from a now enormous 1GB (zipped) file (as of Sun Studio 12). This is a real pain and takes a very, very long time (unzip along takes over 15 minutes due to use of Bunzip2 compression). This is all the more painful (and wasteful) when you consider that the disk space consumed by the installation of just the C compiler is a mere 200MB from this 1GB monster.

What I would like (and have requested) is a reduce-size package that contains a basic C compiler only – one that would be used purely for native compilation of the likes of Ruby Gem packages.

Here’s hoping…

To script or not to script

In an interesting article on the merits (or not) of scripting languages, James Turner outlines where some of their strengths and weaknesses lie. He uses Perl as the example in this instance but on reading the article I found that many of the pros and cons readily apply to most other scripting languages I’ve used (Tcl, Python, Bash, Sh).

In particular, his comments about them being strong on cross-platform support and weak on performance-related applications definitely ring true from my past experiences with Tcl/Tk. However, one point that he did not make, which I feel is definitely one of scripting languages’ stronger points, is in the area of custom testing and debugging, in the context of prototype product design and integration.

The likes of Perl, Python and/or Tcl really can enable you to glue together some pretty compelling, custom-made testing utilities, often without the need for complicated frameworks or other plugins. In particular, the ability to create your own extensions (using C or even SWIG) can make for some pretty powerful, tailor-made manufacturing test tools (trust me, I’ve been there!).

Of course this may not suit everyone’s needs, and there will be those that will opt for off-the-shelf products that do similar. However, if you are dealing with a newly designed product or hardware appliance featuring custom firmware not seen before, that needs to run on several different platforms, then a decent scripting language will most definitely be your friend.

Source: CIO.com

Uninstalling Sun Studio

I recently had reason to upgrade to a newer version of Sun Studio on a Solaris 10 system. I had Studio 11 installed but needed to go to version 12 for better support of natively compiled Ruby Gem packages (e.g. mongrel). However, uninstalling Sun Studio is not the most readily documented thing in the world so, for my own future reference, here is the easiest way to do it:

# cd /var/sadm/prod/com.sun.studio_11
# ./batch_uninstall_all

After this, just follow the on-screen instructions …

Native Ruby Gems require Sun Studio 12 with CoolStack 1.2

A substantial number of Ruby Gem packages are written in Ruby itself and install quite neatly using a simple gem install command. However, a number of Gem packages are partly written in C and require some compilation during installation (e.g. hpricot, fastthread and mongrel). This requires you to have a C compiler on the system where you are installing the packages, which is a real pain, but that’s a gripe for another day.

We recently upgraded to CoolStack 1.2 but when we tried to install the Gem packages above, we ran into trouble when the installer attempted to compile the native code for the package. The compiler (Sun Studio 11) complained about the definition of the NORETURN macro in /opt/coolstack/lib/ruby/1.8/i386-solaris2.10/config.h as follows:

syntax error before or at: __attribute__
warning: old-style declaration or incorrect type for:
__attribute__
warning: syntax error: empty declaration
...
cc: acomp failed for hpricot_scan.c

It turns out that the new version of Ruby (1.8.6) that is included with CoolStack 1.2 contains some GCC-oriented macro definitions that Sun Studio 11 does not support. The solution was to upgrade to Studio 12.

Huge thanks go to Basantk for helping to resolve this.

Solaris CoolStack 1.2 released

CoolStack is a collection of some of the most commonly used open source applications optimized for the Sun Solaris OS platform. I’ve been tracking the release of the next version, CoolStack 1.2, for some time and see that it has just been released. Here is a brief overview of what it gives you:

  • Apache 2.2.6 with mod_jk-1.2.25, mod_proxy and SMF support.
  • PHP 5.2.4 with FastCGI support.
  • APC 3.0.14.
  • MySQL 5.0.45 with ndbcluster and SMF support.
  • Memcached 1.2.2.
  • Squid 2.6.16 with SMF support.
  • Tomcat 5.5.23 with SMF support.
  • Ruby 1.8.6 with RubyGems and Rails 1.2.3.
  • lighttpd 1.4.18.
  • Perl 5.8.8 with DBI-1.59, DBD-mysql-4.005 and Sys-Syslog-0.18 extensions

As you can see, CoolStack is now a pretty serious software bundle and there isn’t much it doesn’t give you (although DTrace support for Ruby would be a useful addition). The addition of Tomcat and SMF support (SMF allows easier management of Solaris services) along with the additional Apache modules and updated revisions of Apache, MySQL, Ruby and Rails tick a large number of boxes in our organisation as we previously had to build several Apache modules by hand, struggled with lack of Perl DBI/DBD extensions and spent far too long constructing SMF manifests for many of the applications.

So, well done to Shanti and his team for providing almost exactly everything we were hoping for in this release! CoolStack has now become an integral part of our software infrastructure, reducing our service deployment times considerably.

Apache + Mongrel on Solaris

Apache is an excellent Web Server but does not handle Rails projects very well. Mongrel is a Ruby-based library that can assist things like Apache with management of dynamic content.

Credit / Reference Site

We owe a great deal of thanks to this article posted by codehale on the same topic. The article you are reading here is a summation of notes taken during a recent installation of Apache and Mongrel on the Solaris operating system, based on codehale’s article.
Prerequisites

Several software packages need to be pre-installed on Solaris in order for Mongrel to install and operate correctly. I have listed them below along with the version I used. The version of Apache and Ruby were both taken from the Solaris CoolStack software bundle.

  1. Apache 2.2
  2. Ruby 1.8.5
  3. Ruby Gems 0.9.2
  4. Ruby on Rails 1.2.3
  5. Sun Studio 11

To install the software, simply download (and unzip) the relevant file from the above site(s) and install it (as root) using the pkgadd –d command.

Installation Procedure
The system used for this installation was a SunFire T1000 running Solaris 2.10 (U3).

Step 1 – Download Mongrel

Commands

# gem install daemons gem_plugin mongrel mongrel_cluster --include-dependencies --no-rdoc --no-ri

Notes

  • When asked about which version of Mongrel and FastThread, we chose the newest version for ruby (not win32).
  • The above command will attempt to compile and install some native code and requires a C compiler. If you are using Sun Studio, you should also read my other post regarding Ruby and Sun Studio.
  • If you are using GCC, then you may also require ginstall. However, ginstall is not available for Solaris so we overcame this by installing the GNU coreutils package and then creating a symbolic link: /usr/local/bin/ginstall pointing at /usr/local/bin/install (after coreutils was installed).
  • The reference site above also recommends that the “sendfile” utility be removed from your system (if installed). We used the “pkginfo | grep sendfile” command to verify that it was not present on our system.

Step 2 – Configuring Mongrel Clusters

Commands

# cd /opt/tssg/feedhenry/wc
# mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 3 -c /opt/myrubyapp/public
# vi /opt/myrubyapp/config/mongrel_cluster.yml (and change port setting to 8000 - see below)
# mongrel_rails cluster::start -c /opt/myrubyapp/config/mongrel_cluster.yml

Notes

  • The -N value above represents the number of clusters required. We followed the example and chose 3.
  • The second command above creates a mongrel_cluster.yml file. However, we noticed that the port setting in this file was incorrect after it was created. It was “ath” instead of 8000 (not sure why).
  • The final command should produce one line of output for each cluster configured indicating that each cluster was correctly started.
  • You should also examine the logs/mongrel.log file and ensure that the clusters started on the correct ports (8000, 8001, 8002 etc). This is how we noticed that the .yml file had the wrong port setting.
  • You can use the mongrel_rails cluster::stop command to stop the clusters again (-c option also required here)

Step 3 – Configuring Apache

You will need use some additional Loadable Modules for Apache. Refer to this post for details on which ones you need and how to build them. You can then follow the instruction in the reference post.

Once these files were configured and placed in the conf/extra directory, we simply had to make one change to the main Apache configuration file (conf/httpd.conf) to ensure that these new files were loaded by Apache. This consisted of the following command:

Include conf/extra/myapp*.conf

You should now be ready to start Apache (/opt/coolstack/apache2/bin/apachectl start)

Best of luck!

Solaris CoolStack, Sun Studio and Ruby

If you are using the Solaris CoolStack edition of Ruby (CSKruby) with Sun Studio 11 (SUNWspro) then you may need to make a small change to one of the Ruby configuration files to tell it where Sun Studio is installed. I would have have expected the installer for the Ruby package to detect this but, alas, it does not.

In my case, this problem will only manifested itself when I attempted to install some platform-specific Ruby Gems packages (hpricot, fastthreads, mongrel).
To remedy this problem:

  1. Edit the file /opt/coolstack/lib/ruby/1.8/sparc-solaris2.10/rbconfig.rb
  2. Search for all instances of SUNWspro and change to the correct location
  3. Save the file and repeat your “gem install” command

Installing Interactive Ruby on Ubuntu Linux

It would appear that the version of Ruby that come with Ubuntu Linux (6.06) does not contain everything you might expect. I installed Ruby on Rails version 1.8 onto my system (which requires Ruby and Ruby Gems) but soon after installing it, a colleague realised that I did not have the Interactive Ruby application irb.

We made several attempts to get an updated version of Ruby 1.8 from the internet but no matter what we tried, the system always reinstalled the same, locally held version. We could not seem to figure out how to tell the system to look on the Internet for updated versions of Ruby (and other packages). I was a less than trivial task getting irb installed but here is how we did it.

  1. We used the Synaptic Package Manager to install Ruby 1.8 and then followed the instructions on the Ruby on Rails website to install Ruby Gems and Ruby on Rails itself.
  2. Exited from Synaptic Package Manager and continued from the command-line
  3. Edit /etc/apt/sources.list and uncomment all entries (save file)
  4. # apt-get update ;;; updates the package listings on this system
  5. # apt-get clean ;;; removes old package listings (confusing that this command came after the update command)
  6. # apt-cache search ruby ;;; Look to see if any new Ruby packages are available
  7. # apt-get install ruby1.8 ;;; Install Ruby 1.8
  8. # apt-get install irb1.8 ;;; Install Interactive Ruby 1.8

For some reason, the installer does not create the appropriate symbolic links for ruby and irb so you might have to create these manually.

One final note that the apt-get upgrade command can be used to download and install all available updates for your system. This is the same as clicking the orange “Install Updates” icon at the main console. A system reboot will invariably be requried after this.