About Me
Facebook
Facebook
Linked In
Linked In
Twitter
Twitter
YouTube
YouTube
Google +
Google +

September 14, 2015

Develop & Deploy Hello World webpage to Bluemix


Introduction

I have created some really amazing sample applications and starter boilerplates on Bluemix, but sometimes all you want is a basic "Hello World" app. I’ve got you covered.
In this tutorial, I'll show you how to create a simple "Hello World" app to deploy a webpage to the IBM Bluemix cloud platform, using nothing but HTML and a static file buildpack that is hosted on GitHub. Here's the running app we're going to create and the code to create.

Prerequisite

ü  A Bluemix account. Log in to your account, or sign up to activate your free Bluemix trial.
Your Bluemix account includes access to
 IBM Bluemix DevOps Services. (The same IBM ID works for both.)
ü  The latest version of Chrome, Firefox, Internet Explorer, or Safari.

implementation


Step 1. Create a project for your app
Our project will reside on IBM Bluemix DevOps Services.
1.                              Log in to IBM Bluemix DevOps Services.
2.                              In the top navigation, click My Projects. Click CREATE PROJECT.


3.                              On the "Create a project" page:
a.       Type a name of the project. I have entered HelloWorldWeb.
b.      Choose a source control option. I create new repository and selected Github. It will go to Github page and login and create repository.

c.       Check the Make this a Bluemix Project box.
d.      Click CREATE.

Step 2. Create a simple webpage
After our  project is created, it's time to code! In this example, we will say "Hello" to the world in a simple webpage. You can do the coding in the Web IDE, completely in your browser.
1.                  On your project’s overview page, click the EDIT CODE button.
The Web IDE will open. A few files like the License.txt, project.json, and README.md will be created for you automatically.

2.                  In the Web IDE, select File > New > File.
3.                  The file is highlighted so that you can name it. Enter index.html.
4.                  In the editor area on the right, paste the following:
<html>
     <body>
          Hello, Bluemix World!
     </body>
</html>


Step 3. Create a manifest 
A manifest is a file that tells Bluemix how to deploy the application. It’s possible to deploy using the launch configuration wizard in the Web IDE without creating a manifest, but we’ll create a very simple manifest so that your app can be easily deployed using either the Web IDE or the CF Command Line tool.
1.                  In the Web IDE, select File > New > File.
2.                  The file is highlighted so that you can name it. Enter manifest.yml.
3.                  In the editor area on the right, paste the following:
---​
applications:​
- buildpack: https://github.com/cloudfoundry/staticfile-buildpack.git
  host: <host name>
  name: HelloWorldWeb-html
  memory: 64M​
  stack: cflinuxfs2​
·         The buildpack contains the necessary framework and/or runtime support for Bluemix to run your application. For this application, we're using a static file buildpack that is hosted on GitHub.
·         The host is essentially the URL of your application. The host you choose must be unique across all of Bluemix. We added the <host name> keyword so that your deployment will not collide with the deployments of others who follow this tutorial. You can customize the host to be whatever you like.
·         The memory refers to how much memory you are allocating to your app in your Bluemix space. Memory is not a required part of a manifest, but it is included in this example so that the app does not consume a large portion of the memory allocated to your Bluemix space.
·         The stack is defined by Cloud Foundry as "a prebuilt root filesystem (rootfs) which works in tandem with a buildpack and is used to support running applications." The static file buildpack we're using requires the cflinuxfs2 stack. Bluemix currently defaults to an older stack, so we need to specify the stack as cflinuxfs2. Most buildpacks will not require you to specify a stack.

Step 4. Deploy and open the app 
Now that you have a webpage and a manifest created, you’re ready to deploy!
1.                  In the Web IDE, click the Deploy button:

Our application is now deployed to Bluemix. The process takes about a minute to complete. You’ll know it’s finished deploying when you see a green dot in the run bar:
When our app is deployed, open it in the Web IDE by clicking the Open the application URL button:

Congratulations! Our application is now sending cheerful greetings to the Bluemix world.

Conclution

In this tutorial, we created a simple "Hello World" webpage by creating a project in DevOps Services, creating index.html and manifest.yml files, and deploying the app to Bluemix. To continue working on this app, you can make changes to index.html or create new webpages and then deploy to Bluemix.

0 comments :

Post a Comment

Designed By AMEER BASHA G