customizing the default manifests

4 views
Skip to first unread message

Andrew Roth

unread,
Nov 2, 2009, 3:48:52 PM11/2/09
to railsmachin...@googlegroups.com
Hello,

I want to add a module to the default apache2 manifest.  I was about to add a "a2enmod('expires')" (I want mod_expires) to lib/moonshine/manifest/rails/apache.rb in my moonshine fork, but I wonder if this is the right/best way to do that.  Would it be better to copy the manifest locally and customize it there, as a best practice?

-Andrew Roth

Jesse Newland

unread,
Nov 2, 2009, 4:07:09 PM11/2/09
to railsmachin...@googlegroups.com
There are about a million ways to do this, thanks to a Moonshine manifest being just a Ruby class with a bunch of methods. One way would be to create a module in lib/ that has one method that makes the appropriate calls:

  module MoonshineApacheModules
     def apache_modules
      a2enmod 'expires'
    end
  end

Then, in your manifest:

  require 'path/to/moonshine_apache_modules.rb'
  
 class ApplicationManifest < Moonshine::Manifest::Rails
  
    ...
    include MoonshineApacheModules
    recipe :apache_modules
  end

If you're totally crazy, you could even do some alias_method_chain magic add extra features to the 'apache_server' recipe in apache.rb, since recipes are just methods. :)

However, if you find yourself commonly starting a project with some additions to a moonshine manifest, the best practice is probably creating a moonshine plugin with those customizations:


Here are a couple sample plugins:


Now that I think about things, the 'expires' module is pretty commonly used in the deployment of Rails apps, and I wouldn't mind adding that to the default stack. Pull request? ;)

Let me know if you have questions about any of this!

Regards -

Andrew Roth

unread,
Nov 4, 2009, 11:25:24 AM11/4/09
to railsmachin...@googlegroups.com
Good ideas.  If you're happy with putting expires in to the core repository, that's my favored solution. :)  I'll send a pull request later.

-Andrew

Andrew Roth

unread,
Nov 9, 2009, 6:10:51 AM11/9/09
to railsmachin...@googlegroups.com
Got another one: ssl module.  Would you be ok with putting that in core as well, or should I use one of the customization techniques so it's just on mine?

-Andrew

On Mon, Nov 2, 2009 at 4:07 PM, Jesse Newland <je...@railsmachine.com> wrote:

Andrew Roth

unread,
Nov 9, 2009, 6:15:42 AM11/9/09
to railsmachin...@googlegroups.com
Oh, I see there's already support for ssl: http://wiki.github.com/railsmachine/moonshine/adding-an-ssl-certificate

-Andrew
Reply all
Reply to author
Forward
0 new messages