Thursday, November 20, 2014

Uploading an application to Bluemix

After you are logged in to Bluemix, you can upload an application.
You can use a sample Java™ web application to get started. This sample application displays the list of environment variables that are available. You can download the sample Java web application from the community sample site. The sample application contains a single JSP and the WEB-INF/web.xml file.
Extract the downloaded file, and a new directory that contains the application is created. From the newly created application directory, issue the cf push command. In the following example, you can use a unique name testEnv for the application and 512M for memory allocation. The name must be unique in the whole Bluemix environment.
$ cf push testEnv -m 512m

The cf push command uploads and deploys your application to Bluemix.
Note: When you use the cf push command, the cf command line interface copies all of the files and directories from your current directory to Bluemix. Ensure that you have only the required files in your application directory.
If you change your application, you can upload those changes by issuing the cf push command again. The cf command line interface uses your previous options and your responses to the prompts to update any running instances of your application with the new bits of code.
When a cf push command is issued, the cf command line interface provides the working directory to the Bluemix environment that uses a buildpack to build and run the application. Bluemix includes built-in buildpacks for WAR, EAR, and Node.js. All other languages or frameworks must be pushed by using the -b option. In many cases, even for the built-in buildpacks, you must also supply a -c option to specify the command that is used to start your application. For example, you need to use the -c option to push your Node.js application, and the Node.js application must contain a valid package.json file.

$ cf push testnode001 -c 'node app.js'

No comments:

Post a Comment