Blog

Brad Wood

December 16, 2016

Spread the word


Share your thoughts

Today we continue our 12 Tips of (CommandBox) Christmas series aimed at bringing warmth, holiday cheer, and useful information to a cubicle near you.  CommandBox does a lot of things online for you.  It connects to ForgeBox, the CFML package repository, it downloads CF engines to start servers, and can even update your packages to new versions.  This is great when some Starbucks Wifi is in reach, but what about at 30,000 ft or working on the road.  You still need to be able to start up servers, install dependencies, kick butt, and take names (all in the Christmas spirit, of course!).  Here are some clever tricks to keep you working even when the network is unplugged.  

Working Offline

Your first line of defense is to keep a healthy stock of local artifacts.  Any time you install a package from ForgeBox, we store the downloaded zip file in an "artifacts" folder under the CommandBox home in your user directory.  We also have a new enhancement coming in the next version of CommandBox thanks to Chris Schmitz that will allow you to customize the location of your artifacts folder so you can stick it on a network share or external storage.  This can be handy for your coworkers or when setting up a new machine if your internet connection is a little slow.

Use what you've got

The basic flow when installing a package is this:

  1. Check and see you already have this package downloaded.  If so, use it.
  2. Go out on the internet and download the package
  3. Store it in the artifacts directory for next time

CommandBox has a short-circuit check built in so if you provide it with an exact version number when installing your packages and that version exists in the local artifacts store, we don't bother looking in ForgeBox.  We just use the local version and move on.  

CommandBox> install coldbox@4.3.0

Fail Over

In the upcoming version of CommandBox we've taken it a step further and added a failover behavior that happens when ForgeBox can't be reached for any reason while installing a package.  We catch the error and take a peek in your local artifacts folder to see if there's a version that satisfies what you need.  Keep in mind you may not have the latest version in artifacts, but we believe an older version is better than no version at all!  

Keep in mind that ForgeBox is the only endpoint that uses the artifacts cache.  Other endpoints like HTTP or Git don't have any concept of inherent versioning so we always have to connect to get the latest one.

Local Packages

CommandBox can get packages from just about anywhere.  You can install directly from local file or folders on a local network drive, or an HTTP(S) URL only available to your private network.  Use this to your advantage to install packages that you want to keep private, or just to avoid hitting the world wide web.  As long as your package folder or zip has a box.json inside of it, CommandBox will be able to get all the juicy details of the package.

# Install a local package zip using absolute or relative paths
CommandBox> install /var/libs/myPackage.zip
CommandBox> install ../../libs/myPackage2.zip

# Install a local package folder using absolute or relative paths
CommandBox> install /var/libs/myPackage/
CommandBox> install ../../libs/myPackage2/

Server Starts

Starting servers follows many of the same rules as installing packages.  This is largely because CommandBox actually uses ForgeBox behind the scenes to host and download the CF engines for you.  

Starting the default server will re-use the same jars that CommandBox already has (Lucee 4.5.4.017 at the time of writing) and won't require any internet connection.

CommandBox> server start

When you start servers using a version range like 4.x CommandBox will connect to ForgeBox to figure out what the latest version is that matches your range.  To skip this check, specify an exact version for your CF engine when starting.

CommandBox>server start cfengine=lucee@5.1.0+34

CF engines can be up to 300MB in size (Adobe CF 2016) and are cached in the same artifacts cache as the rest of your packages. We also have the same fail safe behavior.  Even if you specify a version range, we'll use the best match in your local artifacts cache if ForgeBox is unreachable.  This should keep you trucking even when you've gone off-grid.  Read more about offline server starts here:

https://ortus.gitbooks.io/commandbox-documentation/content/embedded_server/offline_server_starts.html

 

 

 

Add Your Comment

Recent Entries

Partner with BoxLang and Ortus at Into the Box 2025: Empowering the Future of Modern Software Development!

Partner with BoxLang and Ortus at Into the Box 2025: Empowering the Future of Modern Software Development!

At Ortus Solutions, we’ve always been at the forefront of innovation in the ColdFusion ecosystem. From pioneering modern ColdFusion practices to developing cutting-edge tools and frameworks, we’ve been passionate to help and sup[port the community into shaping the future of web development.That’s why we decided to build BoxLang, our new JVM programming language that not only builds on the strengths of ColdFusion but takes modern software development to the next level.

Maria Jose Herrera
Maria Jose Herrera
December 23, 2024
Why BoxLang When You Have Kotlin, Groovy, Scala, and more…

Why BoxLang When You Have Kotlin, Groovy, Scala, and more…

As we approach a stable release of BoxLang and our continued marketing reaches more folks, many have asked about its purpose. Why create a new language when the JVM ecosystem already includes established languages like Kotlin, Groovy, and Scala, to name a few.

Luis Majano
Luis Majano
December 18, 2024