Get started

This page details the steps for getting started with an enterprise app. For information on available apps, see the Apps section on the Decision Stack page.

Machine access and environment setup

Github access

If this is your first time using GitHub you will need to add SSH keys to your GitHub account to associate it to your machine. Instructions on doing so can be found here.

We manage access to our repositories using GitHub teams, generally you will be added at the beginning of your trial.

Go and Git setup

Nextmv requires at least Go 1.13. We recommend asdf for installing and managing Go versions. You should be able to find the binaries for your target system at https://golang.org/dl/.

After installing the precompiled packages, set the following environment variables in your ~/.bashrc, ~/.zshrc or a similar configuration file.

export GOPATH=$(go env GOPATH)
export GOROOT=$(go env GOROOT)
export GOPRIVATE=github.com/nextmv-io/*
export PATH=$PATH:$GOPATH/bin

Note that if you installed Go directly from Golang, you do not need to add exports for GOPATH or GOROOT. If you installed go via Homebrew, you will need to add those lines to ~/.zshrc. If you were using bash previously, also be sure to source ~/.zshrc by running source ~/.zshrc.

Your ~/.gitconfig will work best if it directs git to clone repositories over ssh. Add the following to your configuration file.

insteadOf = https://github.com/

Go workspace

We use Go modules to handle packages. More information about Go modules and packages can be found in our Organizing Model Source docs section.

Go package docs

Go package documentation is the best way to learn the Nextmv Decision Stack.

To read the package documentation, start a local godoc server from your terminal.

go get -u golang.org/x/tools/cmd/godoc
godoc -http=:6060

Leave your terminal open and access package docs at code/hop and code/engines.

Alternately, you can download these for offline use with wget.

mkdir hop-package-docs
cd hop-package-docs
wget -m -k -q -erobots=off --no-host-directories \
--no-use-server-timestamps http://localhost:6060/ \
-I pkg/github.com/nextmv-io/code/

Build your app

To build your app with Nextmv, start by downloading and installing the external packages listed in the go.mod file by running:

go get ./...

The go get command will create a go.sum file (if not already present) that contains hashes of each module to ensure the same files are being retrieved upon each build. At this point, you should have all of the necessary packages needed to build our executable binary.

Change directory into the ./cmd/model-name package (replace model-name with your model package name) and run the following command to compile all of the packages named in the import path of ./cmd/model-name:

go build

Notice that a ./model-name binary should have been created.

Run your app

You have several options for runing a model with Nextmv. The easiest one is the Command Line Interface (CLI) runner. You can use flags to tell Hop where to read the data and where to write it, among other options.

Before running the binary using the CLI runner, first view available flags using:

./model-name -h

This is an example of how to run the binary using some of the flags provided:

./model-name \
-hop.runner.input.path data/input.json \
-hop.solver.limits.duration 10s \
-hop.runner.output.path data/output.json

This command will tell the runner to read data from a ./data/input.json file, set the solver duration to 10 seconds, and write it to a ./data/output.json file.

The CLI runner will print JSON to standard out.