Developing IBM Bluemix applications from a local workstation
This unit covers the following topics:
Review: Creating an IBM Bluemix Node.js application from the IBM Bluemix web interface
Build an application with the command-line interface
Build an application with the IBM Eclipse Tools for IBM Bluemix
3.1 What you should be able to do
After completing this unit, you should be able to:
Describe how to create an IBM SDK for Node.js application that runs on IBM Bluemix.
Describe the features in IBM Bluemix that help you to set up a cooperative workstation environment.
Explain how to manage your IBM Bluemix account with the Cloud Foundry CLI.
Describe how to set up and use the IBM Bluemix plug-in for Eclipse.
Describe the role of Node.js for server-side scripting.
3.2 References
The following publications are useful for further research on the topic presented in this unit:
The Eclipse project:
Most recent cf installer from the Git project:
Deploying your app with the command line interface documentation:
Developing with Eclipse tools documentation:
 
3.3 Node.js
Figure 3-1 Node.js
Notes:
Node.js is open-source language that runs on V8. V8 is an open source engine developed by Google for the Google Chrome browser.
Developers use JavaScript for client-side functionality often. Node.js is the server component in the same language.
Although developers can still use JavaScript for browser functionality in frameworks, such as angularJS, dojo, and jQuery, they can now use Node.js in the same components of the architecture where they use Java, Perl, C++, Python, and Ruby.
Node.js is used in production by companies, such as Uber, Yahoo!, LinkedIn, GoDaddy, eBay, and PayPal. It is event-driven and uses asynchronous, non-blocking I/O.
3.4 Options to develop and deploy your IBM Bluemix app
Figure 3-2 Options to develop and deploy your IBM Bluemix app
Notes:
The following options are available to develop and deploy your IBM Bluemix application:
Eclipse
Command-line interface (CLI):
 – Cloud Foundry CLI: The Cloud Foundry command-line interface (cf CLI) provides a set of commands for managing your apps. You can deal with IBM Bluemix or any platform that’s based on Cloud Foundry using the CF CLI.
 – Bluemix CLI: The Bluemix CLI (bx CLI) provides a set of commands for users to interact with IBM Bluemix. Some IBM Bluemix commands are wrappers of existing cf commands, while others provide extended capabilities for IBM Bluemix users.
Continuous Delivery using DevOps Practices
This unit covers developing and deploying Bluemix applications by using bx CLI and Eclipse.
For more information about the use of DevOps services, see Chapter 4, “Using IBM Bluemix DevOps services” on page 85.
3.5 Overview of bx and cf command-line interfaces
Figure 3-3 Overview of bx and cf command-line interfaces
Notes:
Cloud Foundry is an open-source platform as a service (PaaS). Cloud Foundry provides an open-source CLI that is available for multiple platforms.
You can use the CLI through bx CLI or cf CLI to log in to IBM Bluemix and deploy an application to IBM Bluemix, and to manage domains, routes, organizations, and spaces.
 
