Preparing the Package Using the Deployment Tool

The following procedures explain how to create the library package (.zpk), which contains the data, scripts, and an XML descriptor file for your library.

What is the library package?

How do I deploy the library package?

Creating the Package

Zend's Deployment Tool allows you to create a skeleton package, and pack the contents into a .zpk package. For more information on the tool, see The Deployment Tool.

Instructions on how to complete a procedure

To create the package skeleton:

  1. Select a directory, and use the create command to create the skeleton of your .zpk package. This includes the XML descriptor file, the data folder and the hook scripts (templates):

  • Linux: '<install_dir>/bin/zdpack create <library-name>'
  • Windows: zdpack.exe create <library-name> where <library-name> is your library's name
  1. Go to the directory to see that the resources have been created:
  • Data folder - The folder that will contain your application files.
  • Scripts folder - The hook script skeletons available for you to edit as needed, and existing monitoring and caching rules (For more informationsee Understanding the Library Package Structure).

  • deployment.xml file - The template of the XML descriptor for you to edit as needed.
  1. Perform the following actions:

    1. Place your library files in the data folder.

    2. Edit the hook scripts according to your needs. You can select from a list of available hook script constants to insert in the scripts.

    3. Edit the XML file as needed. The XML template is made up of example elements. The required elements are name, version and appdir. For more information see the The XML Descriptor File.  

    4. Validate the package by using the validate command :

    • Linux: '<install_dir>/bin/zdpack validate [--schema=<xsd-file>] <package-xml-descriptor-file>'
    • Windows: 'zdpack.exe validate [--schema=<xsd-file>] <package-xml-descriptor-file>'
      The XSD file is located at: <install_dir>/share/deployment.xsd
  2. Use the pack command to pack the contents into a .zpk package. By default, the Deployment Tool will create the package in the working directory:

  • Linux: '<install_dir>/bin/zdpack pack <library-name>'
  • Windows: 'zdpack.exe pack <library-name>'

Once you have a .zpk library package ready and packed, you can deploy your library or update an existing library.

The Deployment Tool

 The Deployment Tool usage includes the following:

  • Tool location - The tool is located in:
    • Linux - '/usr/local/zend/bin/zdpack'
    • Windows - 'C:Program Files\Zend\ZendServer\bin\zdpack'
      -OR-

      as a standalone (if downloaded separately from the product).
  • Usage - Run the help command from the bin directory to see the usage:

    • Linux: '<install_dir>/bin/zdpack --help'
    • Windows: 'zdpack.exe --help')

Library Command Line Actions

Action

Description

create <library-name>

Create a skeleton for new library

validate [--schema=<xsd-file>] <package-xml-descriptor-file>

Validate a given Zend package descriptor against the schema file

pack <library-name>

Create a library package. The pack options should contain pointers to the application data directory, the package descriptor file, and the package scripts directory.

Library Command Line Options

Option

Description

package-directory

A directory containing the data and the script directories, in addition to the package descriptor file.

--src-dir=directory

The directory that contains the application resources (PHP sources, JavaScript, etc.). The directory's internal structure must match the necessary structure for the application to be functional.

--scripts-dir=directory

The directory which contains the package deployment scripts. The Deployment Tool will search this directory for the expected files (as described in section 2.2.1) and then packs them.

--package-descriptor=xml-file

The package descriptor file.

--output-dir=directory

The directory in which the package is created. The package name will be created as "<app-name>-<app-version>.zpk".

--php-exe=php-executable

The PHP executable to use for lint.

--lint

Performs a PHP lint test on the deployment scripts before creating the package.

--help

Displays the tool's usage.

--schema=xsd-file

The path to the package descriptor schema used for validation.