Thursday, November 27, 2014

Bluemix troubleshooting -> An application cannot be staged by using a custom buildpack

You might not be able to deploy an application to Bluemix by using a custom buildpack if the scripts within the buildpack are not executable.
When you deploy an application to Bluemix by using a custom buildpack, you see the error message, The application failed to stage, so there are no instances to display.
This problem might happen if scripts, such as the detect script, the compile script, and the release script, are not executable.
You can use the git update command to change the permission of each script to "executable". For example, you can type git update --chmod=+x script.sh.

Bluemix troubleshooting -> A gateway timeout error message is displayed when you delete a service instance

ou might receive an error message when you try to delete a service instance that is already deleted from the cloud controller.
When you try to delete a service instance, you see the service broker error message, Gateway timeout.
This problem happens if the service instance is already deleted from the cloud controller.
To resolve this problem, create a service instance with the same service name, and then bind it to your applications. After that, you can delete the service instance and the applications that use the service.

Bluemix troubleshooting -> The Bluemix dashboard cannot load applications or services

The Bluemix dashboard might not display any application or service information because your organization or space cannot access it.
When you log into the Bluemix user interface, there is nothing available on your dashboard even though you have created applications and used some services before.
This problem might happen when you bind a service instance to your application, but the service is no longer accessible because the service privileges are changed for your organization or space.
To resolve the problem, type cf services in the cf command line interface to list your service instances and identify the service. Then, use the cf delete-service command to delete the service instance that is no longer accessible.

Bluemix troubleshooting -> Configuration errors appear in the server.xml file after you import a Bluemix Liberty application from IBM DevOps Services to Eclipse

If you see configuration errors in the server.xml file after you import a Bluemix Liberty application from IBM DevOps Services to Eclipse, you might need to remove the server.xml file from the project.
After you import a Bluemix Liberty application from IBM DevOps Services into the Eclipse, you see configuration errors within the server.xml file from Eclipse Problems view.
Liberty buildpack uses the server.xml file to configure application and generates a runtime-vars.xml file when the Liberty application is pushed to Bluemix. When you import the application to Eclipse, the runtime-vars.xml file doesn't exist in your local environment.
You can resolve this problem by removing the server.xml file from the project. The buildpack creates the server.xml file dynamically when you push the application as a WAR application. For more information, see Creating apps with Liberty for Java.

Bluemix troubleshooting -> A Node.js application cannot be staged

You might not be able to deploy and stage a Node.js application if the command to start the application or package to parse environment variables is not set up correctly.

When you try to deploy an application to Bluemix, you see the error message, Cannot get instances since staging failed.
The problem might happen if the environment variables are parsed incorrectly, or if the command that is used to start the application is not specified.
To resolve the problem, complete one or both of the following actions as necessary:
  • Specify the command that is used to start the application in the package.json file or in the manifest.yml file. For example, in the package.json file, you can use the following code:
    { ... "scripts": { "start": "node app.js" } }
    In the manifest.yml file, you can use the following code:
    applications: - name: testApp ... command: node app.js ...
  • Use the cf-env package to parse the environment variables, instead of doing it manually. For example, you can use the following code:
    cfEnv = require("cf-env")

Bluemix troubleshooting -> Double-byte characters are not displayed properly when Liberty applications are pushed to Bluemix

Double-byte characters might not be displayed properly if Unicode support is not configured properly for the servlet or JSP files.

When a Liberty application is pushed to the Bluemix, the double-byte characters that are specified within the application are not displayed properly.
The problem might occur if Unicode support is not configured properly for the servlet or JSP files.
You can use the following code within your servlet or JSP file:
  • In the servlet source file
    response.setContentType("text/html; charset=UTF-8");
  • In the JSP
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Bluemix troubleshooting -> The domain names for different applications are the same

You might notice that several applications share the same URL in Bluemix.

This problem might happen when you assign the same URL route for different applications within a space.
For example, you push the myApp1 application to Bluemix and set the domain to "mynewapp.mybluemix.net". Then, you push another myApp2 application to the same space and set one of its URL routes to "mynewapp.mybluemix.net". The route is now mapped to both applications.
This is the supported behavior of the Bluemix and you can use this practice to achieve zero downtime for your application upgrade. For more information, see Blue-Green deployments.

Bluemix troubleshooting -> A Node.js application cannot be updated by using the cf push command

You might not be able to update your Node.js applications in Bluemix if the command that is used to start the application is not specified correctly.

