Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Deploy ContentBox into any Adobe or Lucee CFML Engine
In this section you will deploy ContentBox so it can run on any running Adobe or Lucee CFML engine. The first step is to use CommandBox and our contentbox-cli
package so we can install and configure ContentBox for usage in any CFML Engine. We won't be using CommandBox as our server, just as a package manager and CLI.
CommandBox is a ColdFusion (CFML) Command Line Interface (CLI), REPL, Package Manager and Embedded Server. We will leverage the CLI in CommandBox to install, deploy and configure ContentBox.
MacOS, Windows or Linux
JDK 8+
A clean, empty directory on your machine
You can download CommandBox from the official site: http://www.ortussolutions.com/products/commandbox#download and install it in your preferred Operating System (Windows, Mac, Unix).
Once you download and expand CommandBox you will have the box.exe
or box
binary, which you can place in your Windows Path or *Unix /usr/bin
folder to have it available system-wide. Then open the binary and CommandBox will unpack itself your user's directory: {User}/.CommandBox
. This happens only once and the next thing you know, you are in the CommandBox interactive shell!
We will be able to execute a-la-carte commands from our command line or go into the interactive shell for multiple commands. We recommend the interactive shell as it is faster and can remain open in your project root.
We can now install the contentbox-cli
package:
Once installed you can always run contentbox help
to get the list of available commands and help information.
Create a database in your RDBMS of choice. Make sure you note the name of the database, the connection details and the credentials for it.
If you are using MySQL, make sure you use utf8mb4
for your database collation.
Now go to your CFML engine administrator and register the contentbox
datasource that points to the database you just created.
You can use ANY name for the datasource, but we will use contentbox
for ease of use.
Now that we have our CLI installed, database and datasource created, go or create a new directory where we will create our site. Most likely this folder will be your web root in your CFML engine installation or a sub-folder within that web root. Let's assume it's the web root of your current CFML Engine installation.
The wizard will take you by the hand and ask you all the relevant questions about your installation:
Name of your site
Which CFML Engine you will be running ContentBox on (Lucee5, Adobe 2018+)
Password for the ColdBox HMVC Reinits
Database of choice (MySQL5+, MSSQL, PostgreSQL, Oracle)
Database credentials
Development or production site
Latest ContentBox version, specific or be
bleeding edge
Deploy a CommandBox server or not. This should be false, as we are only deploying our code to the CFML engine we have already installed.
Confirm your settings and the installer will configure the entire site for you including ORM dialects, environment variables and much much more.
Tip: You can use the `install --help` command and see how you can install ContentBox in an automated fashion with no user-interaction.
Now that we have installed ContentBox on disk and configured your CLI to connect to your database for delivering database migrations, we can finalize the installation via the web installer. Now open the installer by navigating to the root of the project. Let's assume you are running your CFML engine on port 8500:
ContentBox will automagically create all the necessary database tables, indexes, and constraints for you. After it does this, it will present you with our ContentBox installer, where you will fill in:
Administrator Account
Site Information
Notification Emails
Email Information
URL Rewriting
Enjoy your ContentBox installation!
Caution: We recommend that after you install ContentBox that you remove the installer and data source wizard modules from the disk. You can do so manually or via the Dashboard once you log in. {Root}/modules/contentbox-installer and {Root}/modules/contentbox-dsncreator
The ContentBox system requirements
Let's get started with some system requirements for running ContentBox sites on all deployable options
You need Java 8+ to run ContentBox.
Java 17+ is not currently supported
You will need to have CommandBox for installation, upgrading and optionally for running your ContentBox sites. Please see our CommandBox Installation section.
ContentBox can be deployed to the following CFML Engines:
Adobe ColdFusion
2016 (End of life is December 2021)
2018
2021
Lucee 5+
Here are the supported databases for ContentBox:
MySQL 5.7 (InnoDB ONLY!)
MySQL 8+ (InnoDB ONLY!)
Microsoft SQL Server 2012+
HypersonicSQL
Apache Derby
PostgreSQL
Oracle 11g+
If you have another database engine that needs ContentBox support, please let us know and we will be able to help you (https://www.ortussolutions.com/contact).
We have seen an issue where an error will be reported that cbPermission
cannot be inserted. This is an issue where for some reason the JDBC driver will switch context and create the tables in the master
schema and not the schema you chose. So please verify that the master
schema has tables that start with cb_*
and remove them and re-run the installer.
ContentBox relies on Search Engine Safe (SES) URLs and URL Routing. The majority of CFML engines already allow for these types of URLs out of the box and ContentBox supports it out of the box. However, if you would like to use full URL rewriting (which we recommend, that's where the index.cfm
is not showing in the URLs) you will need to use a web server rewriting tool and ContentBox will configure it for you.
So before you install ContentBox make sure that you are using one of the supported rewriting engines show below:
CommandBox Server (Default)
Apache mod_rewrite
IIS 7 rewrite module
Tuckey rewrite filter
Nginx
The ContentBox installer will create rewrite files automatically for you for Apache, IIS7, and express editions. For Nginx or other rewrite engines, you will need to add the rewrites yourself and then manually modify the routing file.
Edit config/Router.cfc
and set setFullRewrites
to true
. That's it!
ContentBox needs some files/folders to be writable at runtime.
You can remove the first two after installation.
Here are the folders for the core engine to work accordingly
If you already have a ColdBox application and you wish to install ContentBox into it, you most definitely can.
Please note that ContentBox 4.x requires ColdBox 5.x
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:
This will install the ContentBox module with all of its dependencies under the /modules/contentbox
and the ContentBox installer module under /modules/contentbox-installer
.
Application.cfc
UpdatesNow open your Application.cfc
and you will add the following updates:
ColdBox.cfc
SettingsOpen your application's ColdBox.cfc
and you will add the following settings:
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
CacheBox.cfc
SettingsOpen your CacheBox configuration file: config/CacheBox.cfc and add the following cache declarations:
Once these updates are done, then you can start up the server and visit the installer URL: http://localhost:port/cbInstaller
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:
Now update the this.entryPoint
to whatever you like the entry point URL to be. Restart the application and voila!
The express version of ContentBox is a fully embedded running server powered by Lucee, an open-source CFML engine, and Tomcat. It comes bundled with a JRE for your operating system or one without a JRE can be downloaded as well.
Make sure your system has a working Java Runtime 1.7+ environment if you are downloading the express version with no JRE. A quick test to see if your system supports Java is to open a terminal or command prompt and typing:
You should see something like this:
Just make sure what it is Java 1.7+.
The first step is for you to download ContentBox (https://www.ortussolutions.com/products/contentbox) or you can use the command below:
Once downloaded expand the archive
This will expand into the folder of your liking.
On some operating systems like Linux or Mac, you will need to enable run permissions. So drop into a shell or terminal in that folder you expanded and type:
This will add execution and write permissions to the bin
folder which is required.
Go into the bin
folder and execute either the startup.bat
or startup.sh
or startup.app
according to your OS. Then visit the site in a browser on port 8085
by default.
Make sure you visit the following URLs and set up a server and web application password for the underlying engines:
You can now visit your application under http://localhost:8085
and you will be presented with our datasource wizard. Since we are in express edition, just choose the embedded database and follow the instructions.
That's it! We are now ready to run the ContentBox installer wizard. ContentBox will automagically create all the necessary database tables, indexes, and constraints for you. After it does this, it will present you with our ContentBox installer, where you will fill in:
Administrator Account
Site Information
Notification Emails
Email Information
URL Rewriting
Enjoy your ContentBox installation!
Caution We recommend that after you install ContentBox that you remove the installer and datasource wizard modules from the disk. You can do so manually or via the Dashboard once you log in. {Root}/modules/contentbox-installer and {Root}/modules/contentbox-dsncreator
Go to the conf/server.xml
and look for the following:
Just update the port
to whatever you desire.
ContentBox can be installed in multiple approaches
We are so excited you are here and ready to get started with ContentBox Modular CMS one of the most modern ColdFusion (CFML) Content Management Platforms. There are several ways to install ContentBox, so make sure you explore all the options. We strongly recommend using our contentbox-cli
to install ContentBox as it is the easiest way to get started.
The easiest way to install and run ContentBox CMS
CommandBox is a ColdFusion (CFML) Command Line Interface (CLI), REPL, Package Manager and Embedded Server. We will leverage the CLI in CommandBox to install, deploy and configure ContentBox.
MacOS, Windows or Linux
JDK 8+
A clean, empty directory on your machine
You can download CommandBox from the official site: http://www.ortussolutions.com/products/commandbox#download and install it in your preferred Operating System (Windows, Mac, Unix).
Once you download and expand CommandBox you will have the box.exe
or box
binary, which you can place in your Windows Path or *Unix /usr/bin
folder to have it available system-wide. Then open the binary and CommandBox will unpack itself your user's directory: {User}/.CommandBox
. This happens only once and the next thing you know, you are in the CommandBox interactive shell!
We will be able to execute a-la-carte commands from our command line or go into the interactive shell for multiple commands. We recommend the interactive shell as it is faster and can remain open in your project root.
The first step in our adventure is to install the contentbox-cli
package that will handle installation, scaffolding, and management of ContentBox sites.
Once installed you can always run contentbox help
to get the list of available commands and help information.
Create a database in your RDBMS of choice. Make sure you note the name of the database, the connection details and the credentials for it. You will need them in the next step.
If you are using MySQL, make sure you use utf8mb4
for your database collation.
Now that we have our cli installed, go or create a new directory where we will create our site.
The wizard will take you by the hand and ask you all the relevant questions about your installation:
Name of your site
Which CFML Engine you want to run it on (Lucee5, Adobe 2018+)
Password of the CFML engine administrator
Password for the ColdBox HMVC Reinits
Database of choice (MySQL5+, MSSQL, PostgreSQL, Oracle)
Database credentials
Development or production site
Latest ContentBox version, specific or be
bleeding edge
Confirm your settings and the installer will configure the entire site for you including ORM dialects, environment variables and much much more. It will also startup the chosen CFML server so you can continue with the web installer.
Tip: You can use the `install --help` command and see how you can install ContentBox in an automated fashion with no user-interaction.
The web installer will then take you through adding your first administrator user, email configurations and your production and development site in one box. Once you follow the wizard, ContentBox is up and running! Enjoy!
You can use the CommandBox commands to interact with the embedded server:
server stop
to stop the server
server start
to start the server
server restart
to restart the server
server log
to view the log files
server help
to get help on your server commands
You now have a fully functional ContentBox installation with two sites: development and production. You can now start creating your content, themes, modules and much more.
ContentBox sports its very own ContentBox Docker image. As with the CommandBox image, the [major].[minor].[patch]
versioning mirrors the upstream product version, so it's easy to pull deploy a specific version, should your application require it.
The image is packaged with a self-contained express version, which uses an in-memory H2 database. To stand up an image using an un-configured express edition, simply run:
The command above is using &&
to concatenate the two commands which will work under *unix. If you are in windows, replace &&
with ;
in Powershell, replace &&
with &
in Cmd, or run the two commands separately
A new container will be spun up from the image and, upon opening your browser to http://[docker machine ip]:8080
, you will be directed to configure your ContentBox installation using the ContentBox Installer. That easy! Boom!
The ContentBox image is based on the CommandBox Image, so all features and environment variables are applicable. Please refer to that documentation as well: https://hub.docker.com/r/ortussolutions/commandbox/
The above run
command produces an image which is self-contained, and would be destroyed when the container is stopped. If we wanted to run a version in production, we would need to persist, at the very minimum, the database and your custom assets (widgets, modules, themes, and media library). In order to do this, we need to mount those resources into the Docker host file system.
By convention, the express
H2 database is stored at /data/contentbox/db
inside the container. In addition, the custom content module which contains your custom themes, widgets, modules, and media library are stored under /app/modules_app/contentbox-custom
.
In 3.x versions the default storage location for the CMS user media assets was set to /app/includes/shared/media
and the contentbox-custom module did not exist.
Let's mount both of those volume points so that our database and user assets persists between restarts:
Now, once our image is up, we can walk through the initial configuration. Once the configuration is complete, simply stop the container and then start it without the environment variable INSTALL
in place. The H2 database and uploads will be persisted and the installer will be removed automatically on container start.
INSTALL
Setting CaveatsPlease remember that the INSTALL environment variable is ONLY used to go through the ContentBox installer wizard. Once the database is seeded with the installation process, you will no longer use it unless you want to reconfigure the installation.
If you would like to connect your container to an external database system, you can very easily do so, which would allow us to connect from multiple containers in a distributed fashion (MySQL, Oracle, MSSQL, etc). If not, you run the risk of file locks if multiple container replicas are sharing the same H2 database.
Tip: We would suggest you use the H2 database or EXPRESS edition when using only 1 replica.
The image is configured to allow all ORM-supported JDBC drivers to be configured by specifying the environment variables to connect. Alternately, you may specify a CFCONFIG
environment variable which points to a file containing your engine configuration, including data sources.
By convention, the datasource name expected is simply named contentbox
.
To programmatically configure the database on container start, environment variables that represent your datasource configuration should be provided. There are two patterns supported:
DB_DRIVER
configuration - which may be used for Adobe Coldfusion servers
DB_CLASS
configuration - which configures a datasource by JDBC driver and connection string (Both Adobe and Lucee)
An example container run
command, configuring a MySQL database would be executed like so:
To use the DB_DRIVER
syntax for Adobe Coldfusion, an example run
command would be:
As you can see, these commands can become quite long. As such, using Docker Compose or CFConfig may provide a more manageable alternative.
A number of environment variables, specific to the ContentBox image, are available for use. They include:
EXPRESS=true
- Uses an H2, in-memory database. Useful for very small sites or for testing the image. See http://www.h2database.com/html/main.html
INSTALL=true
(alias: INSTALLER
) - Adds the installer module at runtime, to assist in configuring your installation. You would omit this from your run
command, once your database has been configured
BE=true
- Uses the bleeding edge snapshot of the ContentBox CMS, else we will defer to the latest stable version of ContentBox.
HEALTHCHECK_URI
- Specifies the URI endpoint for container health checks. By default, this is set http://127.0.0.1:${PORT}/
at 30s intervals with 5 retries and a timeout of 60s
FWREINIT_PW
- Allows you to specify the reinit password for the ColdBox framework
SESSION_STORAGE
- Allows the customization of session storage. Allows any valid this.sessionStorage
value, available in Application.cfc. By default, it will use the JDBC connection to store your sessions in your database of choice.
DISTRIBUTED_CACHE
- Allows you to specify a CacheBox cache region for distributing ContentBox content, flash messages, cache storage, RSS feeds, sitemaps, and settings. There are only three cache regions defined in this image: default
, template
and jdbc
. jdbc
is the default cache that will distribute your data, default
and template
are in-memory caches. Please see the distributed caching section below to see how to register more caches.
H2_DIR
- Allows you to specify a custom directory path for your H2 database. By convention, this is set to /data/contentbox/db
within the container
contentbox_default_*
- All Contentbox "Geek Settings" may be provided as environment variables, allowing granular control of your ContentBox settings.
ORM_SECONDARY_CACHE
- If true
it will activate the ORM secondary cash to the ehcache
provider. By default, it is turned off.
ORM_DIALECT
- You can choose the specific ORM dialect if needed, if not we will try to auto-detect it for you.
HEADLESS=false
- If true
then this image will not publish an Admin module, just the core, REST and UI modules.
In addition, the CommandBox docker image environment variables are also available to use in your container. For additional information on using the CommandBox docker image, see the initial release blog entry.
By default, the ContentBox image will use the Lucee Open Source CFML engine for running the application. It will also configure the datasource to store user sessions so you can easily scale the image or send it to Docker Swarm, Kubernetes, etc for scalability.
You can also use the SESSION_STORAGE
environment variable to switch the connection to any backend you like.
By default, our image configures a jdbc
CacheBox cache region that will be used to distribute settings, sessions, flash data, content, RSS feeds, sitemaps, etc. This means that out-of-the-box, your ContentBox containers can use the database to distribute its content within a swarm or set of services. However, if you would like to use your own CacheBox providers or a more sophisticated distributed cache like Redis or Couchbase, you can.
We have also prepared a docker-compose and distribution example using Redis (more caches to come) and the ContentBox image. This example will allow you to have a stack that can easily distribute your sessions and content via Redis. You can find the repository here: https://github.com/Ortus-Solutions/docker-contentbox-distributed
Please check the Database for CF Sessions, to ensure this table is purging older expired values. If this table grows in size, you will notice performance hits and may need to schedule a purge or truncation manually.
The image contains built-in capabilities for health checks for the running application. You can customize the URL entry point by using the HEALTHCHECK_URI
environment variable. By default, this is set http://127.0.0.1:${PORT}/
at 30s intervals with 5 retries and a timeout of 60s.
The ContentBox image for Docker re-vamps the entire Modular CMS game by de-coupling your customizations and user assets from the underlying framework. It can make your source code lighter-weight, as well as providing you with a standardized development environment, which matches your production container strategy.
Mount Point
Description
/data/contentbox/db
The express H2 database
/app/modules_app/contentbox-custom
The custom code module
/app/includes/shared/media
**The legacy media location, use the custom modules location instead.