Welcome to my blog
Here you will find posts about various topics including ColdFusion, Railo/Lucee, MongoDB, Node, Meteor, CFML, Apple hardware and software, and web development. I strive to keep the content original and informative.
A compendium of CFML and web technology topics
Here you will find posts about various topics including ColdFusion, Railo/Lucee, MongoDB, Node, Meteor, CFML, Apple hardware and software, and web development. I strive to keep the content original and informative.
Managing Servers with LuCLi is super easy. You can start, stop , tail and list with the simple server command.
Over the years of building CFML apps, one of the most boring-but-essential parts of the job has been âjust getting a Lucee server runningâ for a project. Different versions, different ports, different environments⌠and thatâs before you even write a line of code.
LuCLI exists to remove as much of that friction as possible. Just let comand lucli server do the heavy lifting. It will create a lucee.json file with some configuration and then start up a server for you.
In this post Iâll walk through how I actually use the server commands day-to-day to spin up, poke at, and tear down Lucee servers.
server command (the one youâll use a lot)All the server lifecycle bits are grouped under a single entry point:
lucli server [COMMAND]
Run this to see everything it can do:
lucli server --help
Youâll see commands like:
Letâs go through the ones youâll probably care about first.
The basic pattern is:
index.cfm filelucli server start
Once started you will get a default lucee.json file, ready for your config.
{
"name": "my-app",
"version": "6.2.2.91",
"port": 8080,
"webroot": "./"
}
Behind the scenes LuCLI will:
lucee.jsonYou can override bits from the command line when you need to:
# Change the name
lucli server start --name my-app-dev
# Try a different port
lucli server start --port 8081
# Pin a specific Lucee version
lucli server start --version 6.2.2.91
Once you get used to this flow, âI need a Lucee 6.2 server for this repoâ becomes a muscle-memory command instead of a half-hour setup exercise.
start vs run â background or noisy foregroundBy default I tend to run servers in the background and forget about them until I need to stop them.
Thatâs what start does:
lucli server start
If Iâm debugging something messy or I really want to see what Tomcat + Lucee are doing, I switch to run:
lucli server run
The difference:
start â daemon-style, logs go to files, your shell is freerun â attached to your terminal, logs stream right in front of you, Ctrl+C stops the serverIâll often use run when wiring up something new, then switch back to start once things are behaving.
One of the reasons I built LuCLI was to avoid having lucee.dev.json, lucee.staging.json, lucee.prod.json, and hoping I didnât mix them up.
Instead, you define a base config and then layer environments on top:
{
"name": "my-app",
"version": "6.2.2.91",
"port": 8080,
"webroot": "./",
"environments": {
"dev": {
"port": 8081
},
"prod": {
"port": 80,
"jvm": {
"maxMemory": "2048m"
}
}
}
}
Then you pick what you want at startup:
# Use the dev overrides
lucli server start --env dev
# Use the prod overrides
lucli server start --env prod
If youâre the sort of person (like me) who likes to see what config is actually going to be used, thereâs a --dry-run flag:
lucli server start --env prod --dry-run
That prints the merged configuration instead of starting the server, which is great for catching âwhy is this still on port 8080?â moments.
Once youâve started a few servers, youâll eventually forget whatâs running where. LuCLI keeps track of server instances for you.
# Show all known servers and their state
lucli server list
# just show the ones that are running
lucli server list --running
# Show detailed status for the server in the current directory
lucli server status
# Stop a specific server by name
lucli server stop --name my-app
# Restart it (config changes, new Lucee version, etc.)
lucli server restart --name my-app
# Clean up stopped instances you donât care about anymore
lucli server prune
I use list a lot when Iâve been hopping around projects and want a quick âwhatâs currently running on this machine?â snapshot.
A running server is only useful if you can see what itâs doing. LuCLI tries to make that as low-friction as possible.
Instead of hunting for catalina.out or some random logs directory, you can just:
# Tail the main server log for the current project
lucli server log
# Be explicit and follow output as it grows
lucli server log --type server --follow
This is usually the fastest way to see Lucee stack traces and Tomcat grumbles when something blows up.
Small but handy:
lucli server open
lucli server open --name my-app
That will launch your default browser pointed at the correct URL for the running server. I use this constantly when bouncing between multiple versions or ports.
For the âhow hard is this thing working?â question, thereâs a simple JMX-powered dashboard:
lucli server monitor
lucli server monitor --name my-app
Youâll get a live view of memory, threads, GC activity and so on â great for tracking down âit works locally but melts in stagingâ style problems.
When Iâm experimenting with LuCLI itself, or testing a feature, I try not to pollute real project directories with random lucee.json files and temporary servers.
Instead I keep a demo_servers/ folder around and do this:
mkdir -p demo_servers
cd demo_servers
lucli server start --name test-server-1
Now any scratch configuration or weird test server lives under there, and I can happily prune or delete things without worrying about a real app.
If you take nothing else from this post, itâs this:
lucli server startlucee.json to your likinglist, status, log, open, and monitor to see whatâs going onOnce you get into the rhythm, starting and managing Lucee servers stops being a chore and becomes just another quick terminal command in your day.
As always, let me know what you think. Take LuCLI out for a spin and see if it helps your workflow!