All pages
Powered by GitBook
1 of 1

CommandBox

Power your mission-critical and enterprise applications with CommandBox

CommandBox is a standalone, native tool for Windows, Mac, and Linux that provides a Command-Line Interface (CLI) for developer productivity, tool interaction, package management, embedded JEE server, application scaffolding, and sweet ASCII art.

CommandBox seamlessly integrates to work with any of Ortus Solutions *Box products, but it is also open to extensibility for any BoxLang or CFML project. We have created a special servlet runtime for CommandBox so you can leverage it to deploy mission-critical and high-traffic web applications. We go even further with CommandBox PRO as part of our BoxLang subscriptions to give you tons of features like JDK management, Multi-site support, Multi-SSL support, Operating System service manager, SNI support, CAC Support, and so much more.

Find out about CommandBox Pro https://www.ortussolutions.com/products/commandbox-pro

You can find out more about getting started with CommandBox or CommandBox Pro in our CommandBox documentation.

Install the Module

Once installed, CommandBox needs (for the moment) the commandbox-boxlang module to start BoxLang servers. So let's go ahead and install it:

install commandbox-boxlang

This will add the right file types and handlers to CommandBox for BoxLang.

This will no longer be needed on CommandBox 6.1+

Start up a Server

This guide is short and sweet. The hard part has been done. Now, you can start a BoxLang server like any other CommandBox server. So go to the webroot of your choosing and run:

server start cfengine=boxlang javaVersion=openjdk21_jdk

Enjoy your server!

Server Home

Like any other CommandBox server, the servers will be stored in your setup's CommandBox Home. The boxlang.json, class folders, and modules will all be installed here.

Installing BoxLang Modules

Just like with any server, you can also install modules into the BoxLang server.

install bx-mysql,bx-derby

That's it. CommandBox knows where to put them and manage them.

Server.json

You can also make your CommandBox BoxLang server portable with a server.json file:

{
    "name":"MyBoxLang-Server",

    "app":{
        // The BoxLang Engine
        "cfengine":"boxlang",
        // Portable Home if you want, or ignore it to place it under the
        // CommandBox Home
        "serverHomeDirectory":".boxlang"
    },

    "openBrowser":true,

    "web":{
        "rewrites":{
            "enable":true
        },
    },

    // Any Environment variables
    "env":{
        // "BOXLANG_DEBUG" : true
    },

    // Install these modules on installation
    "scripts" : {
 	"onServerInitialInstall":"install bx-mail,bx-mysql,bx-derby,bx-compat-cfml"
   }
}

Environment Variables

The servlet/CommandBox runtime uses the same env variables as the core OS. You can find them here.

Running BoxLang

Runtime Source Code

The runtime source code can be found here: https://github.com/ortus-boxlang/boxlang-servlet

We welcome any pull requests, testing, docs, etc.

Custom boxlang.json

You can use your own custom boxlang.json file to startup the engine by using the app.engineConfigFile setting in your server.json

{
    "name":"MyBoxLang-Server",

    "app":{
        // The BoxLang Engine
        "cfengine":"boxlang",
        // Portable Home if you want, or ignore it to place it under the
        // CommandBox Home
        "serverHomeDirectory":".engine/boxlang",
        // Custom boxlang.json file
        "engineConfigFile" : ".boxlang.json"
    },

    "openBrowser":true,

    "web":{
        "rewrites":{
            "enable":true
        },
    },

    // Any Environment variables
    "env":{
        // "BOXLANG_DEBUG" : true
    },

    // Install these modules on installation
    "scripts" : {
 	"onServerInitialInstall":"install bx-mail,bx-mysql,bx-compat-cfml"
   }
}

Debug Mode

You can set the runtime into debug mode via a few approaches:

--debug flag via the server start command

server start --debug

env.BOXLANG_DEBUG env variable

Set env.BOXLANG_DEBUG in your server.json file:

"env":{
   "BOXLANG_DEBUG" : true
},

BOXLANG_DEBUG in a .env file

Set BOXLANG_DEBUG=true in a .env file

BOXLANG_DEBUG=true

.cfconfig.json debugMode setting

Or set debuggingEnabled in your .cfconfig.json server configuration file:

{
    "debuggingEnabled" : true
}

Custom boxlang.json file

Use the app.engineConfigFile to seed a custom boxlang.json file into the engine and use the normal settings in the boxlang.json.