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. 🙂