Showing posts with label Jazz Hub. Show all posts
Showing posts with label Jazz Hub. Show all posts

Monday, May 26, 2014

Cloudnant demo work on BlueMix

Last blog I discussed with Cloudant,but how do we use BlueMix application to visit Cloudant ? On the official site,it doesn't provide tutorial for that.Today I will show a node.js demo for Cloudant on BlueMix.Since node.js is one of my favorite language,also it provide  a ton of tools that make developing on CouchDB / Cloudant with Node.js effortless.You can read this blog to learn more about it.Finally I decide to choose express,Nano as my application library.I have put my code(you can use git to check out this url) at the jazz hub if you want to try it.

Installing the Required Modules

Express framework is required to run this app, to install the express framework, open the command prompt/shell and type the below command. The “–g” option simply means the module will be installed globally so that for each project we don’t need to install express separately.

    npm install –g express
    npm install nano (To install nano module)

Follow the Below Steps to Setup Our Project

After installing nodejs, execute the following commands in order-

    npm install express –g
    npm install jade –g
    express couchNano
    cd couchNano
    npm install nano
    npm link express
    npm link jade
    node app.js //to run the app

And go to browser (any browser) and type below in address bar http://localhost:3000. And press enter if you get the “welcome to express” page you have success created the basic structure required for this app.

Change or create  the createdb.js,index.jade,layout.jade,app.js.You can see the detail code at
https://hub.jazz.net/project/blackwhites/cloudant/overview.

In the app.js there is a piece of code you might need to config on your side .

var nano = require('nano')('https://username:password@yourdomain.cloudant.com:443');
/*Specify the database to use, so that we don't have to specify everytime*/
var db     = nano.use('yourdb')


You need to enter the correct username,password and your cloudant host address.Also you need to make sure you have create your db before in your hosted cloudant doamin.

After finish your code,you need to create a package.json file to add your node.js  dependency.

{
  "name": "application-name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "express": "3.4.4",
    "jade": "*",
"nano": "*.*"
  }
}

Finish all the setting,you can open node.js command in your project folder  to use npm install command to install node.js module.After that use node app.js to run your sample.

Open the browser and use localhost:3000 to visit,Here I add Contacts as the sample


You can see the successful info after you submit the contacts info.

You can check the data in the your online Cloudant db.

After pass the local testing,you need to write manifest.yml to deploy on the BlueMix.You can see my sample file.
---
applications:
- name: cludanttest
  memory: 256M
  instances: 1
  host: cludanttest
  domain:ng.bluemix.net
  path: .
  command: node app.js

You can use cf push command to push your application to the BlueMix.

Wednesday, May 21, 2014

Cloud IDE IBM DevOps Services

IBM DevOps Services(IDS) is a place where you can collaborate with others to develop, track, plan and deploy software.

The below are some featues about  IDS.See below screenshot.

  • DevOps Solution in the cloud for building mobile and cloud applications 
  • Integrated task tracking, agile planning, source control with auto deploy
  • Use your favorite tools or work from the Web IDE
  • Hosted Jazz SCM or Git or link to GitHub
  • Support Public and private projects
  • Built on SoftLayer
  • Mobile quality and application performance monitoring
  • Continuous Integration and Deployment with Jenkins and UrbanCode
  • Push your applications to BlueMix
By now it is totally free and asl you need just to register an IBM id to use it.

I will show somescreenshot to demostrate its feature.

a)Create Project

 You can choose different options to create your project. Private,Public,use java scm or git etc.
 b) Online code edit

c)Trace your work
d)Build and Deploy
e)Invite others to join your project
if you have any  questions you can go to this fourm to ask your problem.Also the offical site has lots of  tourial ,you can follow it and learn it.