+

Search Tips   |   Advanced Search

Packaging Liberty resources

Liberty resources can be packaged into one or more compressed (.zip) files for deployment by the WebSphere Application Server, Network Deployment v9.0 job manager. The grouping of the resources within the compressed files affects the scope and sharing of the resources. For resources in the compressed files to deploy correctly, the path names of the resources must satisfy job manager rules.

"Packaging a Liberty server from the command prompt" describes how to run the package command to create a compressed file containing a Liberty runtime, files in the shared resources directory, one embedded server, and any applications embedded in the server. To deploy a Liberty installation of this type and we do not need to place the installation in a project directory, consider using the package command to create the compressed file. For other types of Liberty installations, we must manually create one or more compressed files.

Supported Liberty resource types include project, runtime, Liberty server, application binary, and SDK. For more information, read "Liberty resources."

The job manager distinguishes between the different types of Liberty resources in a compressed file using the following rules:

The job manager uses the directory name of a resource in the compressed file as its resource name. For example, if the directory name for the Liberty runtime is 08.05.00.00, then its resource name is 08.05.00.00, and its resource ID is runtime/08.05.00.00. When naming resources, consider the following guidelines:


Tasks

Determine the type of Liberty installation that we need, and then create one or more compressed (.zip) files that contain Liberty resources.


Example

The following examples illustrate the structure of Liberty resources for different deployment scenarios:

Example 1: Self-contained Liberty installation

This example first illustrates how to package a self-contained Liberty installation for deployment to one or more server hosts. It then illustrates how to package a new version of a server and the application that it supports.

The basic structure of the Liberty resources follows:

The following assumptions apply for this example installation:

  • The installation includes two servers.
  • Each server includes a bootstrap.properties file, a server.xml file, and one application.
  • Each server uses a previously installed SDK (JRE) that meets the minimum requirements for the Liberty. If we plan to use the job manager to install an SDK, see Example 2 for relevant packaging and server configuration information.

  • The Liberty installation is deployed to project directory samples in working directory /liberty/working, such as /liberty/working/samples.

Structure when deployed

This example Liberty installation has the following directory structure on the server hosts:
[-] liberty
    [-] working
        [-] samples
            [-] wlp-08.05.00.00
                [+] bin
                [ ] clients
                [+] dev
                [ ] lafiles
                [+] lib
                [+] templates
                [-] usr
                    [-] servers
                        [-] SecuritySample-01.00-01
                                o bootstrap.properties
                                o server.env
                                o server.xml
                            [ ] apps
                                    o SecuritySample-01.00.war
                        [-] ServletSample-01.00-01
                                o bootstrap.properties
                                o server.env
                                o server.xml
                            [ ] apps
                                    o ServletSample-01.00.war

Structure of package for initial deployment

The following directories and files are included in the compressed (.zip) file for initial deployment of the Liberty installation. The project directory, samples, is located at the root of the compressed file.
[-] samples
    [-] wlp-08.05.00.00
        [+] bin
        [ ] clients
        [+] dev
        [ ] lafiles
        [+] lib
        [+] templates
        [-] usr
            [-] servers
                [-] SecuritySample-01.00-01
                        o bootstrap.properties
                        o server.env
                        o server.xml
                    [ ] apps
                            o SecuritySample-01.00.war
                [-] ServletSample-01.00-01
                        o bootstrap.properties
                        o server.env
                        o server.xml
                    [ ] apps
                            o ServletSample-01.00.war

If a server must use an SDK (JRE) that is not the default, operating system-level JRE, specify the location of the appropriate JRE in a server.env file at the runtime or server level; for example:

JAVA_HOME=/opt/jre-06.00.31

Structure of package containing new version of server and application

The following directories and files are included in a compressed (.zip) file for a new version of a server and the application that it supports. The project directory, samples, is located at the root of the compressed file.
[-] samples
    [-] wlp-08.05.00.00
        [-] usr
            [-] servers
                [-] SecuritySample-01.01-01
                        o bootstrap.properties
                        o server.env
                        o server.xml
                    [ ] apps
                            o SecuritySample-01.01.war

Example 2: Host-level sharing of SDK and Liberty runtime

This example first illustrates how to package the Liberty resources for an environment where each server host includes a single shared instance of an SDK (JRE), a single shared instance of the Liberty runtime, and two isolated working servers that rely on the shared SDK and the shared Liberty runtime. It then illustrates how to package a new version of a server and the application that it supports. Use of the job manager is mandatory for environments that include isolated Liberty servers; we cannot use the Liberty server script to manage the servers.

For information about sharing server configuration settings at the host and network levels, see Liberty documentation about using includes in the configuration.

The basic structure of the Liberty resources follows. Using this approach helps to simplify maintenance and to conserve disk space as additional servers are deployed in the future.

