Zend Server User Guide > Tasks > Working with Applications > Application Package > Understanding the Package Structure

Understanding the Package Structure

This topic will help you understand the structure of the .zpk package which contains the data, scripts, and an XML descriptor file for your application.

How do I prepare the application package?

How do I deploy the application package?

Package Structure

The .zpk package contains the following components:

Data

The application's main data directory for inclusion in the package. It contains the application files, deployment scripts, and extra resources such as icons, EULA and README (.txt/.md) files.

By default, this folder is called 'Data' but you can name it differently and reference it accordingly when building your package.

Descriptor File (deployment.xml)

This XML file, which is defined by an XSD file, describes all necessary information in order to deploy your application using Zend Server’s deployment feature, and contains:

For an example of the descriptor template see The XML Descriptor File.

Scripts

Zend Server deployment consists of five actions: two for deployment, one for rollback and two for removal. Two hook scripts are provided for each action (pre and post), allowing you to customize the actions according to your needs. You can select from a list of available hook script constants to insert in the scripts.

See Preparing the Package Using the Deployment Tool to learn how to build your application package.

Monitoring and Caching Rules .xml Files

The Scripts component in the .zpk package can also include .xml files representing monitoring or caching rules. See Creating the Package to learn how to insert rules in your application package.

Hook Script Examples

The following is a list of examples for operations that may be defined in each hook script:

Deployment Hook Script Constants Examples

The following is a list of the available dynamic values that can be used by the deployment hook scripts:

Usage Example

This example shows how to use the ZS_PREVIOUS_APP_VERSION value by a deployment hook script to upgrade previous application versions:

<?php

//... some code here ...//

if (getenv('ZS_PREVIOUS_APP_VERSION') !== false) {

switch (getenv('ZS_PREVIOUS_APP_VERSION')) {

case "1.4":

//// perform upgrade from 1.4 -> 1.5

case "1.5":

//// perform upgrade from 1.5 -> 1.6

case "1.6":

//// perform upgrade from 1.6 -> CURRENT/1.7

break;

default:

//// perform actions when current version is different than expected

} // switch previous app versions actions

} // if there is a previous app version

else {

//// perform actions specific to new installation, which cannot be performed with upgrade

} // complete new installation specific actions

//... more code here ...//

?>

 

Read Also

  Zend Deployment    
  Deploying an Application    
  Example Codes