Recipes
Click > or a question to see details.
Recipes are the scripts which run inside the server (using SSH). This means that recipes will run in scope of server and perform all the tasks that can be performed with this server directly.
Both user and admin accounts can use recipes. The configuration for each level of accounts differs.
When signed up for administrator account, you can create Recipes for:
Compute Zones
Smart Servers
Baremetal Servers
Control Panel
VS Templates
VSs
Administrators can assign virtual server recipes to the following events:
- VS provisioning - run the recipe during VS provisioning
- VS network rebuild - run the recipe when rebuilding a network
- VS disk added - run the recipe when adding a disk
- VS network interface added - run the recipe when adding a network interface
- VS disk resized - run the recipe when resizing a VS disk
- VS resize - run the recipe when resizing a VS
To assign a recipe drag and drop it to a desired event.
Users can create and assign recipes for their VSs only.
Requirements:
- The machine is powered on
- The SSH service is up and running
- The SSH key of Control Panel is not be removed for the OnApp user
If the connection via SSH is lost, the recipe execution will fail, as recipes run via SSH. It means that a recipe fails if the server has been rebooted when it is executing, even if the reboot has been executed by the recipe.
In Unix-based systems, connection to a server and running of a recipe are performed by the 'root' user. For Windows-based VSs, the 'SvcCOPSSH' user or 'Administrator' user performs these tasks.
You should ensure that these users have the permissions to perform the action you want.
To run PowerShell executable, use the following path: %windir%\System32\WindowsPowerShell\v1.0\powershell. Make sure to check with Microsoft updates of PowerShell version and put the newest version available into that path. This way, the latest version of PowerShell will be provided for your version of Windows OS.
1. In Unix systems, simply copy the recipe script into the file located on the remote machine, make it executable (chmod +x script_file) and run it.
On Windows systems, copy the recipe script to the destination machine. The execution time will depend on the script type.
2. Connect to the machine via SSH. You will be taken to a bash-like terminal:
su onapp ssh SvcCOPSSH@xxx.xxx.xxx.xxx for 3.x based templates ssh Administrator@xxx.xxx.xxx.xxx for 4.x based template
3. Run the following:
BAT: cmd /Q /C "CALL script_file" Vbs: cmd /C "CALL CScript.exe script_file //Nologo" PowerShell: cmd /C "CALL %windir%\System32\ WindowsPowerShell\v1.0\powershell -InputFormat None -NonInteractive -NoLogo Set-ExecutionPolicy Unrestricted" cmd /C "CALL %windir%\System32\WindowsPowerShell\v1.0\powershell -InputFormat None -NonInteractive -NoLogo -File script_file"
Try to run your scripts this way before creating a recipe. This will ensure they are working via SSH and that you have enough permissions to perform the desired actions.
When running a recipe and it is in progress, you can also gather useful output from your Control Panel server using the following command:
tail -f /onapp/interface/log/onapp.err
Here is the recipe that installs IIS on a Windows Server. It is separated into different scripts so It could be easily debugged.
--Step1-------
function InstallFeature($name) {
cmd /c "ocsetup $name /passive"
}
InstallFeature IIS-WebServerRole
InstallFeature IIS-WebServer
InstallFeature IIS-CommonHttpFeatures
InstallFeature IIS-DefaultDocument
InstallFeature IIS-DirectoryBrowsing
InstallFeature IIS-HttpErrors
InstallFeature IIS-HttpRedirect
InstallFeature IIS-StaticContent
InstallFeature IIS-HealthAndDiagnostics
InstallFeature IIS-CustomLogging
InstallFeature IIS-HttpLogging
InstallFeature IIS-HttpTracing
InstallFeature IIS-LoggingLibraries
InstallFeature IIS-Security
InstallFeature IIS-RequestFiltering
InstallFeature IIS-WindowsAuthentication
InstallFeature IIS-ApplicationDevelopment
InstallFeature IIS-NetFxExtensibility
InstallFeature IIS-ISAPIExtensions
InstallFeature IIS-ISAPIFilter
InstallFeature IIS-ASPNET
InstallFeature IIS-WebServerManagementTools
InstallFeature IIS-ManagementConsole
InstallFeature IIS-ManagementScriptingTools
import-module WebAdministration
----------------------Step2---------------
# --------------------------------------------------------------------
# Loading IIS Modules
# --------------------------------------------------------------------
Import-Module WebAdministration
-----Step3-----------------
Set-Content C:\DemoSite\Default.htm "DemoSite Default Page"
Set-Content C:\DemoSite\DemoApp\Default.htm "DemoSite\DemoApp Default Page"
Set-Content C:\DemoSite\DemoVirtualDir1\Default.htm "DemoSite\DemoVirtualDir1 Default Page"
Set-Content C:\DemoSite\DemoVirtualDir2\Default.htm "DemoSite\DemoApp\DemoVirtualDir2 Default Page"
--------Step4---------------
New-Item IIS:\AppPools\DemoAppPool
-------Step5 ----------------
New-Item IIS:\Sites\DemoSite -physicalPath C:\DemoSite -bindings @{protocol="http";bindingInformation=":8080:"}
Set-ItemProperty IIS:\Sites\DemoSite -name applicationPool -value DemoAppPool
New-Item IIS:\Sites\DemoSite\DemoApp -physicalPath C:\DemoSite\DemoApp -type Application
Set-ItemProperty IIS:\sites\DemoSite\DemoApp -name applicationPool -value DemoAppPool
New-Item IIS:\Sites\DemoSite\DemoVirtualDir1 -physicalPath C:\DemoSite\DemoVirtualDir1 -type VirtualDirectory
New-Item IIS:\Sites\D
No, SSH connection is not required for running recipes on VMware virtual servers.
You can do it by adding a recipe group to a billing plan. In such a way you limit the number of preconfigured plug-ins called recipes to users signed up for this billing plan. They can only choose from the recipe groups specified. If nothing added to a billing plan, then customers can use all the recipe groups in the system.