Skip to content

Crowbar UI Development (using offline mode)

cloudedge edited this page May 14, 2012 · 1 revision

The Crowbar UI has an "offline" mode that can be used for testing and development when no Chef server is available as a back end.

To collect the information needed for offline mode, you must start with from a working system and export the Chef objects (effectively the Crowbar DB). The export new to Crowbar 1.3 under the Utilities...Exported Items.

To activate this mode, you must:

  1. Edit your Rails environment vi /opt/dell/crowbar_framework/config/environment.rb
    1. note: you may only want to change it for development mode (environments/development.rb)
    2. CHEF_ONLINE configuration property to false
    3. OFFLINE_DOMAIN must match the DNS top level domain (TLD) installed with Crowbar
    4. (optional) OFFLINE_FILES_DIR configuration defaults to db but you can change if you want
  2. Populate the /opt/dell/crowbar_framework/db directory with the cache json files

This is a handy debugging tool because it allows developers to get a full system snapshot whenever all the files in db are deleted.

The cache files follow a simple naming pattern. Prefixes of node, role and databag indicate the type of Chef object being stored. The node name follows the prefix.

When data is edited in Offline mode, Crowbar will store the edited version int =tmp=. To undo the edit, simply remove the object(s) in the tmp directory. Crowbar always looks for updated objects in the tmp directory before returning the original object from the =db= directory. Only the last update is kept.

If the Chef models change then it is necessary to update the object cache in the test directory.

We have found this mode to be very helpful for UI development. All the code to support this capability is in the model and should not be exposed in the controllers or views. Please make sure that all Crowbar changes continue to work for this mode.

Clone this wiki locally