Reputation: 442
I was working on a spring based app and i fried my system , and hence lost the app source code. Is there anyway to download the application folder (WAR) in v2 of cloudfoundry?
I know there is a way to download the WAR folder in v1 - https://gist.github.com/danhigham/4705713 but i cant figure out a way in v2.
I can view a file contents by using (cant download it)-
cf file app-name path
Upvotes: 2
Views: 111
Reputation: 3618
Yes, you can download your application code in v2 of Cloud Foundry (CF). It is allowed via REST API to CF (see this line in cloud controller). Good explanation how to use it (may be outdated) is here. This are good news.
Bad news are that currently cf tool (ruby client to v2) does not support this operation yet. But you still have a few options:
Use any REST client (e.g. browser's plugin, there are plenty of those) to perform this request manually.
Improve cf client (or any other library, for example .NET client lib to CF v2, it worked for me) to support download operation. This is a harder way, but you could then contribute your work to the community (as an author of an example for v1 that you've provided did).
I've used the first approach:
.cf\tokens.yml
file in my user's directory and copied :token:
corresponding to my target (further I was adding the value of this token as an Authosization
header to every request I've done using REST client). GET
request to a https://api.run.pivotal.io/v2/apps URl. From its response I've discovered the GUID of the app I'm interested in (say, 3F2504E0-4F89-11D3-9A0C-0305E82C3301).GET
request to https://api.run.pivotal.io//v2/apps/3F2504E0-4F89-11D3-9A0C-0305E82C3301/download . It gave me an HTTP/1.1 302 Found redirect and by opening the URL provided in Location
header of the response in browser I've downloaded my app's archive.Upvotes: 3