When you try to update your Node.js applications in Bluemix by using the cf push command, you see the error message, Instance (index 0) failed to start accepting connections.
This problem might happen if the start command is not specified.
Use the -c option to specify the start command. For example:
cf push MyUniqueNodejs01 -c "node app.js"
Note: A package.json file must be available in your Node.js application to be recognized by the Node.js buildpack.
The following example shows a simple package.json file:
{ "name": "MyUniqueNodejs01", "version": "0.0.1", "description": "A sample package.json file", "dependencies": { "express": "3.4.x", "jade": "1.1.x" }, "engines": { "node": "0.10.x" }, "scripts": { "start": "node app.js" } }
For more information about the package.json file, see package.json.

Bluemix troubleshooting -> A WAR application cannot be pushed by using the cf push command

You might not be able to use the cf push command to deploy an archived web application to Bluemix if the application location is not specified correctly.

When you upload a WAR application to Bluemix by using the cf push command, you see the error message, Staging error: cannot get instances since staging failed.
This problem might happen if the WAR file is not specified, or if the path to the WAR file is not specified.
Use the -p option to specify a WAR file or add the path to the WAR file. For example:
cf push MyUniqueAppName01 -p app.war cf push MyUniqueAppName02 -p "./app.war"
For more information about the cf push command, enter cf push -h.

Bluemix troubleshooting -> A Bluemix page cannot be loaded

When you use the Bluemix user interface, you might not be able to load a Bluemix page. Instead, you might see error messages BXNUI0001E or BXNUI0016E.

You might see one of the following error messages when you use the Bluemix user interface:
  • BXNUI0001E: Could not determine whether a session exists. Try to reload the browser.
  • BXNUI0016E: Applications and services could not be retrieved.
You can complete one or more of the following actions as necessary:
  • Refresh your browser.
  • Log out of Bluemix and log in again.
  • Use the private browsing mode of your browser.
  • Clear the cookies and the cache of the browser.
  • Use a different browser. For information about the versions of the browsers that are supported by Bluemix, see Bluemix Prerequisites.
  • If you have installed the cf command line interface, enter the cf apps command to see whether your application is running.

Tuesday, November 25, 2014

Using a Repository with IBM Bluemix

It is good to store our code in repositories.  IBM Bluemix enables our code to be saved in GIT.  Users of IBM Bluemix have already registered themselves with IBM and have an IBM id.  This IBM id and password can be used with GIT.

After you login to IBM Bluemix and create an application in the Dashboard, expand the application.  The ADD GIT link will be available in the top right of the Application.  The IBM DevOps Services Page Opens.  Provide the password and Press Sign In.  A popup message indicating details that have been loaded to Git repository will come up.  Following that, the link to the application in Git will also be shown in the Dashboard related to the project.

From this link it is possible to Add, Edit and Delete folders and files.  It is also possible to Import jar files into the repository.  Build and Deploy options are also available.  The code in the repository could be Private or Public.  For Projects that have code marked as Public, code is visible to everyone.

Thursday, November 20, 2014

Creating your first mobile app.

To get started creating your application, take the following steps:
  1. Go to the Dashboard in the Bluemix user interface.
  2. Click Create an App.
  3. Click to select a boilerplate or runtime from those that are listed in Starters. When you click an icon, the details page shows information about the boilerplate or runtime.
  4. To create an app using the starter, on the details page, type a name for your app, and make other selections as needed. Click Create. The dashboard is displayed with your new app listed.
  5. You can add a service to your app by clicking Add a Service in the Bluemix user interface. Or, you can use the cf command line interface. See Options for working with apps.
  6. In the application tile, click Add Git to save your application source in a Git repository and create a Git hosted project. You can also deploy the application from IBM DevOps Services.

How to Download and import Android samples

  1. Download and extract the sample application. For a list of samples that you can download, see @mobilecloud on IBM DevOps Services. Use the git tool to clone the sample from IBM DevOps Services:
    git clone https://hub.jazz.net/git/mobilecloud/bluelist-mobiledata
    The Android project is in the bluelist-mobiledata-android folder.
  2. Import the sample into your workspace. With Eclipse:
    1. Click File > New > Project....
    2. Android > Android Project from Existing Code
    3. Click Browse. Choose the directory where you extracted the archive. Select the project name in the Projects to import list.
    4. Click Copy projects into workspace
    5. Ensure that the Android platform is included on the Java build path. Click Project > Properties > Java Build Path > [tab]Order and Export. Verify that the correct Android version is selected.
    With Android Studio:
    1. Click File > Import project.
    2. Select the Android root directory that you want for your project.
    3. Define the Gradle home directory. Select the gradle_home directory where you installed Gradle. This directory contains the bin directory.
    4. Click OK.

