Is it possible to download all files of an application in Cloud Foundry?
Recent versions of cf
(Cloud Foundry's command line interface) makes this simpler by using the download plugin: https://github.com/ibmjstart/cf-download
More details from one of the authors at http://blog.ibmjstart.net/2015/05/22/cf-download/
Edit As pointed out by Dharmi, this does not work with the Diego backend https://github.com/ibmjstart/cf-download/issues/12
As long as your application finished staging successfully (i.e. the build pack ran and finished), you should be able to download the droplet that was built by CF. That will contain amongst other things your application code.
Ex:
$ cf app <app-name> --guid
2836d5fe-35f7-4409-b27b-4ed308152bb4
$ cf curl /v2/apps/2836d5fe-35f7-4409-b27b-4ed308152bb4/droplet/download --output my-droplet
See also https://apidocs.cloudfoundry.org/2.6.0/apps/downloads_the_bits_for_an_app.html & http://v3-apidocs.cloudfoundry.org/version/3.50.0/#download-package-bits
UPDATE (10/2/2019)
Make sure you use the --output
flag of cf curl
. If you simply redirect the output of cf curl
to a file, you will end up with an extra end of line character on the end of your droplet (or other download). For binary downloads this can cause problems. Some tools simply ignore the extra character like tar
, but it will cause your app to fail if you upload a droplet using cf push --droplet
.
UPDATE (7/13/2018)
There is also now cf local
, which is a cf cli plugin that does several things. One of the things it allows you to do is easily export and import droplets. It's probably the easiest way to do this going forward.
https://github.com/cloudfoundry-incubator/cflocal