0

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.

Mike Storey
  • 1,029
  • 3
  • 11
  • 21
  • Where are you trying to copy those files? 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 – Jose Miguel Ordax Oct 22 '15 at 20:47
  • Thank you very much. With that change I am now able to copy the files, but I need to edit the content to describe the environment. Also, it appears that this directory is transient (i.e. it goes away when the application is restarted) - Where is the proper location to store file-based persistent data and how do I edit or upload those files during deployment? – Mike Storey Oct 22 '15 at 21:26
  • Comment moved to Answer as it seems it helped you. – Jose Miguel Ordax Oct 22 '15 at 23:57

1 Answers1

1

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.

Jose Miguel Ordax
  • 1,151
  • 1
  • 9
  • 20
  • I think the best answer is to do the pre configuration so it is in the app at push time. Anything else will be unreliable. The PaaS can move things around at any time so even if you do the first but it could be wiped for other reasons than the a restart or new app deploy. – Alasdair Oct 23 '15 at 10:02
  • So can anyone recommend a file-system based persistence service, the application has a small amount of state information that is stored in a collection of text files which need to persist between run's of the application. I really don't want to re-write any code to change this to a database or other structured data store. – Mike Storey Oct 23 '15 at 13:45
  • I setup something like that some time ago using VMs support in Bluemix (notice currently is on Beta) but it was too tricky from my point of view: http://stackoverflow.com/questions/30470112/issues-trying-to-use-fuse-on-bluemix I would use something like Object Store although agree, that requires change code. – Jose Miguel Ordax Oct 23 '15 at 15:05
  • Environment variables are also a good place to store configuration. – opiethehokie Oct 23 '15 at 15:21