Understanding CMS_HOME

One of the new features in Vertical Site 4.2 was the concept of an application home directory. This is an externalization of the required configurations needed to run Vertical Site. It was done so that it is easier for you as an application deployer to configure, modify static resources and adding plugins.

Setting the Environment

When you run Vertical Site it needs to know the location of the application home directory. This can be set in a number of ways:

  • Using $CMS_HOME operating system environment.
    • This means that you have to set this environment variable before running the application server. It can be set globally in the OS, or locally in any startup scripts.
  • Using -Dcms.home Java system property.
    • For doing this, you must modify the application server startup script. Some application servers (such as IBM WebSphere) has the ability to set such environments in the administration console.
    • This method overrides the above method.
  • Hardcode cms.home property inside /WEB-INF/home.properties.
    • This means that you have to unpack the WAR file and hardcode the value inside the web application. It is the most robust way, but is more hazzle when upgrading the web application.
    • This method overrides all the above methods.

Directory Structure

To successfully start Vertical Site you must have a certain minimum inside the application home directory. The minimal structure looks like this:

$CMS_HOME/
  config/
    cms.properties
    vhost.properties
  plugins/
  static/

The files cms.properties and vhost.properties is bundled with the installation and contains core configuration and virtual host configuration. All plugins that can be installed lives in the plugins directory. There can be any set of nested structures within this directory (more on plugins in a followup article). Static contents is grouped by site and lives inside the static directory. This directory must be divided up like this:

$CMS_HOME/static/
  site/
    0/
      images/
        example.gif

The above example adds some static files on site 0. So the example.gif can then be accessed from the browser using http://example.com/site/0/images/example.gif. If you need more files on different sites, just add a site directory inside $CMS_HOME/static like this:

$CMS_HOME/static/
  site/
    0/
      images/
        example.gif
    43/
      some-text-file.txt

All site spesific configuration files live in the $CMS_HOME/config directory. The name of theese files is like version 4.1. Example below:

$CMS_HOME/config/
  site-0.properties
  site-43.properties

Note! All modifications in the configuration and plugin directory will not be activated before Vertical Site is reloaded. This limitation is not for static files. Here the files will be refreshed automatically.

Comments

If you want to comment on this article you need to be logged in.

Published in 2011

2010

2009

2008

2007