Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to download all files of an application in Cloud Foundry?

Is it possible to download files of application to my local PC, i.e. perform operation opposite to "push"?

like image 274
user626528 Avatar asked Jan 29 '14 03:01

user626528


People also ask

How do I download a jar from Cloud Foundry?

There is no direct way to download your application from a running cloud foundry container. However, you can use the cf files <appname> [path] command to explore and even download one file at a time. To expand on Ram's answer, apps are not uploaded to CF in war/jar form.

Is Cloud Foundry a private cloud?

Cloud Foundry makes it faster and easier to build, test, deploy, and scale apps. It is an open-source project and is available through a variety of private cloud distributions and public cloud instances.

What is Cloud Foundry used for?

Cloud Foundry is an open source cloud Platform-as-a-Service (PaaS) on which developers can build, deploy, run and scale applications. While other cloud platform services are tied to particular cloud providers (such as Amazon, Google or Microsoft), Cloud Foundry is available as a stand-alone software package.


2 Answers

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

like image 195
Daniel Mikusa Avatar answered Oct 24 '22 10:10

Daniel Mikusa


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

like image 44
xverges Avatar answered Oct 24 '22 10:10

xverges