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 Black Friday Deals are here!

Ortus Black Friday Deals are here!

Make 2023, the year you finally start modernizing your CFML projects with our Black Friday deals!

Don't waste any more time trying to find solutions, we got everything you need to rock your projects and learn new skills that will save you time and money while delivering a quality service. 

From Nov 25th to Dec 1st

Maria Jose Herrera
Maria Jose Herrera
November 25, 2022
Call For Speakers Open for Into The Box 2023

Call For Speakers Open for Into The Box 2023

We are very excited that the Into The Box conference is coming back to the Houston area and FINALLY on our normal schedule of May of 2023. Registration is now officially open and call for papers is now open as well. We are also extremely excited that this will be our 10 year anniversary for the Into The Box Conference. So we will defintely go all out!

  • Full 2-day conference with over 30 different technology topics
  • An additional full day of hands-on training available for a veritable 3 days of awesomeness
  • A warm and sunny city of The Woodlands, Texas
  • When: May 17-19 of 2023
  • Modernize Your Skillz
  • Party with our live Mariachi Band!

Luis Majano
Luis Majano
November 11, 2022
New Patreon Perk: Ortus Software Craftsmanship Book Club

New Patreon Perk: Ortus Software Craftsmanship Book Club

What is the Software Craftsmanship Book Club?

Its a place for CFML Community members can get together, discuss and debate the thoughts, ideas, best practices outlined by a series of books focusing on increasing Software Developers efficiency, productivity and pride. It will be relaxed but educational environment, where we can learn from each other, and grow as a community.

 

Ortus Software Craftsmanship Book Club

Maria Jose Herrera
Maria Jose Herrera
November 09, 2022