Skip to content

Instantly share code, notes, and snippets.

@tylerflint
Last active November 21, 2016 10:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylerflint/3262228c3e8a29addd382f53de9aa2ea to your computer and use it in GitHub Desktop.
Save tylerflint/3262228c3e8a29addd382f53de9aa2ea to your computer and use it in GitHub Desktop.
Nanobox run & deploy

Major changes

We have been working on some exciting changes! This is a fundamental shift in workflow, in how nanobox is used, and how nanobox works for you. After about a dozen conversations that all followed the same pattern, it occurred to us: Nanobox needs to be simpler, it needs to get out of the way. And that's exactly what we did, we threw away the clunky workflow and started over.

Overview

Excluding one-time-only administrative commands like adding evars, Nanobox has been stripped down to two primary commands:

nanobox run
nanobox deploy

You no longer have to fuss with environments at all. Essentially, you can run nanobox locally, or deploy to production. run has become the primary interface to your development flow. You can either run a single command inside of nanobox, or drop into an interactive console and run a series of commands:

Here are some examples:

# run django directly
nanobox run python manage.py runserver 0.0.0.0:8000

# install npm packages
nanobox run npm install

# drop into a nanobox console
nanobox run

Deployment has never been easier. After creating an app on dashboard.nanobox.io, you can deploy like this:

nanobox remote add app-name
nanobox deploy

The Essentials

Your daily flow might look something like this:

nanobox run
# write code
nanobox deploy

Advanced Usage

Of course, nanobox isn't losing any functionality at all:

  • Add a local dns: nanobox dns add local myapp.dev
  • Add an evar: nanobox evar add local FOO=bar
  • Add additional remotes: nanobox remote add app-name staging
  • Deploy to an additional remote: nanobox deploy staging
  • Preview (dry-run) the deploy locally: nanobox deploy dry-run

New Configuration (boxfile.yml)

This change is not just skin deep, the boxfile.yml configuration has been completely revamped as well (ok mostly just renamed some things to make more sense).

Essentially, code.build has been renamed to run.config, and code.deploy has been renamed to deploy.config. Within those sections, many configurations were renamed. You can see the entire configuration changes here.

How to upgrade

Upgrade Nanobox

Update the Nanobox binary:

nanobox-update

Update the docker images:

nanobox update-images

Modify your boxfile.yml

The structure of your boxfile.yml configuration is the same, but you will need to rename some of the configuration:

Heads Up: You only need to change these configurations IF you have them.

[Global]

  • rename code.build to run.config
  • rename code.deploy to deploy.config
  • move all configuration within dev into run.config

[run.config]

  • rename config to engine.config
  • rename paths to extra_path_dirs
  • rename lib_dirs to cache_dirs
  • rename after_build to extra_steps
  • move before_build tasks into extra_steps
  • move after_compile into deploy.config and rename to extra_steps
  • move before_compile tasks into deploy.config under extra_steps

[deploy.config]

  • rename before_deploy to before_live
  • rename before_deploy_all to before_live_all
  • rename after_deploy to after_live
  • rename after_deploy_all to after_live_all

Refresh your apps

cd into your app folder:

cd /path/to/your/app

destroy the app installation (does not destroy the app, just removes it from nanobox):

nanobox destroy

run a nanobox session:

nanobox run

Enjoy!

@johnrazmus
Copy link

Ya'll are AMAZING. Thank you ever so kindly : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment