One Radiant to serve them all

Hi again,

I would like to have only one install of Radiant and its extensions,
but have multiple virtual hosts using it. But not as the Virtual Host
extension does: I want each website to use a different database so
each clients do not share the same admin! How should I do that? An
extension selecting the appropriate database according to the domain
name?

Sean told me that’s “partly the point of ‘instance mode’. You can
install the gem system-wide, and only check out the minimum of files
when you need a new site. Extensions currently have to be installed in
every instance you create, however.”

So is there a way to have the extensions installed one time in one
place? Like replacing the extensions directory with a symlink to a
unique place?

And I like the “minimum files checkout” idea but I’d love a no
checkout solution, then I could point my web server to only one place
and any domain pointing to the machine will use the main virtual host
configuration. The way I don’t even have to configure each domain
individually from the web server.

But maybe it will raise some issues like page caching? I have this
problem with a Rails application that is available as one unique
instance for hundreds of websites. And the content change for each
domain, so I can’t use page caching because pages would overlap each
others in the public/ folder, and I’m forced to use fragment caching.

Thanks!
Jonathan

On May 10, 2007, at 9:25 AM, Jonathan Métillon wrote:

Sean told me that’s “partly the point of ‘instance mode’. You can
install the gem system-wide, and only check out the minimum of files
when you need a new site. Extensions currently have to be installed in
every instance you create, however.”

So is there a way to have the extensions installed one time in one
place? Like replacing the extensions directory with a symlink to a
unique place?

I think you could hack something to work, or create a patch ;_

Though I don’t know that would be necessary…

Check out extension_loader.rb, in particular the method
discover_extensions. Notice that configuration.extension_paths is
used to find places to look for extensions. Then, jump over to
initializer.rb - the Radiant one, not the Rails one. Here you will find:


class Configuration < Rails::Configuration
attr_accessor :view_paths
attr_accessor :extension_paths

 def initialize
   self.view_paths = default_view_paths
   self.extension_paths = default_extension_paths
   super
 end

 def default_view_paths
   [view_path].compact
 end

 def default_extension_paths
   [RADIANT_ROOT + '/vendor/extensions', RAILS_ROOT + '/vendor/

extensions’].uniq
end

 def admin
   AdminUI.instance
 end

end

See that the default_extension_paths indicate that extensions may be
loaded from two places, by default. Perhaps you could simply place
your extensions in RAILS_ROOT + ‘/vendor/extensions’, which, if you
are running in instance mode using the Radiant GEM, would be the one
extension location to rule them all.

I love test driven design…

--- config/environments/test.rb - 8 ---
config.extension_paths << File.join(File.expand_path

(RADIANT_ROOT), ‘test’, ‘fixtures’, ‘extensions’)

aiwilliams

Thanks you Adam, that’s what I needed to know. If I can’t get a solution
to
really use only one radiant install, then I’ll use this solution.

Jonathan