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

Ortus June 2024 Newsletter!

Ortus June 2024 Newsletter!

Welcome to the latest edition of the Ortus Newsletter! This month, we're excited to bring you highlights from our sessions at CFCamp and Open South Code, as well as a sneak peek into our upcoming events. Discover the latest developments in BoxLang, our dynamic new JVM language, and catch up on all the insightful presentations by our expert team. Let's dive in!

Maria Jose Herrera
Maria Jose Herrera
June 28, 2024
BoxLang June 2024 Newsletter!

BoxLang June 2024 Newsletter!

We're thrilled to bring you the latest updates and exciting developments from the world of BoxLang. This month, we're diving into the newest beta release, introducing a new podcast series, showcasing innovative integrations, and sharing insights from recent events. Whether you're a seasoned developer or just getting started, there's something here for everyone to explore and enjoy.

Maria Jose Herrera
Maria Jose Herrera
June 28, 2024
BoxLang 1.0.0 Beta 3 Launched

BoxLang 1.0.0 Beta 3 Launched

We are thrilled to announce the release of BoxLang 1.0.0-Beta 3! This latest beta version is packed with exciting new features and essential bug fixes, including robust encryption functionality, enhanced Java interoperability, and more efficient event handling. Key highlights include the introduction of query caching capabilities, seamless coercion of Java Single Abstract Method (SAM) interfaces from BoxLang functions, and support for virtual thread executors. So, let’s dive into the details of what’s new in BoxLang 1.0.0-Beta 3 and how you can start leveraging these updates today!

Luis Majano
Luis Majano
June 28, 2024