Skip to content
This repository was archived by the owner on Sep 6, 2024. It is now read-only.

Latest commit

 

History

History
50 lines (37 loc) · 1.77 KB

File metadata and controls

50 lines (37 loc) · 1.77 KB

Nextmv Go template

This template helps you writing your own optimization model in Go. It contains several files to easily deploy the model to the Nextmv platform.

The most important files created are main.go and input.json.

  • main.go is where you write your model.
  • schema.go contains the input and output schema definitions.
  • input.json is a sample input file that follows the input definition in schema.go.

Run the command below to check that everything works as expected:

go run . -runner.input.path input.json \
  -runner.output.path output.json -recipient nextmv

A file output.json should have been created with a greeting message.

Mirror running on Nextmv Cloud locally

Pre-requisites: Docker needs to be installed.

To run the application locally in the same docker image as the one used on the Nextmv Cloud, you can use the following command:

GOOS=linux go build -o main . && \
cat input.json | docker run -i --rm \
-v $(pwd):/app ghcr.io/nextmv-io/runtime/default:latest \
/app/main

You can also debug the application by running it in a Dev Container. This workspace recommends to install the Dev Container extension for VSCode. If you have the extension installed, you can open the workspace in a container by using the command Dev Containers: Reopen in Container.

Next steps

  • Open main.go and start writing your own Go model.
  • API documentation and examples can be found in the package documentation.
  • Further documentation, guides, and API references about custom modeling and deployment can also be found on our blog and on our documentation site.
  • Need more assistance? Send us an email!