The first cut is working (for me at least) and I’ve put up a SVN repository at http://svn.oobaloo.co.uk/svn/accelerator_recipe/ that people can grab the recipe from.
accelerator_tasks.rbcontains the Accelerator specific tasks. This includes one for creating the Apache 2.2 proxying configuration file, and, the Solaris Service Management Facility configuration file (which lets the accelerator boot mongrel when necessary.
apache_vhost.erbis the template for the Apache configuration file
smf_template.erbis the template for the SMF configuration file
To use, export the files from SVN to your config directory. So, inside your application’s home directory do
svn export http://svn.oobaloo.co.uk/svn/accelerator_recipe config
Ensure you’ve got a working
mongrel_cluster.yml configuration file, and if you haven’t already, create the capistrano deployment recipe
cap –apply-to /my/rails/app
Then, add the following to the top of
and add two new properties (used to configure Apache for the new domain name)
set :server_name, “www.myapp.com”set :server_alias, “myapp.com”
See the Apache docs for more info about the
ServerAlias directives if you don’t know what they do.
Finally, change the restart task to use the new
smf_restart task (which in turn calls the
task :restart do smf_restartend
Once you’ve added everything to Subversion, you ought to be able to do
cap setup to create the initial app directories, create your SMF configuration file, and, Apache 2.2 virtual host configuration file. The SMF configuration file goes into your application’s shared directory (that Capistrano creates). The Apache 2.2 configuration file goes to
cap deploy to do a new release, and call restart which will try and start your Mongrel service. I’ve also created a
svcs task that will show you all the services installed into the SMF. If your Mongrel instances don’t fire up, check the result by running
svcs -x, or check out the
/var/svc/log/network-mongrel-myapp-production:default.log and see whether there’s any info about why it didn’t start.
This is pretty rough and ready, but, it works for me with a stock Accelerator. However, this recipe does assume you are deploying your web and application servers to the same accelerator. It shouldn’t be tough to fix it up to figure out how to deploy to different accelerators, but I haven’t done it yet. Also, I’m still not overly familiar with Capistrano so if I’ve made some glaring mistakes in how things are done, also, please let me know (this is more of a first guess than anything, I’m hoping people will correct me).
I’ve posted something similar to the TextDrive forum, check out that thread in case people post follow-ups there too.
Most importantly, if people do use it and fix stuff up, please, please send the fixes back and I’ll get them committed into SVN for everyone.