Mike Storey
Mike Storey

Reputation: 1077

Where to put configuration data for a Bluemix Liberty web application

I have a web application packaged as a war file that is deployed to Bluemix in a Liberty container. The application stores configuration information in a collection of directories outside of the web application folder, and during initial install copies default files to that location. When I deployed this as a simple default war file, there were errors copying the default files to this location. Since Liberty doesn't expand the war file by default, I've exploded the war to a directory (defaultServer/apps/idmu.war) and used the Server Directory deploy as documented here: https://www.ng.bluemix.net/docs/starters/liberty/index.html#optionsforpushinglibertyapplications__ServerDirectory

Using the server.xml of

<server>
    <featureManager>
        <feature>jsp-2.3</feature>
    </featureManager>
    <httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="8080" />
    <application name="idmu" context-root="/" type="war" location="idmu.war"/>
</server>

After republishing the app with the following command

cf push idmu -p defaultServer

the application restarts and I'm still getting the file copy errors, so I suspect it's the target directory and privileges causing the problems. Any help on where to locate this directory, and how to setup the permissions is greatly appreciated.

Upvotes: 0

Views: 342

Answers (1)

Jose Miguel Ordax
Jose Miguel Ordax

Reputation: 1151

You should have write permissions at /home/vcap/ which is your home directory at buildpack container. For example, /wlp is at /home/vcap/app/wlp.

Cloud Foundry (so Bluemix) as a concept, is transient. It is designed for Cloud Native apps, so if you need persistent storage you should need a service like Object Store or other options from the catalog to persist such info. Some ideas: http://12factor.net/config

You could start Liberty Buildpack in Development Mode: https://developer.ibm.com/bluemix/2015/06/16/liberty-buildpack-app-management-support/ so you have access to a shell, but not sure you can edit. And as I commented above, it is not a good idea as the file system is transient.

Another solution is to have those files edited before and deploy them as part of the full app.

Upvotes: 1

Related Questions