App

Manifest

A tutorial on using the app manifest to specify execution environment and other configuration.

An application that runs on the Nextmv Platform must contain a file named app.yaml which is known as the app manifest. This file is used to specify the execution environment for the app.

Additionally, the app must be executed from an entrypoint. The entrypoint of the app should be:

  • main for Go
  • main.py for Python
  • main.jar for Java

You can port any custom app into the Nextmv Platform. You just need the app.yaml manifest in the root of the project with the appropriate attributes and an adequate entrypoint.

Mandatory attributes

The app.yaml manifest must contain the following attributes:

  • type: the language type to use for the app.

    • go for Go
    • python for Python
    • java for Java
  • runtime: the runtime to use for the app.

  • files: the files to include (or exclude) in the app. Globbing is supported so you may specify individual files or whole directories. Include the entrypoint of the app here. Some examples of supported glob patterns:

    • **/*.py: all Python files recursively
    • !**/*.pyc: exclude all Python compiled files
    • app/**/*.py: all Python files in the app directory.

    Patterns are applied in order as they are defined.

Optional attributes

The app.yaml manifest may contain the following optional attributes:

  • build: contains build-specific attributes.
    • command: the command to run to build the app. This command will be executed without a shell, i.e., directly. The command must exit with a status of 0 to continue the push process of the app to Nextmv Cloud. This command is executed prior to the pre-push command.
    • environment: environment variables to set when running the build command given as key-value pairs. E.g. GOOS: linux.
  • pre-push: a command to run before the app is pushed to the Nextmv Cloud. This command can be used to compile a binary, run tests or similar tasks. One difference with what is specified under build, is that the command will be executed via the shell (i.e., bash -c on Linux & macOS or cmd /c on Windows). The command must exit with a status of 0 to continue the push process. This command is executed just before the app gets bundled and pushed (after the build command).
  • python (only for Python apps): contains further Python-specific attributes.
    • pip-requirements: path to a requirements.txt file containing (additional) Python dependencies that will be bundled with the app.
  • configuration: the configuration for your application
    • options: option configuration for your application
      • strict: (default: false) an option configuration that will prevent your app from being run in Nextmv Cloud if you provide options outside of the ones configured in items if validation enforcement is all
      • validation: validation configuration for your application
        • enforce: (default: "none") the validation enforcement setting for your application, "all" will validate all options in the configuration foroption_type, required, and additional_attributes.
      • items: the options you would like to configure on your application, a list of objects

Language Examples

Find basic examples of app.yaml manifests for different languages below.

type: go
# We use the default runtime as the app gets compiled into a binary
runtime: ghcr.io/nextmv-io/runtime/default:latest
# We build the app for linux and arm64 (the default runtime)
# and call it "main" (the default entrypoint)
build:
  command: go build -o main .
  environment:
    GOOS: linux
    GOARCH: arm64
# We only need to include the resulting binary "main"
files:
  - main
Copy

Furthermore, there are various examples of manifests in the context of complete apps from our community apps for all supported languages. Find the manifests themselves as a reference below.

go apps

    python apps

      java apps

        Option Item Configuration

        Model options can be surfaced in a defined manner by specifying them in your app.yaml. The available properties to define your option, its value schema and the control used to render it in Nextmv Console are outlined in the tables below.

        Top-level properties

        The following properties are available to be set on each option.

        Property Required Type Default Description
        nameyesstringN/AIdentifier of your option.
        descriptionnostringNoneDescription for your option. (The description will appear as a tooltip for the option in Nextmv Console.)
        requirednobooleanfalseRepresents whether the options is required, used in validation.
        option_typeyesstring | bool | int |floatNoneThe expected type of the option value, used in validation.
        additional_attributesnoobjectNoneUsed by Nextmv Console and for option validation, select attributes are supported based on control_type (see additional attributes table below).
        defaultnoAnyNoneDefault value applied to your application run if not set in other configuration based on options hierarchy.
        uinoobjectNoneAdditional instruction for how the option is rendered in Nextmv Console (see UI properties table below).

        Supported controls by type

        Certain UI controls can only be specified for a certain option types. The table below lists the valid control_types depending on which option_type has been defined.

        Option type Supported control typesDefault
        stringinput, selectinput
        booltoggletoggle
        intinput, sliderinput
        floatinput, sliderinput

        additional_attributes properties

        The required and supported additional attributes on an option depend on the option and control type. The table below lists the available properties for additional_attributes based on what is set for the option’s control_type and option_type properties.

        Option type Control type Additional attribute Required Description
        stringinputmax_lengthfalseThe maximum length of the string value
        min_lengthfalseThe minimum length of the string value
        stringselectvaluestrueAn array of strings for the select dropdown
        intinputminfalsea minimum value for the option
        maxfalseA maximum value for the option
        stepfalseAn interval for the input control
        intslidermintruea minimum value for the option
        maxtrueA maximum value for the option
        steptrueAn interval for the input control
        intselectvaluestruean array of integers for the select dropdown
        floatinputminfalsea minimum value for the option
        maxfalseA maximum value for the option
        stepfalseAn interval for the input control
        floatslidermintruea minimum value for the option
        maxtrueA maximum value for the option
        steptrueAn interval for the input control
        floatselectvaluestruean array of integers for the select dropdown

        ui properties

        Property Required Type Default Description
        control_typenoSee control_type properties table below.inputIf no control_type is specified, the default is to render the option as a text input.
        hidden_fromnoArray of roles. See hidden_from table below with list of available roles.NoneList of roles from which this option will be hidden in Nextmv Console. (Note that this feature is for the UI only.)

        ui.control_type properties

        The table below lists valid values for the control_type property in the ui block.

        Value Description
        inputStandard text input field.
        selectDropdown selection list. The options to select from are specified with values in additional_attributes.
        sliderRange slider control.
        toggleBoolean toggle switch.

        ui.hidden_from properties

        The table below lists valid values for the array of roles in the hidden_from property in the ui block.

        Value Description
        operatoroperator role
        viewerviewer role

        Example manifest configuration

        Find an example of the configuration you can provide in your app.yaml manifest.

        configuration:
          options:
            strict: true
            validation:
              enforce: all
            items:
              - name: option_1_slider
                option_type: int
                default: 10
                required: true
                additional_attributes:
                  min: 0
                  max: 100
                  step: 10
                ui:
                  control_type: slider
              - name: option_1_input
                option_type: int
                default: 10
                required: true
                additional_attributes:
                  min: 0
                  max: 100
                  step: 1
                ui: 
                  hidden_from:
                    - operator
                  control_type: input
              - name: option_2
                option_type: string
                additional_attributes:
                  values:
                    - choice_1
                    - choice_2
                    - choice_3
                ui:
                  control_type: select
              - name: option_2_default
                option_type: string
                default: choice_2
                additional_attributes:
                  values:
                    - choice_1
                    - choice_2
                    - choice_3
                ui:
                  control_type: select
              - name: option_3
                option_type: bool
                default: true
                required: true
              - name: option_4
                option_type: float
                ui:
                  control_type: input
                  hidden_from:
                    - operator
              - name: option_4_slider
                option_type: float
                additional_attributes:
                  min: 0
                  max: 10
                  step: 0.1
                ui:
                  control_type: slider
        
        Copy

        Page last updated

        Go to on-page nav menu