The following assumptions apply for this example installation:

  • The SDK (JRE) and the Liberty runtime are deployed to shared directory /liberty/shared.

  • The two isolated working servers are deployed to project directory samples in working directory /liberty/working, such as /liberty/working/samples. Including a project directory is optional.
  • Each server includes a bootstrap.properties file, a server.env file, a server.xml file, and one application.

Structure when deployed

This example Liberty environment has the following directory structure on each server host:
[-] liberty
    [-] shared
        [-] jre-06.00.31
            [+] bin
            [+] lib
        [-] wlp-08.05.00.00
            [+] bin
            [ ] clients
            [+] dev
            [ ] lafiles
            [+] lib
            [+] templates
    [-] working
        [-] samples
            [-] servers
                [-] SecuritySample-01.00-01
                        o bootstrap.properties
                        o server.env
                        o server.xml
                    [ ] apps
                            o SecuritySample-01.00.war
                [-] ServletSample-01.00-01
                         o bootstrap.properties
                         o server.env
                         o server.xml
                    [ ] apps
                            o ServletSample-01.00.war

Each isolated server is configured to use the shared SDK (JRE) and the shared Liberty runtime. The locations of the shared resources are stored in each server.env file; for example:

JAVA_HOME=${WLP_SHARED_DIR}/jre-06.00.31
WLP_RUNTIME_DIR=${WLP_SHARED_DIR}/wlp-08.05.00.00
The paths include the WLP_SHARED_DIR WebSphere variable instead of a hardcoded path. When the isolated servers are deployed to the server hosts, the job manager replaces ${WLP_SHARED_DIR} with the actual shared directory path, in this case /liberty/shared.

Structure of packages for initial deployment

The following directories and files are included in the compressed (.zip) file for initial deployment of the SDK (JRE) and the Liberty runtime to the shared resources directory that is defined by the WLP_SHARED_DIR WebSphere variable. Because it is likely that the SDK and the Liberty runtime will be used across projects, these resources are not included in a project directory. In this example, the SDK and the Liberty runtime are packaged into a single compressed file. However, we might package them into two separate compressed files, and submit two separate installation jobs.
[-] jre-06.00.31
    [+] bin
    [+] lib
[-] wlp-08.05.00.00
    [+] bin
    [ ] clients
    [+] dev
    [ ] lafiles
    [+] lib
    [+] templates

The following directories and files are included in the compressed (.zip) file for initial deployment of the Liberty servers and their applications to the working resources directory that is defined by the WLP_WORKING_DIR WebSphere variable. The project directory, samples, is located at the root of the compressed file.

[-] samples
    [-] servers
        [-] SecuritySample-01.00-01
                o bootstrap.properties
                o server.env
                o server.xml
            [ ] apps
                    o SecuritySample-01.00.war
        [-] ServletSample-01.00-01
                o bootstrap.properties
                o server.env
                o server.xml
            [ ] apps
                    o ServletSample-01.00.war

Structure of package to update server and application

The following directories and files are included in a compressed (.zip) file for later deployment of a new version of a server and its application to the working resources directory that is defined by the WLP_WORKING_DIR WebSphere variable. The project directory, samples, is located at the root of the compressed file.
[-] samples
    [-] servers
        [-] SecuritySample-01.01-01
                o bootstrap.properties
                o server.env
                o server.xml
            [ ] apps
                    o SecuritySample-01.01.war

Example 3: Network-level sharing of SDK, runtime, and applications

Restriction: Example 3 does not work on the Windows operating system.

This example first illustrates how to package the Liberty resources for an environment where the SDK (JRE), the Liberty runtime, and several applications are stored on shared disk, and two isolated (working) servers are stored on each server host. It then illustrates how to package a new version of a server and the application that it supports. Use of the job manager is mandatory for environments that include isolated Liberty servers. We cannot use the Liberty server script to manage the servers. For information about sharing server configuration settings at the host and network levels, see Liberty documentation about using includes in the configuration.

The basic structure of the Liberty resources follows. Using this approach helps to simplify maintenance and to conserve disk space when additional servers are deployed in the future.

The following assumptions apply for this example installation:

  • The SDK (JRE), Liberty runtime, and applications are installed to shared disk at path /liberty/shared.

  • On each server host, the shared resources directory (on shared disk) is mounted at the same path, /liberty/shared.

  • On each server host, the two isolated (working) servers are deployed to project directory samples in working directory /liberty/working, such as /liberty/working/samples. Including a project directory is optional.
  • Each server includes a bootstrap.properties file, a server.env file, and a server.xml file.

Structure when deployed

This example Liberty environment has the following directory structures on shared disk and on the server hosts:
Shared disk

