Bootstrap the Content Repository
Introduction
Goal
Bootstrap the content repository using CND and XML files.
Use Cases
Bootstrapping Hippo's content repository involves importing the necessary node type definitions, content, and application configuration from so-called bootstrap modules that are packaged with the CMS application.
The most common use case for bootstrapping the repository is the first time the application is started in an environment (such as a developer's local machine or a production server). In this case, the 'empty' repository must be filled with the minimum required node type definitions, content, and application configuration for the application the function properly.
Another common use case is when a new release of the application is deployed in an existing (previously bootstrapped) environment. The new release may contain new features that require new or updated node type definitions and/or application configuration to be bootstrapped into the existing repository.
Bootstrap Modules
A bootstrap module is a JAR file containing:
- Compact Node Type Definitions (CND files)
CNDs describe the data structures. - Repository content (System View XML files)
This includes actual content (documents, images etc.) as well as application configuration stored as repository "content". - Repository initialization instructions
Instructions describing which CND and XML files to import, in which order.
Like the content repository itself, the bootstrap module JARs are packaged with the CMS WAR application. On first startup the repository detects the bootstrap modules and performs the initialization instructions.
A bootstrap module JAR is compiled from its corresponding module in the Maven project, typically bootstrap/[name_of_module].
A project created from the Maven archetype is preconfigured with three bootstrap modules:
- bootstrap/configuration
Application configuration including document types, delivery tier configuration etc. - bootstrap/content
Folders, documents, images etc. - bootstrap/webfiles
Static web resources stored as Web Files, such as CSS and Javascript files, Freemarker templates etc.
Enable Bootstrap
On first startup, i.e. when there is no existing repository, bootstrap is enabled automatically.
On subsequent startups, i.e. when there is an existing repository, bootstrap is disabled by default. To enable bootstrap for an existing repository the system property repo.bootstrap=true must be set. For more information on passing system properties to the application see Run and Develop with Cargo (for development environments) and Repository Deployment Settings (for production environments) for more info.
Develop and Maintain Bootstrap Modules
Being part of the Maven project, the bootstrap module source files should be checked into version control along with the rest of the project files. This enables developers to easily get the project up and running in their local development environment and collaborate with their fellow team members.
In most cases developers do not need to manually maintain the bootstrap modules. Automatic Export, when enabled, transparantely updates the bootstrap modules in the project whenever the developers modify the repository using their development tools (such as the Setup application, Document Type Editor, Console etc.).
Occassionally developers will have to make manual modifications, especially when merging changes from multiple developers in the version control system. Also, when making changes to a bootstrap module, it might be necessary to mark initialization instructions with "reload on startup" in order to update a previously bootstrapped repository.
More information:
- JCR Compact Node Type Definition (external link to Jackrabbit)
- JCR System View XML (external link to JCR 2.0 specification)
- Enhancements to JCR System View XML
- Repository initialization instructions
- Automatic Export
- Reload on startup