Blog

Brad Wood

December 19, 2017

Spread the word


Share your thoughts

In today's The 12 Tips of (CommandBox) Christmas we're going to discuss Docker. Containers are changing how the world deploys apps and services for development and production.  With Docker you don't need to ask around to find a good ColdFusion hosting company.  All you need is a company who supports Docker and you know you can deploy there.  Docker requires a shift in thinking though.  Smaller, transient servers that you don't install every time.  Portable configuration and flexible deployments based on text configuration files and environment variables.  Hey, that sounds right up CommandBox's alley!  

We've got an app for that

We provide an official CommandBox-based Docker image, which allows you to leverage its capability to orchestrate live servers in multi-tier deployments.  Everything that CommandBox brings to the table, including the ability to start Adobe and Lucee servers, portable configuration via CFConfig, and using environment variables to control your deployment translate directly from your desktop right into the container cloud.

We've been talking about server.json and CFConfig so far and you can bring all of that knowledge along into Docker.  The probability of CommandBox's configuration makes it uniquely suited to use with Docker. CommandBox servers are also lightweight and fast, built on JBoss Undertow so they perform great, even in a production environment!  Our Docker images are the only professionally supported images supporting Adobe CF right now and the only CF images I know of that don't involve messy hacks like copying XML files around.  

Usage

This section assumes you are using the Official Docker Image.  By default, the directory /app in the container is mapped as Commandbox home. To deploy a new application, first pull the image:

docker pull ortussolutions/commandbox

Then, from the root of your project, start with

docker run -p 8080:8080 -p 8443:8443 -v "/path/to/your/app:/app" ortussolutions/commandbox

By default the process ports of the container are 8080 (insecure) and 8443 (secure - if enabled in your server.json) so, once the container comes online, you may access your application via browser using the applicable port (which we explicitly exposed for external access in the run command above). You may also specify different port arguments in your run command to assign what is to be used in the container and exposed. This prevents conflicts with other instances in the Docker machine using those ports:

docker pull -expose-list 80 443 -e "PORT=80" -e "SSL_PORT=443" -v "/path/to/your/app:/app" ortussolutions/commandbox

To create your own, customized Docker image, use our Dockerfile repository as the baseline to begin your customizations.

Environment Variables

The CommandBox Docker image support the use of environmental variables for the configuration of your servers. Specifically, the image includes the cfconfig CommandBox module, which allows you to provide custom settings for your engine, including the admin password.

  • $PORT - The port which your server should start on. The default is 8080.
  • $SSL_PORT - If applicable, the ssl port used by your server The default is 8443.
  • $CFENGINE - Using the server.json syntax, allows you to specify the CFML engine for your container
  • $HEALTHCHECK_URI - Specifies the URI endpoint for container health checks. By default, this is set http://127.0.0.1:${Setting: PORT not found}/ at 1 minute intervals with 5 retries and a timeout of 30s
  • $cfconfig_[engine setting] - Any environment variable provided which includes the cfconfig_prefix will be determined to be a cfconfig setting and the value after the prefix is presumed to be the setting name. The command cfconfig set ${Setting: settingName not found}=${Setting: value not found} will be run to populate your setting into the $SERVER_HOME_DIRECTORY.
  • $cfconfigfile - A cfconfig-compatible JSON file may be provided with this environment variable. The file will be loaded and applied to your server. If an adminPassword key exists, it will be applied as the Server and Web context passwords for Lucee engines

Add Your Comment

(2)

Dec 19, 2017 09:44:10 UTC

by Will B.

I would love to see Ortus put together a complete, mutli-page and lengthy HOWTO for deploying a website running on Lucee to AWS. I've long considered it, but there are SO many moving parts and, for many of us, a complete unfamiliarity with anything beyond simply using Coldbox.

Dec 19, 2017 18:19:20 UTC

by Brad Wood

Hi Will, that sounds like it would be a great guide. I'll make sure and pass this along to the team. We are still working on a lot of our Docker training. Firstly, did you see our Container Roadshow we did back in Sept? We did a full month of blogging and webinars which may help fill in some pieces for you.
https://www.ortussolutions.com/events/container-roadshow-2017
You are right that there is a large amount of information to learn in regards to Docker and there are many many ways to use Docker on many different styles of Docker-based hosts. For that reason, it is difficult for us to create one all-encompassing guide. We haven't produced a ton of general Docker training since the Docker community already has more of that than we could ever create. We've tried to focus on documenting the moving parts that our libraries help out with. If you or your company would like some help with Docker, we do offer professional services. We can do training, consulting, and even on site setups to help your team do a Docker conversion. In fact, we're doing this for several clients right now.

Recent Entries

Introducing: The Ortus ORM Extension

Introducing: The Ortus ORM Extension

We are excited to announce the Ortus ORM Extension, a new effort to improve the CFML ecosystem by modernizing Hibernate ORM support on the Lucee CFML server. The Ortus ORM extension is an open-source fork of the Lucee Hibernate extension which focuses on speed, reliability, and collaboration with the excellent CFML community.

Michael Born
Michael Born
June 06, 2023
CBWIRE 3.0.0 Released

CBWIRE 3.0.0 Released

We are very excited to announce the release of version 3 of CBWIRE, our ColdBox module that makes building modern, reactive apps a breeze. This version brings with it a new component syntax, 19 enhancements and bug fixes, and improved documentation. Our biggest goal with this release was to improve the developer experience and to provide a low barrier to entry to getting started with CBWIRE.

Grant Copley
Grant Copley
May 22, 2023
ColdBox 7.0.0 Released

ColdBox 7.0.0 Released

Introducing ColdBox 7: Revolutionizing Web Development with Cutting-Edge Features and Unparalleled Performance

We are thrilled to announce the highly anticipated release of ColdBox 7, the latest version of the acclaimed web development HMVC framework for ColdFusion (CFML). ColdBox 7 introduces groundbreaking features and advancements, elevating the development experience to new heights and empowering developers to create exceptional web applications and APIs.

Designed to meet the evolving needs of modern web development, ColdBox 7 boasts a range of powerful features that streamline the development process and enhance productivity. With its robust HMVC architecture and developer-friendly tools, ColdBox 7 enables developers to deliver high-performance, scalable, and maintainable web applications and APIs with ease.

Esme Acevedo
Esme Acevedo
May 16, 2023