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. 


View List of All Recipes

  1. Go to your Control Panel > Cloud > Recipes > Recipes menu.
  2. On the screen that appears, you’ll see the list of all recipes in the cloud.

Use the tabs above to view a particular recipe type:

  • All

    To view the list of all recipes, click the All Recipes tab.

  • Unix compatible

    To view the list of Unix compatible recipes, click the Unix Compatible tab.

  • Windows compatible

    To view the list of Windows compatible recipes, click the Windows Compatible tab.

  • Unowned

    To view the list of recipes which owners have been deleted, click the Unowned Recipes tab.
    Recipes that run on other user's resources are not deleted after their owners are removed. These recipes can be accessed via Recipes > Unowned recipes menu. A user with global permissions can become an owner of any of the unowned recipes by choosing Actions > Become an owner.

View Recipe Details

  1. Go to your Control Panel > Cloud > Recipes > Recipes menu.
  2. On the screen that appears, you’ll see the list of all recipes in the cloud.
  3. Click the required recipe's label to view the following recipe details, along with the recipe step information:
    • Label - the label of the recipe
    • Description - the description of the recipe
    • Unix compatible - whether the recipe is compatible with Unix virtual servers
    • Windows compatible - whether the recipe is compatible with Windows virtual servers. For a Windows compatible recipe, specify the script type. You can select the following script types:
           • BAT
           • BS
           • PowerShell
    • Recipe steps along with their details:
      • Script - step code

      • Result source - step result source

      • Pass values - specify the pass output value, e.g., 0
      • On success - recipe behavior on success
      • Fail values - specify the pass output value
      • On failure - the recipe behaviour on failure


View List of Assigned Servers

  1. Go to your Control Panel > Cloud > Recipes > Recipes menu.
  2. On the screen that appears, click the Actions button next to the required recipe and select Applied to VS.
  3. On the following screen, you will see the list of the servers this recipe is assigned to.

Assign Recipe to Multiple Servers

You can assign recipe to several virtual or smart servers at once. To do so:

  1. Go to your Control Panel > Cloud > Recipes > Recipes menu.
  2. On the screen that appears, you’ll see the list of all recipes in the cloud.
  3. Click the Actions icon next to required recipe and click the Run Recipe on Vs(s) button.
  4. On the screen that appear, select the check boxes next to the servers you want to assign the recipe to.
  5. Click the Run on Selected button to confirm the selection.

Assigning several recipes to the same server may lead to simultaneous recipe implementation and performance issues.

  • When assigning one recipe to several servers via API, there is possibility to run the recipe incompatible with the server type (Unix recipe on Windows servers or vice versa). In this case the transaction will be scheduled and completed, but the recipe will not do anything.
  • Note that a VS related recipe is always executed first.


  • 1.You have two recipes, one assigned to a template and another assigned to a VS
    2.You assign both of them to a desired event
    3.After the VS is built, the VS related recipe is run first
    4.Next, the template recipe is run
    This execution order is also relevant when the VS related recipe and template recipe are both assigned to the same event.

Edit Recipe

  1. Go to your Control Panel > Cloud > Recipes > Recipes menu.
  2. Click the label of a recipe you want to edit, and then click the Edit icon. You can edit the following recipe details:

    Label - recipe label
    Description - recipe description
    Compatible with - select Unix or Windows to use this recipe for Unix or Windows virtual servers. For a Windows compatible recipe, specify the script type. You can select the following script types:

    • BAT
    • VBS
    • PowerShell
  3. Click the Save button to save your changes.

To edit a recipe step, click the edit icon next to the required step, then change its details as required. Refer to the Edit Recipe Step section below for details.


Edit Recipe Step

  1. Go to your Control Panel > Cloud > Recipes > Recipes menu.
  2. Click the Actions icon next to the recipe you want to change, then click the Edit button.
  3. On the screen that appears, you'll see the list of recipe steps. Click the Edit icon next to the step you want to edit.
  4. In the pop-up window, edit the 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 - display hint 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 set fail values (Pass anything else slider will be enabled automatically).

    Fail values - specify the pass output value.

    On failure - the recipe behaviour 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.
  5. Press 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.

Delete Recipe