[-] liberty
    [-] shared
        [-] jre-06.00.31
            [+] bin
            [+] lib
        [-] wlp-08.05.00.00
            [+] bin
            [ ] clients
            [+] dev
            [ ] lafiles
            [+] lib
            [+] templates
        [-] samples
            [ ] apps
                    o SecuritySample-01.00.war
                    o ServletSample-01.00-01.war
Server hosts

[-] liberty
    [-] working
        [-] samples
            [-] servers
                [-] SecuritySample-01.00-01
                        o bootstrap.properties
                        o server.env
                        o server.xml
                [-] ServletSample-01.00-01
                         o bootstrap.properties
                         o server.env
                         o server.xml

Each isolated server is configured to use the shared SDK (JRE) and the shared Liberty runtime. The locations of the shared resources are stored in each server.env file; for example:

JAVA_HOME=${WLP_SHARED_DIR}/jre-06.00.31
WLP_RUNTIME_DIR=${WLP_SHARED_DIR}/wlp-08.05.00.00
The paths include the WLP_SHARED_DIR WebSphere variable instead of a hardcoded path. When the isolated servers are deployed to the server hosts, the job manager replaces ${WLP_SHARED_DIR} with the actual shared directory path, in this case /liberty/shared. On each server host, the remote shared resources directory is mounted at /liberty/shared.

Because the applications are in shared storage that is apart from the servers, the application element in each server.xml file must include the full path to the corresponding WAR file; for example:

<application id="SecuritySample"
             location="/liberty/shared/apps/SecuritySample-01.00.war"
             name="SecuritySample" type="war"/>

To minimize changes to the server.xml file, the application directory and version information can be stored in two properties in each server bootstrap.properties file; for example:

apps.dir=${WLP_SHARED_DIR}/${CURRENT_PROJECT}/apps 
security.sample.version=1.00

We then can include both the WLP_SHARED_DIR WebSphere variable and the CURRENT_PROJECT built-in job manager variable in the application element in each server.xml file; for example:

<application id="SecuritySample" 
             location="${apps.dir}/SecuritySample-${security.sample.version}.war"
             name="SecuritySample" type="war"/>

Structure of packages for initial deployment

The following directories and files are included in the compressed (.zip) file for initial deployment of the SDK (JRE), Liberty runtime, and applications to the shared disk location that is defined by the WLP_SHARED_DIR WebSphere variable. Because it is likely that the SDK and the Liberty runtime will be shared across projects, these resources are not included in a project directory. The applications are included in project directory samples. In this example, you package all the shared resources into a single compressed file. However, we might package them into three separate compressed files, and submit three separate installation jobs.
[-] jre-06.00.31
    [+] bin
    [+] lib
[-] wlp-08.05.00.00
    [+] bin
    [ ] clients
    [+] dev
    [ ] lafiles
    [+] lib
    [+] templates
[-] samples
    [ ] apps
            o SecuritySample-01.00.war
            o ServletSample-01.00.war

The following directories and files are included in a compressed (.zip) file for initial deployment of the Liberty servers to the working resources directory that is defined by the WLP_WORKING_DIR WebSphere variable:

[-] samples
    [-] servers
        [-] SecuritySample-01.01-01
                o bootstrap.properties
                o server.env
                o server.xml
        [ ] ServletSample-01.00-01
                o bootstrap.properties
                o server.env
                o server.xml

Structure of packages for update to application and server

The following directories and files are included in a compressed (.zip) file for later deployment of a new version of an application to the shared disk location that is defined by the WLP_SHARED_DIR WebSphere variable. The project directory, samples, is located at the root of the file:
[-] samples
    [ ] apps
            o SecuritySample-01.01.war

The following directories and files are included in a compressed (.zip) file for later deployment of a new version of a server to the working resources directory that is defined by the WLP_WORKING_DIR WebSphere variable. The project directory, samples, is located at the root of the compressed file.

[-] samples
    [-] servers
        [-] SecuritySample-01.01-01
                o bootstrap.properties
                o server.env
                o server.xml

We must change the application element in the server.xml file to include Version 1.01 of the WAR file; for example:

<application id="SecuritySample"
             location="/liberty/shared/apps/SecuritySample-01.01.war"
             name="SecuritySample" type="war"/>

Alternatively, if the bootstrap.properties file contains the application version information, change the file accordingly; for example:

security.sample.version=1.01

We then use the updated version information in the application element in the server.xml file; for example:

<application id="SecuritySample" 
             location="${apps.dir}/SecuritySample-${security.sample.version}.war"
             name="SecuritySample" type="war"/>


What to do next

Set variables that enable the job manager to install and search for Liberty resources.


Related:

  • Liberty resources
  • Set variables for Liberty servers
  • Install Liberty resources using the job manager
  • Administrative job types