sabato 7 novembre 2015

DevOps & Oracle Cloud: How to create from scratch a Maven Project on Eclipse, synchronize it with a Git on Oracle Developer Cloud Service and finally how to use DevCS to build and deploy it on Java Cloud Service

I have used OEPE (Oracle Enterprise Pack for Eclipse) and you can download it from

Start your Eclipse(OEPE 12.2.1) and define a Workspace:

Click now on "Workbench" to continue:

This is the starting page of Eclipse:

In this example we will create a war maven project, to do this click on File->New->Other :

Select now Maven Project:

Click on next:

Scroll down and select maven-archetype-webapp:

Fill the Group Id and Artifact Id:

A new project will appear in the project explorer:

As you can see there are some errors on the project to solve them we must set a target runtime to add all the needed libraries:
Click on Project->Properties:

Select Targeted Runtimes

As runtime, select Oracle WebLogic 12.1.3 (the same version of the one selected on JCS):

Put where WLS12.1.3 is installed on your computer:

Select the Runtime, click apply and then Ok:

Now your Project is without errors:

Now we need to create a weblogic.xml inside WEB-INF directory, here we will set the Context Root of the Web Application, this is important because when you will Build and Deploy from DevCS to JCS if you do not set the Context Root, DevCS create it dynamically for each Build with a different name.

Look the next image as an example on how to set a Context Root:

Now we will add a Server to be able to compile and deploy and test the application on local computer:

Select Window->Show View->Other:

Select Server->Servers

Now on the right-down of Eclipse you can find Servers Tab, click the link to create anew server:

Select WebLogic 12.1.3:

Put where WLS 12.1.3 is installed on your computer:

Now in the servers tab appear your WebLogic:

We can build, deploy and run the application in a simple way:
Select index.jsp file, click on it and with right button of the mouse and select Run As->1 Run on Server:

Click finish:

WebLogic will start, and your jsp file will appear inside the browser of eclipse:

Oracle Cloud plug-in:

Now we will use Oracle cloud plug-in, to be able to put our project on DevCs (Developer Cloud Service):
Select Window->Show View->Other:

Select Oracle Cloud->Oracle Cloud:

Now click on the Connect link that is present on the Oracle Cloud Tab :

Here you must insert the Identity Domain of your DevCS service (Developer Cloud Service), the user and the password are the same that you use in the login page of DevCs: (Connection name is auto filling)

In the Oracle Cloud Tab will start the Fetching of the projects present on DevCs (this will takea while):

Now you can see the project that you have already created on DevCs:
[How to create a Project & Git repository on Developer Cloud Service]

Now with a simple Drag & Drop operation, put your project from Project Explorer, inside the project that appear on Oracle Clod tab , to push it on the Git of DevCs:

In my case I have dragged & dropped itpwork project from Project Explorer to the ITPWORK folder under developer50378 that appear in the Oracle Cloud  tab:

This pop-up will appear:
Check the Create Hudson build job and uncheck the Generate or update Maven ...
Our poject is a maven project and already have a pom.xml

At the end,you will have your project on the Git on DevCs, and also inside a local git.

In you go on DevCS and you select your project (in this case ITPWORK), if you go on the Code Tab you will find now a copy of your project:

If you go in the Build Tab you will find a generic build job "Sample_Maven_Build" and the specific build job for your project created by Eclipse:

The first time this job will start automatically, and if all it is ok you will obtain a green icon in the status and a sun in the weather section:

If you click on the console icon under the action section of the previous image you can see the log and what was created:

Now that we are able to build the project, we can create the deploy job:
Go to the Deploy Tab and click new configuration:

Fill configuration and application name (I have used the same name of the war project) then select Java Service -> Select a Remote Target (where you want to deploy)  :

Put the public ip address of your JCS Service, use the 9001 port (by default on JCS on the Admin Server there is a http channel on port 9001) user and password are the same that you are using when you login in the WebLogic Console:

The test will Fail is you have not done
[ How to setup a SSH communication between Developer Cloud Service and Java Cloud Service to enable the Deploy from DevCs to JCS ] :

Select "Automatic", the deploy will start automatically after a build job.
Select the build job previously created by Eclipse, select your Artifact:

The first time the deploy will start automatically:

If you select the Build tab, you can start your build job selecting the Build Now icon under Actions:

Then you can see a progress bar for your build job:

At the end of the build job, the deploy job will start automatically:

If you open the Admin console, under deployments you can find you new Application Deployed and Active:

We can call and test now the application using the load balancer:

You can find all the Public IP on your JCS service:
[How to create a Service in Oracle Java Cloud Service]

Now as sample we will modify the jsp page on Eclipse and we will rebuild and redeploy the application from DevCs to JCS:

Go on Eclpise and add some text to the jsp:

We will update the Git on DevCS with the new version of the jsp:
Select the jsp then click on it with the right button of the mouse, select Team->Commit

Insert a Comment in the Commit Message, this will appear on DevCs, select the jsp you have changed, click on "commit and push":

Click ok:

Open your DevCs and select the Code Tab, you will find what you have just added with your comment:

if you click on it you can see the differences in your code from the previous version:

Restart your build job, at the end the deploy will be automatic:

Wait and be sure that the deploy has finished, then if you call your application you can see that is a new version:

18 commenti:

  1. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here"Oracle Training in Chennai".

  2. Hi Thanks for the nice information its very useful to read your blog. We provide best Digital Transformation Overview Services

  3. Very nice information and excellent explanation, easy understanding. Thanks for sharing.
    Massil Technologies provided the Best APP DEVELOPMENT SERVICES

  4. Excellent information you made in this blog, very helpful information. Thanks for sharing.

    Software Testing | Austere Technology

  5. Great article, really very helpful content you made. Thank you, keep sharing.

    chartered accountant | Avinash college of commerce


  7. Thank you for sharing this valuable information. But get out this busy life and find some peace with a beautiful trip. book best Andaman honeymoon packages

  8. Hi Thanks for the nice information its very useful to read your blog. We provide best Block Chain Services

  9. Thank you for sharing this valuable information. But get out this busy life and find some peace with a beautiful trip. book ANDAMAN TRIP @ 7999

  10. Hi Thanks for the nice information its very useful to read your blog. We provide best Association Of Chartered Certified Accountants