Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

Monday, June 9, 2014

Does BlueMix support Spring?

Before Write this topic,I got news for IBM site,the commercial BlueMix will be release at the end of June. Most service IBM provided are free of charge,you only need pay what use part of runtime enviroment fee.

 The Spring Framework is an open source application framework and inversion of control container for the Java platform. The framework's core features can be used by any Java application, but there are extensions for building web applications on top of the Java EE platform.Spring helps development teams everywhere build simple, portable,fast and flexible JVM-based systems and applications.

In order to demo the ability of the BlueMix ability we use the project on github.You can download it from https://github.com/cloudfoundry-samples/spring-hello-env.
After download the package and unzip it and you should see the below strcture.
 Since it provide  a project object model (POM) xml file, we can use Maven to manage a project's build, reporting and documentation from a central piece of information. You can use maven to build the project .
You can use mvn package under the project strcutre.
It will generate hello-spring-env.war.So you can use cf command tool to publish this to the BlueMix,
For example we can use below command to push your app to the BlueMix.We bing a mysql service to our app,so the env will include the mysql service.
cf create-service mysql 100 mysql_NMU
cf p SpringSample -p hello-spring-env.war
cf bind-service SpringSample mysql_NMU

After deployment,you can see the result through the below url.You can mysql service is in the VCAP_SERVICE.
Also we can deploy the app in the eclipse,I left a eclipse strctrue for your reference.We can use cloundry plug-in to deploy it to the BlueMix side.



Tuesday, May 27, 2014

Use Eclipse to deploy node.js application on BlueMix

IBM has release a plug-in called BlueMix for Eclipse Kepler Beta.You can see the detail in the link. It said not only support java liberty and also node.js deployment.I wrote the blog about how to use eclipse to deploy liberty demo to BlueMix.But how about node.js? There is little document about these things.I saw the internal email has this kind of information,so I forward here if you are interested in.

Creating a Node.js application for BlueMix from scratch
Summary of features covered:
- The ability to add JavaScript project to BlueMix
- Auto generation of required files to enable new projects to quickly be added to BlueMix
- Easily fill in the cloud deployment information via wizards
- The package.json file is parsed to determine which JavaScript entry file to run
- Easily allow the user to visit the URL of the project once it's on BlueMix
- Republish a project (that is, make a change and have it reflected without removing the application and then adding it back again)
- Allow the user to update existing cloud deployment information via the Applications Editor page
- Ability to remove the application from BlueMix

1. Create a JavaScript project in Eclipse. Let's call it HelloWorldNode

2. This project is empty and the user cannot add this application to BlueMix, until a facet is added to this project
Right click on the HelloWordlNode project > Properties > Project Facets

3.Click on "Convert to faceted form..." and select "Node.js Application"


4. Press OK
2 files will be generated if they don't already exist:
1. app.js - a skeleton entry JavaScript file
2. package.json - defines what the starting JavaScript should be, dependencies, and more. This is not cloud specific and is standard in Node.js applications

5.Right click on the BlueMix server > Add and Remove.HelloWorldNode to the right panel and click finish.

6. the deployment information wizards will now come up. This will enable the user to specify their application name and buildpack URL They can also choose the "Save to manifest file" option if they would like to save the properties that are being set by this wizard

7.Feature: the subdomain, domain, deployed URL, and memory limit can be set .If you don;t want to choose service you can pass the next wizard.

8 When you finish most of setting,you can see the console log.

Checking application - HelloWorldNode
Generating application archive
Creating application in Cloud Foundry server
Pushing application to Cloud Foundry server
Application successfully pushed to Cloud Foundry server
Staging application

-----> Downloaded app package (4.0K)
-----> Buildpack Version: 20140522-0208
-----> Resolving node version by IBM

       PRO TIP: Specify a node version in package.json

-----> Defaulting to latest stable node: 0.10.21
-----> Installing IBM SDK for Node.js from admin cache
-----> Read service config: MonitoringAndAnalytics.json at the start
-----> Read service config: SQLDB_BLUAcceleration.json at the start
-----> Writing a custom .npmrc to circumvent npm bugs
-----> Installing dependencies
       npm WARN package.json insert-title-here@0.0.1 No repository field.
       npm WARN package.json insert-title-here@0.0.1 No README data
-----> Cleaning up node-gyp and npm artifacts
-----> No Procfile found; Adding npm start to new Procfile
-----> Building runtime environment
-----> Read service config: MonitoringAndAnalytics.json at the end
-----> Read service config: SQLDB_BLUAcceleration.json at the end

9.Right click on the project in the Servers View > Open Home Page  you can see your application via the browser.


10.If you change the app.js code,you need to re-publish your application in the BlueMix server.