3.6 Why use command-line tools?
Figure 3-4 Why use command-line tools?
Notes:
IBM Bluemix integrates into the Eclipse IDE. With this available GUI, why would you want to use command-line tools? You might want to use a tool that is quick to install and has a minimal footprint on your development workstation.
Also, you might want to automate the management and deployment process with shell scripts, or you want to use different tools for different projects to provide some project-level separation.
3.7 Reviewing the documentation
Figure 3-5 Reviewing the documentation
Notes:
You can review the documentation for the command-line tool from Getting Started in Application Details. From this page, you can also download the bx CLI by clicking Download Bluemix Command Line Interface. The bx CLI is based on the cf CLI.
To work with IBM Bluemix by using the CLI, you can use bx CLI or cf CLI. The next steps show how to download and use the command-line interface to manage IBM Bluemix applications.
3.8 Using the cf CLI, Step 1: Install the cf CLI
Figure 3-6 Step 1: Install the cf CLI
Notes:
Download the most recent cf installer from the Git project, which includes a list of installers and binaries downloadable for most systems. Generally, download an installer because they are faster and easier to use than the raw binaries.
After you download and run the installer, open a command prompt on your system and run the command line tool by entering cf --version.
More information about this process is included in the exercises that accompany this unit.
3.9 Using the cf CLI, Step 2: Connect to your IBM Bluemix account
Figure 3-7 Step 2: Connect to your IBM Bluemix account
Notes:
Log in to IBM Bluemix by using the CLI. The login command requires the following parameters:
Cloud Foundry API endpoint
Username
Password
Organization name
Space name
The exercises provide instructions for how to log in by using this method. You can use the command-line client with other Cloud Foundry regions by pointing to other API endpoints; for example, api.eu-gb.bluemix.net.
This course uses the US South region. You can use the flags (dash a, dash u, and so on) to specify the parameters at the command line. If you do not specify one of the parameters, the command-line utility prompts you to enter it later. In the example that is shown in Figure 3-7, the password was not entered, so the command-line utility prompts the user to enter the password.
If you are using a federated ID, use cf login –sso. A URL is provided for you. Open this URL in a browser; then, login and copy your one-time passcode and paste it in the CLI to authenticate.
3.10 Using the cf CLI, Step 3: Deploy your application to IBM Bluemix
Figure 3-8 Step 3: Deploy your application to IBM Bluemix
Notes:
The push command uploads, deploys, and starts the application in your IBM Bluemix space.
When you are ready to deploy your application to IBM Bluemix, navigate to your application directory; then, run the cf push command. “Pushing your app” is the terminology that is used to indicate that you are going to deploy the latest changes of your app to IBM Bluemix.
Remember that when you push your application, it overwrites the current contents of your application in your IBM Bluemix account.
Figure 3-8 shows the command-line utility accessing a manifest file. You can control various aspects of the deployment, such as the amount of memory an application receives and the route of the application, by specifying them as flags in the command. However, you can also store these settings in a manifest YML file to make the command you need shorter to enter in later iterations of your application.
3.11 Using the IBM Bluemix CLI, Step 1: Install the IBM Bluemix CLI
Figure 3-9 Step 1: Install the IBM Bluemix CLI
Notes:
Download the most recent IBM Bluemix Command-line Interface installer, which includes a list of downloadable installers for Mac OS X, Linux, and Windows. After you download and run the installer, open a command prompt on your system and run the command line tool by entering bluemix --version.
More information about this process is included in the exercises that accompany this unit.
3.12 Using the IBM Bluemix CLI, Step 2: Connect to your IBM Bluemix account
Figure 3-10 Step 2: Connect to your IBM Bluemix account
Notes:
Log in to IBM Bluemix by using the CLI. The login command requires the same parameters that are used in the cf CLI.
If you are using a federated ID, use bluemix login –sso. A URL is supplied for you. Open this URL in a browser; then, log in and paste your one-time passcode into the CLI to authenticate.
3.13 Using the IBM Bluemix CLI, Step 3: Deploy your application to IBM Bluemix
Figure 3-11 Step 3: Deploy your application to IBM Bluemix
Notes:
The use of the bluemix app push command uploads, deploys, and starts the application in your IBM Bluemix space.
3.14 Test your IBM Bluemix application
Figure 3-12 Test your IBM BLuemix application
Notes:
After the command-line utility finishes pushing your application, browse to the route name you wrote down in the previous step to test whether the application is running.
3.15 IBM Bluemix and Eclipse
Figure 3-13 IBM Bluemix and Eclipse
Notes:
Eclipse is a popular open source integrated development environment (IDE) that provides development tools in a desktop application. For more information about Eclipse, see this website:
IBM Eclipse tools for IBM Bluemix is an open-source plugin for interacting with IBM Bluemix to manage and deploy your applications and services from within the Eclipse interface.
3.16 Step 1: Review the documentation
Figure 3-14 Step 1: Review the documentation
Notes:
To start developing with the IBM Eclipse Tools for IBM Bluemix plugin, Eclipse for Java EE Developers (Neon or any newer versions) must be installed. The Java Development Kit must be installed first.
You can then browse to the URL that is shown in Figure 3-14 to review the documentation for Eclipse tools.
3.17 Step 2: Install the latest version of Eclipse
Figure 3-15 Step 2: Install the latest version of Eclipse
Notes:
Eclipse Tools for IBM Bluemix works with Eclipse Neon or a newer version.
3.18 Step 3: Install Eclipse and Eclipse tools for IBM Bluemix
Figure 3-16 Step 3: Install Eclipse and Eclipse tools for IBM Bluemix
Notes:
The simplest way to install the IBM Eclipse Tools for IBM Bluemix is to drag the Install button from the documentation on top of your Eclipse toolbar, as shown in Figure 3-16.
You can also install IBM Eclipse Tools for IBM Bluemix by completing the following steps:
1. Start Eclipse on your workstation and click Help  Eclipse Marketplace. Then, search for Bluemix.
2. Select IBM Eclipse Tools for Bluemix and then, click Install.
3. Some features are selected for you by default. Click Confirm.
4. Accept the license agreement and click Finish.
3.19 Step 4: Connect to your IBM Bluemix account
Figure 3-17 Step 4: Connect to your IBM Bluemix account
Notes:
After you successfully install the IBM Bluemix tools for Eclipse plugin, you can set up a server object within Eclipse that links to your IBM Bluemix account.
Create a server object; then, enter the IBM ID and password that you use to log in to your IBM Bluemix account.
3.20 Step 5: Create a Node.js application project
Figure 3-18 Step 5: Create a Node.js application project
Notes:
You can add only projects for server runtime environments that IBM Bluemix supports. For example, you must mark your Eclipse project as a Node.js application to deploy it for the IBM SDK for Node.js runtime. You “mark” your project by using Eclipse project facets.
To view or modify the facets for your project, select the Properties for your project and select Project Facets. After you add the Node.js facet to your application, it appears in Eclipse as an item that you can deploy to IBM Bluemix.
To deploy an application to IBM Bluemix, right-click the Bluemix server and click Add and Remove. Then, add the application to the server. Alternatively, you can drop the application to the server.
3.21 Unit summary
Figure 3-19 Unit summary
 
 
 
 
 
 
3.22 Checkpoint questions
Figure 3-20 Checkpoint questions
 
3.23 Checkpoint answers
Figure 3-21 Checkpoint answers
 
 
 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.216.59