Atomia Automation Server

Package example

10 views 0

Overview

The package description section describes available packages and package extensions in the system.

The basic structure of the package description looks like this:

             <provisioningDescription>
             ...
             <packageDescription>
             <packageList>
             <!-- List of available packages. -->
             </packageList>
             <packageExtensionList>
             <!-- List of available package extensions. -->
             </packageExtensionList>
             </packageDescription>
             </provisioningDescription>

Package

A package represents a group of services that are available for adding to an account. It also sets limitations on the number of allowed service instances.

Each package consists of the following subsections:

               <package name="ExamplePackage">
               <serviceList>
               <!-- List of services which form the package -->
               </serviceList>
               <serviceLimitationList>
               <!-- List of limitations per service. -->
               </serviceLimitationList>
               <propertySettings>
               <!-- Property values settings for specific services. -->
               </propertySettings>
               <init>
               <!-- Package initialization section. -->
               </init>
               <disable>
               <!-- List of package disable scripts -->
               </disable>
               <actionHooks>
               <!-- List of action hooks per package. -->
               </actionHooks>
               </package>

The following example shows a basic package description:

               <package name="PremiumPackage">
               <serviceList>
               <service name="CsBase" />
               <service name="CsWindowsBinding" />
               </serviceList>
               <serviceLimitationList>
               <globalLimitation>
               <group maxCount="1">
               <service name="CsBase" />
               </group>
               <group maxCount="1">
               <service name="CsDomainRegList" />
               </group>
               </globalLimitation>
               </serviceLimitationList>
               <init>
               <arguments>
               <argument serviceName="CsBase" propertyName="InitMasterFtpAccount" propertyValue="true" />
               </arguments>
               <serviceToAdd serviceName="CsBase">
               <propertyInitList>
               <property servicePropertyName="ADPassword" valueSource="ADPassword" />
               <property servicePropertyName="PosixUid" valueSource="PosixUid" />
               <property servicePropertyName="FtpPassword" valueSource="FtpPassword" />
               <property servicePropertyName="RootFolderParentPath" valueSource="RootFolderParentPath" />
               </propertyInitList>
               </serviceToAdd>
               </init>
               </package>

The subsection serviceList lists all services that can be added, as root services, for an account that has this instance of this package enabled. The consequence of this is that the list can be populated only with complex services and root simple services.

The number of available service instances can easily be limited by using the  serviceLimitationList section. In this section, each service type, which can be provisioned (it doesn’t need to be a complex or root simple service), can be limited in number of existing instances per account.

Just like a complex service, a package can also have an  init section. This section is the same as for a complex service. It is used to initialize package instances when it is being added.

Let’s take a look at a more complex package example:

               <package name="PremiumPackage">
               <serviceList>
               <service name="CsBase" />
               <service name="CsWindowsBinding" />
               </serviceList>
               <disable>
               <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3CscriptList%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cscript%20name%3D%22Disable%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CserviceList%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cservice%20path%3D%22CsBase%2FCsWindowsWebsite%2FIISApplicationPool%2FIISWebSite%22%20action%3D%22modify%22%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CpropertyList%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cproperty%20name%3D%22HomeDirectory%22%20newValue%3D%22%2Fmnt%2Fcontent%2Fsuspended%2Fpublic_html%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FpropertyList%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fservice%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cservice%20path%3D%22CsBase%2FCsLinuxWebsite%2FLiteSpeedWebSite%22%20action%3D%22modify%22%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CpropertyList%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cproperty%20name%3D%22HomeDirectory%22%20newValue%3D%22%2Fmnt%2Fcontent%2Fsuspended%2Fpublic_html%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FpropertyList%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fservice%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cservice%20path%3D%22*%2FFTPAccount%22%20action%3D%22modify%22%20%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CpropertyList%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cproperty%20name%3D%22Status%22%20newValue%3D%220%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FpropertyList%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fservice%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FserviceList%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;script&gt;" title="&lt;script&gt;" />
               </scriptList>
               </disable>
               <actionHooks>
               <onBeforeChangePackage argument="BasePackage,PremiumPackage" type="Atomia.Provisioning.Example.ActionHook, Atomia.Provisioning.Example"/>
               </actionHooks>
               </package>

In the previous example, the focus was on the disable subsection. This section defines a list of scripts that can be used to disable a package instance.

Action hooks

As well as action hooks in the service description, packages can also have the same. They contain a logic that can be executed on different events which occur in the provisioning process. Currently, the available event is onBeforeChangePackage. This event will be triggered every time when a customer wants to perform the upgrade or downgrade a package. The action hook argument attribute should be a valid JSON object with the following properties:

  • upgrade_to – list of packages on which the current package can be upgraded
  • downgrade_to – list of packages on which the current package can be downgraded
  • keep_mail_on_downgrade – the flag that determines whether any existing email accounts, email forwards, and/or mail aliases should be transferred to the downgraded package or not
  • preview_zone – the preview zone
  • keep_unsupported_services_and_extensions – the flag that determines whether the unsupported services should be deleted or not
  • downgrade_to_parking – the flag that determines whether the package should be downgraded to parking or not
  • recreate_services_within_group – list of services that should be recreated (this will delete specific service and create it again)
  • update_properties_for_service_per_package – list of services with properties that should be updated (per package)

Example of an action hook:

<actionHooks>
    <onBeforeChangePackage argument="{'upgrade_to':['BasePackage','PremiumPackage','ApplicationInstallerPackage'],'downgrade_to':['DnsPackage'],'preview_zone':'preview.examle.com','keep_mail_on_downgrade':'false','keep_unsupported_services_and_extensions':'false'}" type="Atomia.Provisioning.ActionHooks.PackageChange.UpgradeDowngrade, Atomia.Provisioning.ActionHooks.PackageChange"/>
</actionHooks>

Keep in mind

If you want to keep email accounts, email forwards and/or mail aliases on downgrade, make sure that the global limitations for the targeted package allows that. Otherwise, setting the flag keep_mail_on_downgrade to true wont have any effect.

Package extension

The Atomia Automation Server allows a package to be extended. For each package extension, it is possible to define a list of services that will be enabled with this extension. Package extensions also allow package limitations per service to be overridden. It is also possible to set certain service property values.

The package extension structure is shown in the following example:

               <packageExtension name="ExamplePackageExtension">
               <serviceList>
               <!-- List of services which have been enabled by activating extension. -->
               </serviceList>
               <serviceLimitationList>
               <!-- List of limitations per service. -->
               </serviceLimitationList>
               <propertySettings>
               <!-- Property values settings for specific services. -->
               </propertySettings>
               <init>
               <!-- Package extension initialization section. -->
               </init>
               <disable>
               <!-- List of package extension disable scripts -->
               </disable>
               <extendsList>
               <!-- List of packages that can be extended by this extension. -->
               </extendsList>
               </packageExtension>

Common package extensions looks like this:

               <packageExtension name="ExamplePackageExtension">
               <serviceLimitationList>
               <globalLimitation>
               <group maxCount="1" name="SampleLimitation">
               <service name="ExampleService" />
               </group>
               </globalLimitation>
               </serviceLimitationList>
               <extendsList>
               <extends name="ExamplePackage" />
               <extends name="PremiumExamplePackage" />
               </extendsList>
               </packageExtension>

Was this helpful?