As part of the partnership between Pivotal and IBM we have created the WebSphere Application Server Liberty Buildpack, which enables Cloud Foundry users to easily deploy apps on Liberty profile.

The Liberty buildpack supports deploying (or pushing) the following types of resources to Liberty profile on Cloud Foundry:

  • Web applications packaged as WAR files.
  • Liberty server directories, e.g. usr/server/defaultServer.
  • Packaged servers, containing shared directories and additional resources.

Before you start

  1. Download ServletSample.jar, which is a sample application containing a servlet that displays a message when called. Follow the instructions on its download page.
  2. Set up a working Cloud Foundry environment on your local machine or on virtual machine.


  1. Run the following commands in your favorite command line tool:
    1. cf target api.<Cloud Controller HostName>
      This connects you to the Cloud Foundry instance installed on your machine.
    2. cf login
      This logs you into the target. You will be prompted to enter the e-mail address and password that you specified for your Cloud Foundry environment.
    3. cf create-org <organization name>
      It is necessary to create an organization, the topmost meta object level in the Cloud Foundry infrastructure, in order to create a structured environment. The structure is similar to a database; both the organization and the space represent tables. The organization contains references to each of the spaces and the applications are the entities in the spaces table.
    4. cf create-space <Space name>
      This command will create a space to which your applications will be deployed, this is the meta object the domain associates with.
    5. cf switch-space <space name>
      After creating a space, the Cloud Foundry command line interface doesn’t automatically switch into it, you have to manually switch into the space you want to deploy to.
  2. Change to your server directory, if you aren’t there already; e.g. wlp/usr/servers/ServletSample
  3. Create a file called manifest.yml and paste the following snippet into it.
    - name: test
      IBM_JVM_LICENSE: <jvm license code>
      IBM_LIBERTY_LICENSE: <liberty license code>

    Please read the licenses (Liberty, JVM). You can find the required “D/N: <license code>” in them.

  4. cf push --buildpack
    Here you will be prompted to set multiple properties but, for simple applications like the ServletApp.war, the default settings are fine.These are the properties you can set:

    • Name – The name you want to give the application e.g.: ServletApp
    • Instance – The number of instances you would like to create.
    • Memory Limit – The memory limit you want to set. Since this is a very simple application the default 256MB is more than enough.
    • Subdomain and Domain – Together they build the URL (<subdomain>.<domain>) with which the application can be accessed.
    • Services – If you want to create and bind any services.
    • Configuration file – This will create a file called manifest.yml containing all of the configuration choices you made.

That’s it! Once your configuration has been processed, you can instantly access the URL (from Step 4, above) and interact with your application. If you pushed the ServletApp.war, append /ServletApp to the URL to access the application.

2 comments on"Deploying an application to Liberty profile on Cloud Foundry"

  1. I don’t think the buildpack works unless you also copy the IBM JRE and Liberty to your own server, and modify the buildpack to point at your copies?

    • Samirah Amadu November 20, 2013

      well, this was indeed the case in the past but both Liberty and JRE are now hosted on a publicly available server, there is no need to modify the buildpack or host them yourself anymore. Although there is always the option to do so if you want.

Join The Discussion

Your email address will not be published. Required fields are marked *