How to Download and import iOS samples

  1. Download and extract the sample application. For a list of samples that you can download, see @mobilecloud on IBM DevOps Services. Use the git tool to clone the sample from IBM DevOps:
    git clone https://hub.jazz.net/git/mobilecloud/bluelist-mobiledata
    The iOS project is in the bluelist-mobiledata-ios folder.
  2. Open the project file with Xcode. When you are creating a new iOS application using XCode, you must add the -ObjC linker flag to the build settings. Select the application target and click on Build Settings. Search for Other Linker Flags. If you do not see this option, verify that you selected All settings, and not the Basic settings. This flag is already in the bluelist-mobiledata sample project.

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'

BlueMix Meetups

I still remember when the Technical Rockstar event was launched, and one quarter passed. We received email about the first RockStar of IBM. This triggered me; even we can give it a try. I discussed with my team mate Subha, we took the discussion up seriously with our Manager and other team members in our team. After some good amount of discussion and with management support, we finally started planning our events. I took Pavan’s help in organizing meetups for educational institutions in Bangalore, whereas Subha helped in organizing meetups outside Bangalore.
We prepared the materials and a demo for presenting BlueMix. And even before we know we have reached the start of Sept Month. We just had 1 month left for the quarter. We started planning our meetups in such a way that we could cover as many as possible, also making sure our day to day work is not effected.
Initially, the first meetup was little difficult, we were tensed. But after we completed one, then the remaining was like a piece of cake. I involved all the members of the team to join me in conducting metups. It was a very good experience, were we connected to outside world of IBM and gave them insight of IBM and BlueMix all about.
We also saw many interested students who approached us and were interested to make the final year project using BlueMix. We met various type students and technical people, educated them on the new approaches and future way of software production etc.
By end of the quarter, when results came out, I was really surprised and very happy to know that I had won the first place in Rock star event under meetups category. It was really a wonderful experience.
I was also happy to know that my co-speaker Pavan won 2nd Prize & Subha won 3rd Prize in Rockstar event.
I would like to thank Gaurav & Girish (Management), Pavan (co-speaker for most of the sessions), Ajit & Neha (BlueMix team), Subha (Helped us to kickoff & plan), all my team members, my wife & kid (As I conducted meetups even during weekends) for all the support they have given me. Without them this would not have been possible.
This is the list of meetups conducted by us :-
SL
College Name/BP
Date
# of Participants
Presenters
1
Nitte Meenakshi College
 04/09/2014
192
Dheeraj Kumar Krishan & Pavan Muralidhara
2
SMIT, Chennai
05/09/2014
141
Subha Thangaraj
3
MAHER, Chennai
05/09/2014
87
Subha Thangaraj
4
Reva College
06/09/2014
38
Dheeraj Kumar Krishan & Sathish Subramanyam
5
East West College
09/09/2014
561
Dheeraj Kumar Krishan & Pavan Muralidhara
6
Shri Pillappa College
11/09/2014
99
Dheeraj Kumar Krishan & Virupazappa Satenahalli
7
Brindavan College
17/09/2014
224
Dheeraj Kumar Krishan & Pavan Muralidhara
8
SKSJ College
18/09/2014
70
Divya Mallya,  Subha Thangaraj & Dheeraj Kumar Krishan
9
Siddharatha College, Vijaywada
18/09/2014
221
Dheeraj Kumar Krishan & Pavan Muralidhara
10
 VIT, Vellore
19/09/2014
79
Subha Thangaraj, Bibhudatta Mohapatra & Dheeraj Kumar Krishan
11
CMR College
20/09/2014
118
Dheeraj Kumar Krishan, Pavan Muralidhara & Paresh C Nayak
12
Gopalan College
22/09/2014
152
Dheeraj Kumar Krishan & Pavan Muralidhara
13
Jain College, Kanakapura
23/09/2014
114
Dheeraj Kumar Krishan & Pavan Muralidhara
14
Jyothy College, Kanakapura
26/09/2014
140
Dheeraj Kumar Krishan & Pavan Muralidhara
15
 Jnana Vikas College, Bidadi
26/09/2014
187
Dheeraj Kumar Krishan & Pavan Muralidhara
16
Indira Institute of Technology
26/09/2014
180
Subha Thangaraj

image 
image 
image