Search code examples
ibm-cloudwebsphere-libertydevops

How can I deploy a Liberty application with server.xml using Bluemix devOps service


I have a Java Web application that I want to deploy to Bluemix's Cloud Foundry runtime. I'd like to run it on the Liberty application server and customize the server configuration with the server.xml file. I know how to do this in the CLI with a server package or server directory, but how do I complete this task using the Bluemix DevOps service? By default, it only pushes the WAR package.


Solution

  • It can be done in this way:

    1. Put the customized server.xml and jvm.options files in a sub-folder like "defaultServer";

    2. Modify your build script to create a zip file with below structure:

       |- server.xml
       |- jvm.options
       |- apps
          |- myapp.war 
      
    3. Modify the manifest.yml file of the project to specify the path to be the zip file created in Step 2.

    Note the server.xml need to define a web app that points to the WAR, for example:

      <webApplication id="myapp" location="myapp.war" name="myapp" context-root="/" />