Download files from Bluemix using Cloud Foundry CLI plugin

I see several questions  in the Bluemix forum about the desire to download files of running applications. Cloud Foundry CLI provides “cf files” command to just to take a look at each file/folder, not entire files. There is easy way to do it. Use Cloud Foundry CLI plugin “cf-download”.

Cloud Foundry CLI v6.7 or higher now provides plugin functionality. See this dev guide . Some of Bluemix users may have already noticed new command “cf install-plugin”. This enables to add features to existing commands.

% cf install-plugin -help
NAME:
install-plugin - Install the plugin defined in command argument

USAGE:
cf install-plugin URL or LOCAL-PATH/TO/PLUGIN [-r REPO_NAME]

The command will download the plugin binary from repository if '-r' is provided

EXAMPLE:
cf install-plugin https://github.com/cf-experimental/plugin-foobar
cf install-plugin ~/Downloads/plugin-foobar
cf install-plugin plugin-echo -r My-Repo


OPTIONS:
-r   repo name where the plugin binary is located

Cloud Foundry Foundation provides community base plugins at http://plugins.cloudfoundry.org. There are plugin such as:

  • autopilot : zero downtime deploy plugin for cf applications. This is useful to switch to new application without worry about stopping and deleting old application.
  • Targets : Can be used to change the target (e.g. to Bluemix US , to Bluemix London, or to the other Cloud Foundry base PaaS provider such as Cloudn PaaS from NTT ).
  • etc, etc.

Most of plugins are quite useful. Anyway, go back to “cf-download”. To add the plugin is very easy. Add plugin repository, and then install the plugins.

% cf add-plugin-repo CF-Community http://plugins.cloudfoundry.org/
OK
http://plugins.cloudfoundry.org/list added as 'CF-Community'

% cf install-plugin cf-download -r CF-Community
Looking up 'cf-download' from repository 'CF-Community'
8637440 bytes downloaded...
Installing plugin <path>...
OK
Plugin cf-download v1.0.0 successfully installed.

% cf plugins
Listing Installed Plugins...
OK
Plugin Name   Version   Command Name   Command Help
cf-download   1.0.0     download       Download contents of a running app's file directory

Now, I login to Bluemix, and then tried to download files (Nodered boilerplate in my case).

% cf download # just to see syntax.

Error: Missing App Name
NAME:
   download - Download contents of a running app's file directory

USAGE:
   cf download APP_NAME [PATH] [--overwrite] [--verbose] [--omit ommited_paths] [-i instance_num]

% cf download mynoderedapp .

It took several minutes to download all files. After the command completes, I can see enter files. To check if the files are identical. I took a look at run.pid file.

$ cat run.pid

31

$ cf files mynoderedapp ./run.pid
Getting files for app ...
OK

31

Looks like they are identical.  It is so easy to download files from Bluemix application now. 🙂

Advertisements
This entry was posted in Bluemix. Bookmark the permalink.

4 Responses to Download files from Bluemix using Cloud Foundry CLI plugin

  1. Miguel C says:

    Thanks for using the cf-download plugin, I wrote a blog article with more information about advanced usage, implementation, and limitations of this plugin. check it out here: http://ibmjstart.com/blog/2015/05/22/cf-download/

  2. Pingback: Bluemix 에 push 했던 파일 다시 다운받기 | Bluemix

  3. Pingback: Bluemix 에 push 했던 파일 다시 다운받기 | IBM Cloud Tech Forum – Korea

  4. Letha Silver says:

    I have to express my gratitude for your generosity in support of people that should have help with this important issue. Your real commitment to getting the message around became rather advantageous and has consistently empowered regular people much like me to achieve their dreams. The informative tutorial means so much a person like me and even more to my office colleagues. Best wishes; from all of us.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s