Automatically run a command when deploying a service package
Suppose your service uses a third-party tool and it needs to be installed on the compute host, or you want to run a script to perform some actions for proper functioning of the service program. You can configure this in a package-specific deployment.xml configuration file.
Procedure
- Automatically run a command when deploying a Windows service package:
- Create a file for your service package with the name deployment.xml.
The file must be called deployment.xml.
For example:<Deployment xmlns="http://www.platform.com/Symphony/Deployment"> <install> <osTypes> <osType name="NTX64" startCmd="setup" timeout="600" successCodes="0,1,2"/> </osTypes> </install> <uninstall> <osTypes> <osType name="NTX64" startCmd="setup -u" timeout="30" successCodes="0"/> </osTypes> </uninstall> </Deployment>
Note: To run a Windows .bat script, you need to specify a special syntax. For example:<osType name="NTX64" startCmd="cmd /c install.bat" timeout="600" successCodes="0,1,2"/>
- Use the install section to configure the command to run after the package is uncompressed on a compute host.
- For startCmd, specify a path relative
to the service package installation directory.
For example, if your package contained a subdirectory called scripts with the command you want to invoke called myscript, specify:
startCmd="scripts\myscript"
- Use the uninstall section to configure the command to run if the startCmd specified in the install section fails, or before the package is removed from a compute host.
- Add deployment.xml to your service
package with the executables for the commands you specified in StartCmd. Important: There can only be one deployment.xml file per service package. The file must be at the beginning of the service package; it cannot be in a subdirectory.
- Deploy the service package.
- In the cluster management console, select Resources > Service Packages > Service Packages > Global Actions > Add package to repository.
The Add Package to repository page displays.
- Browse to your service package and select it.
- Click Add.
Your service package should now be displayed in the list.
Note: You can also use the soamdeploy command:soamdeploy add SampleService -p SampleService.exe.gz -c /SampleApplications/SOASamples soamdeploy view -c /SampleApplications/SOASamples
- In the cluster management console, select Resources > Service Packages > Service Packages > Global Actions > Add package to repository.
- Create a file for your service package with the name deployment.xml.
-
Automatically run a command when deploying a Linux®
service package:
-
Create a file for your service package with the name deployment.xml.
The file must be called deployment.xml.
For example:
<Deployment xmlns="http://www.platform.com/Symphony/Deployment"> <install> <osTypes> <osType name="LINUX86" startCmd="setup" timeout="600" successCodes="0,1,2"/> </osTypes> </install> <uninstall> <osTypes> <osType name="LINUX86" startCmd="setup -u" timeout="30" successCodes="0"/> </osTypes> </uninstall> </Deployment>
Note: All values in the deployment.xml file are case-sensitive when the service is deployed on Linux. - Use the install section to configure the command to run after the package is uncompressed on a compute host.
-
For startCmd, specify a path relative to the service package installation
directory.
For example, if your package contained a subdirectory called scripts with the command you want to invoke called myscript, specify:
startCmd="scripts/myscript"
- Use the uninstall section to configure the command to run if the startCmd specified in the install section fails, or before the package is removed from a compute host.
-
Add deployment.xml to your service package with the executables for the
command you specified in StartCmd.
Important: There can only be one deployment.xml file per service package. The file must be at the beginning of the service package; it cannot be in a subdirectory.
-
Deploy the service package.
- In the cluster management console, select Resources > Service Packages > Service Packages > Global Actions > Add package to repository.
The Add Package to repository page displays.
- Browse to your service package and select it.
- Click Add.
Your service package should now be displayed in the list.
Note: You can also use the following commands:soamdeploy add SampleService -p SampleService.tar.gz -c /SampleApplications/SOASamples soamdeploy view -c /SampleApplications/SOASamples
- In the cluster management console, select Resources > Service Packages > Service Packages > Global Actions > Add package to repository.
-
Create a file for your service package with the name deployment.xml.