Search code examples
dockercloud-foundrywarden

Changing content of application in warden container


I've cf application which I pushed and working as expected,now I want to change some file content in RT to avoid re-push.the application in deployed to warden container so it "persist" (for this instance ) in the filesystem of the container,How can I access to this file (i've node application so I guess with the FS module) location. i.e. if I've paused app with the following structure

myApp
   folder1
      index.html

1.if I want to change index html content by override how should I do that?I know the path of myApp/folder1/index.html but how I know where my app is located in the container file system? 2. There is a way when I push application to say where to put the application? I mean in the container filesystem in specific path e.g. when you create application in windows you decide where to put it...

C:\\myApp\folder1\index.html
or 
D:\\myApp\folder1\index.html

I know that maybe this is advanced question but your help is appreciated! p.s. lets say that I've some proxy for the application in the app container which listen to the app port and this can do some changes on the files of the applications


Solution

  • Writing directly to the container file system is not the right approach, because Cloud Foundry containers are intended to be ephemeral and transient.

    Let's say that I have one instance of an application running, in Container A, and I change the contents of folder1/index.html. If that instance fails, and is automatically restarted by Cloud Foundry, the new instance won't have the persisted changes. If I need to scale up to 3 instances of my application, then Containers B and C won't have the changed files.

    Allowing Cloud Foundry to manage the container file system will assure that you have consistent, repeatable behavior in your application.

    If you need to make file changes in your Cloud Foundry application instance, the two recommended approaches are:

    • Read and write your file from a file service that is managed by Cloud Foundry. This will ensure that all application instances are accessing the same file system, and that your changes will survive beyond the container lifecycle.
    • Make the changes in your application artifact, and re-push the application.