Existing ColdBox Application
If you already have a ColdBox application and you wish to install ContentBox into it, you most definitely can.

System Requirements

Please note that ContentBox 4.x requires ColdBox 5.x

Step 1 : Dependencies

Since version 3.5.0, you can now simply issue a command in CommandBox to install the ContentBox module into an existing ColdBox application. Just open a box shell in the root of your ColdBox application and use the following command:
1
install contentbox,contentbox-installer-module
Copied!
This will install the ContentBox module with all of its dependencies under the /modules/contentbox and the ContentBox installer module under /modules/contentbox-installer.

Step 2 : Application.cfc Updates

Now open your Application.cfc and you will add the following updates:

Mappings

1
// LOCATION MAPPINGS
2
this.mappings[ "/contentbox" ] = COLDBOX_APP_ROOT_PATH & "modules/contentbox";
3
// THE LOCATION OF THE ORM MODULE
4
this.mappings[ "/cborm" ] = this.mappings[ "/contentbox" ] & "/modules/contentbox-deps/modules/cborm";
Copied!

ORM Settings

1
// ORM SETTINGS
2
this.ormEnabled = true;
3
this.ormSettings = {
4
// ENTITY LOCATIONS, ADD MORE LOCATIONS AS YOU SEE FIT
5
cfclocation=[ "models", "modules", "modules_app" ],
6
// DO NOT REMOVE THE FOLLOWING LINE OR AUTO-UPDATES MIGHT FAIL.
7
dbcreate = "update",
8
// FILL OUT: IF YOU WANT CHANGE SECONDARY CACHE, PLEASE UPDATE HERE
9
secondarycacheenabled = false,
10
cacheprovider = "ehCache",
11
// ORM SESSION MANAGEMENT SETTINGS, DO NOT CHANGE
12
logSQL = false,
13
flushAtRequestEnd = false,
14
autoManageSession = false,
15
// ORM EVENTS MUST BE TURNED ON FOR CONTENTBOX TO WORK
16
eventHandling = true,
17
eventHandler = "cborm.models.EventHandler",
18
// THIS IS ADDED SO OTHER CFML ENGINES CAN WORK WITH CONTENTBOX
19
skipCFCWithError = true
20
};
Copied!

Step 3 : ColdBox.cfc Settings

Open your application's ColdBox.cfc and you will add the following settings:
1
// ORM Module Configuration
2
orm = {
3
// Enable Injection
4
injection = {
5
enabled = true
6
}
7
};
Copied!
That's it! Once all those settings, mappings and module installations are done you can now visit the installer module to continue with the installation process: http://localhost/index.cfm/cbinstaller
Danger Make sure you have the datasource created in your ColdFusion administrator or inline in your Application.cfc

Step 4: CacheBox.cfc Settings

Open your CacheBox configuration file: config/CacheBox.cfc and add the following cache declarations:
1
// Register all the custom named caches you like here
2
caches = {
3
// Named cache for all coldbox event and view template caching
4
template = {
5
provider = "coldbox.system.cache.providers.CacheBoxColdBoxProvider",
6
properties = {
7
objectDefaultTimeout = 120,
8
objectDefaultLastAccessTimeout = 30,
9
useLastAccessTimeouts = true,
10
freeMemoryPercentageThreshold = 0,
11
reapFrequency = 2,
12
evictionPolicy = "LRU",
13
evictCount = 5,
14
maxObjects = 5000,
15
objectStore = "ConcurrentSoftReferenceStore" //memory sensitive
16
}
17
},
18
// ContentBox Sessions
19
sessions = {
20
provider = "coldbox.system.cache.providers.CacheBoxColdBoxProvider",
21
properties = {
22
objectDefaultTimeout = 60,
23
objectDefaultLastAccessTimeout = 0,
24
useLastAccessTimeouts = false,
25
freeMemoryPercentageThreshold = 0,
26
reapFrequency = 2,
27
evictionPolicy = "LRU",
28
evictCount = 5,
29
maxObjects = 1000, // Can support up to 1000 user sessions concurrently. Modify if needed. 0 = unlimited
30
objectStore = "ConcurrentStore"
31
}
32
}
33
}
Copied!
Once these updates are done, then you can start up the server and visit the installer URL: http://localhost:port/cbInstaller

Step 5 (Optional) : UI Route

By default ContentBox is in take over mode. Meaning that the UI module will intercept all calls made to the application and process them as pages or blog entries. If you DO NOT want this to happen, then you can segregate the UI module into a single entry point URL like blog or site or pages. You can do this by opening the following file: modules/contentbox-ui/ModuleConfig.cfc and looking for the following code:
1
// YOUR SES URL ENTRY POINT FOR CONTENTBOX, IF EMPTY IT WILL TAKE OVER THE ENTIRE APPLICATION
2
// IF YOU WANT TO SECTION OFF CONTENTBOX THEN FILL OUT AN SES ENTRY POINT LIKE /site OR /content
3
// BY DEFAULT IT TAKES OVER THE ENTIRE APPLICATION
4
this.entryPoint = "";
Copied!
Now update the this.entryPoint to whatever you like the entry point URL to be. Restart the application and voila!
Last modified 3yr ago