Host multiple separate websites on the same Radiant installation each with their own users, pages, snippets and layouts (soon to be supporting other extensions).

Administer users and sites from any domain using your administrative accounts and manage website content by logging into each domain.

IMPORTANT NOTES ABOUT VHOST

  • Not compatible with the multi_site extension

  • Uses the scoped_access plugin, make sure none of your extensions have a conflicting version of the plugin.

  • Hooks into the Radiant ‘bootstrap’ functionality and currently overwrites the standard templates with a modified version of the Simple Blog (i.e. no Styled Blog or Coffee template)

INSTRUCTIONS Currently (April 26th, 2009) you need the freshest version of Radiant (0.7.1) which includes Rails 2.2.2 to run vhost. The following instructions use git to directly check out the latest version of Radiant so you may need to adjust them slightly. Once the Radiant gem supports Rails 2.2.2 these instructions will reflect the proper way to run and install vhost.

  • Run ‘git clone git://github.com/radiant/radiant.git yoursite’

  • In /yoursite run:

    • git submodule init

    • git submodule update

  • Create production, development and test database schemas

  • Update /yoursite/config/database.yml to point to the schemas

  • In /yoursite/vendor/extensions run:

    • git clone git://github.com/saturnflyer/radiant-vhost-extension.git vhost

  • In /yoursite/vendor/extensions/vhost run:

    • git submodule init

    • git submodule update

  • In /yoursite run:

    • rake development db:bootstrap

    • rake db:test:clone_structure (this one may be unnecessary)

    • rake db:test:clone

  • Finally, in /yoursite run:

    • rake spec:extensions EXT=vhost

You should see a number of spec examples running and passing. If you don’t, or they’re failing, something has gone wrong!

VHOST SUPPORT FOR OTHER EXTENSIONS Vhost support for other extensions is enabled by creating a /config/vhost.yml file containing the names of the models that should be scoped down per site. If site scoping for an extension cannot be specified through the model (i.e. it uses the file system to present data or otherwise doesn’t use an ActiveRecord) then currently you cannot enable site scoping.

Example vhost.yml:

models:

# Class name
ManagedFile: 
  # Property requiring definition of validates_uniqueness_of
  filename: 
    # Parameters to pass to validates_uniqueness_of
    scope: 
      - site_id
    message:
      'file name is already in use'
  # Any classes used in Single Table Inheritance(STI)
  sti_classes:
    - OneClass
    - TwoClass