Develop and deploy a Node.js app
Last updated: 9 September 2015
Time: 15 minutes
IBM® Bluemix™ is an open-standards, cloud-based platform where you can build, manage, and run all types of apps: mobile, smart devices, web, and big data. The Bluemix capabilities include Java™, mobile back-end development, app monitoring, and features from ecosystem partners and open source, all through an as-a-service model in the cloud.
In this tutorial, you create an app in Bluemix by using the SDK for Node.js starter pack. You then create a Git repository for the app and push changes to that repo from the IBM® Bluemix™ DevOps Services Web IDE.
If you're ready to try Bluemix, start this tutorial!
Summary of steps
|Before you begin||Create an app with Bluemix||Set up Git integration and auto-deploy||Push changes to the Git repository by using the Web IDE||Summary||Next steps|
Before you begin
To do this tutorial, you need a DevOps Services account and a Bluemix account. The accounts are free and provide access to everything you need to develop, track, plan, and deploy apps. Signing up is simple: when you sign up for DevOps Services, you can also sign up for a trial of Bluemix.
Create an app in Bluemix
Sign in to Bluemix. The Dashboard opens: The Dashboard shows an overview of the active Bluemix space for your organization. By default, the space is
devand the organization is the user name of the person who created the project. For example, if
firstname.lastname@example.org in to Bluemix for the first time, the active space is
devand the organization is
email@example.com. If you create more organizations or spaces in Bluemix, use the same ones as you follow the tutorials. Use the default selections.
Click CREATE AN APP. For the kind of app that you are creating, click WEB.
For your starter, click SDK for Node.js. Review the docs and details, and then click CONTINUE.
Name your app and then click FINISH. The name is a unique URL where you access your app. After a moment, the app starts. The app's Overview page opens and shows that the app is running.
Now that your app is running, you can see and modify its code by using DevOps Services.
Set up Git integration and auto-deploy in DevOps Services
You can work with your app's code in many ways. For example, with auto-deploy, you can modify the code that runs in your app by pushing your changes to a Git repository. You can auto-deploy your code if you use the Build & Deploy capabilities of DevOps Services.
To enable auto-deploy, go to your app's Overview page on the Bluemix Dashboard and click ADD GIT. A Git repository is created and is populated with example code and a deployed app. You might be prompted to enter your password to verify that DevOps Services can act on your behalf.
Make sure that the Populate the repository with the starter application package and enable build and deploy check box is selected. You created a Git repository, populated it with the example code, and deployed the app.
Go to the app's Overview page and click EDIT CODE. Your new project opens in the web integrated development environment (Web IDE).
Push changes to the Git repository by using the Web IDE
The integrated Web IDE is based on the Eclipse Orion open-source project.
To make a change to a file and then push the change, follow these steps:
In the directory, find a file to modify; for example,
Edit the file in the editor.
Push the change by using the integrated Git support.
a. From the leftmost menu, click the Git Repository icon .
b. Select check box for the changed file. c. Type a commit message, and then click Commit. d. In the Outgoing section on the left, click Push.
To verify that your code was deployed, click BUILD & DEPLOY and wait until you see an indication that the app was deployed again. On the Deploy stage, in the LAST EXECUTION RESULT section, click the URL link under the app's name.
Your update is shown.
You have a good overview of how to get started with Node.js in Bluemix and DevOps Services.
You saw how to create and run a Node.js web app by using Bluemix. With one click, you created a Git repository, populated it with example code, and automatically deployed the app. You changed the code and pushed the changes to the Git repository by using the Web IDE. Then, you automatically built and deployed your changes, checked the deployment status, and verified your changes.