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

ColdBox 7.2.0 Released

ColdBox 7.2.0 Released

ColdBox, a widely used development platform for ColdFusion (CFML), has unveiled version 7.2. Packed with compelling new features, bug fixes, and enhancements, this release is designed to empower developers by boosting productivity, refining scheduled task capabilities, and enhancing the overall reliability and efficiency of application development. This article will delve into the key highlights of ColdBox 7.2 and elucidate how these advancements can positively impact developers in their daily coding endeavors.

Luis Majano
Luis Majano
November 20, 2023
Into the Box 2023 Series on CFCast

Into the Box 2023 Series on CFCast

Excitement is in the air as we unleash the highly anticipated ITB 2023 series exclusively for our valued CFCast subscribers – and the best part? It's FREE for CFCast members! Now is the perfect time if you haven't joined the CFCast community yet. Plus, we've got an incredible End-of-Year deal that's too good to miss

Maria Jose Herrera
Maria Jose Herrera
November 20, 2023
Ortus Deals are Finally Here!

Ortus Deals are Finally Here!

The much-anticipated Ortus End-of-the-Year Sale has arrived, and it's time to elevate your development experience! Whether you're a seasoned developer, a tech enthusiast, or someone on the lookout for top-notch projects, Ortus has something special in store for you. Brace yourself for incredible discounts across a wide array of products and services, including Ortus annual events, books, cutting-edge services, and more.

Maria Jose Herrera
Maria Jose Herrera
November 15, 2023