A recipe is a plugin mechanism used for adding new functionalities to the OnApp cloud. Each recipe is a set of instructions that trigger events at certain stages during the execution of certain services/event in the cloud. Essentially, recipes allow inputting code into virtual servers, appliances or the Control Panel server. This enables administrators to use recipes for configuring the server or report on it, thus providing advanced customization options in a standard environment. In this document you can find information on how to create and manage recipes. 

You can create and use recipes for Unix (Linux and FreeBSD) and Windows virtual servers, smart servers, baremetal servers, virtual server templates, compute zones and the Control Panel server. 


Create Recipe

Adding a recipe consists of two stages:

Create Recipe

To create a recipe:

  1. Go to your Control Panel > CloudRecipes menu.
  2. Click the "+" button.
  3. Fill in the recipe creation form:

    Properties

    Label - give your recipe a label
    Description - provide a short recipe description (optional)
    Compatible with - choose if this recipe can be assigned to Unix or Windows virtual servers. For a Windows compatible recipe, specify the script type. You can select the following script types:

    • BAT
    • VBS
    • PowerShell

  4. Click Save.

After that, you'll be redirected to the recipe details screen where you can add steps to this recipe.

Create Steps

To create a new recipe step:

  1. Click the "+" button in the upper right corner of the Steps screen.

  2. In the pop-up window, specify step details as required:

    Script - input the recipe code.

    Result source - specify the step result source:

    • Exit Code - an exit code, for example, 0 is the default value returned on success.

      To use exit code in the VBS or PowerShell scripts, you have to specify it directly in the script. For example:

      VBS
      Script:
      WScript.Echo "test"
      WScript.Quit 95

      PowerShell
      Script:
      get-date -displayhint date
      exit 227

    • STDOUT - standard output.
    • STDERR - standard error
    • STDOUT and STDERR - standard output and standard error.

    Move the Pass anything else slider to the right if you do not want to specify the pass output value. Otherwise, leave this slider disabled to set the pass values.

    Pass values - specify the pass output value, for example, 0.

    You cannot specify both pass and fail values for one recipe step.

    You can specify multiple recipe values. In this case, you have to specify each value from a new line.


    On success 
    - the recipe behavior on success:

    • Proceed - proceed to the next step.
    • Fail - terminate the recipe and mark it as failed.
    • Stop- terminate the recipe and mark it as successful.
    • Go to step - specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.

    In case you have already specified the recipe pass values, you will get the Fail anything else slider enabled automatically, as you cannot specify both pass and fail values for one recipe step. Move this slider to the left if you want to set fail values (Pass anything else slider will be enabled automatically).

    Fail values - specify the pass output value.

    On failure - the recipe behavior on failure

    • Proceed - proceed to the next step.
    • Fail - terminate the recipe and mark it as failed.
    • Stop- terminate the recipe and mark it as successful.
    • Go to step - specify the step to proceed to. If you specify the nonexistent step, the recipe will be stopped.

  3. Click Save.

    Drag and drop steps to change their order. To do so:

    1. Select the required step and hold it down with the left mouse button.
    2. Drag the recipe up to the required position and release the mouse button to drop it.