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.
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.
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.
The system used for this installation was a SunFire T1000 running Solaris 2.10 (U3).
Step 1 – Download Mongrel
# gem install daemons gem_plugin mongrel mongrel_cluster --include-dependencies --no-rdoc --no-ri
- 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
# 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
- 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:
You should now be ready to start Apache (/opt/coolstack/apache2/bin/apachectl start)
Best of luck!