Automated Deployment to SOA Cloud Services using Developer Cloud Services

Introduction

The process of deploying SOA Projects to Oracle SOA Cloud Services (SOACS) can be significantly simplified and streamlined using the Oracle Developer Cloud Services (DevCS) by facilitating the inbuilt Maven and GIT repositories. This article is a walk-through on how create a SOA Project in JDeveloper and get it deployed on SOACS using DevCS. It is based on Windows, but other operating systems work in a very similar way. The following graphic shows the simplified process.

 

flow

Prerequisites

JDeveloper: Download and install SOA Suite 12.1.3 QuickStart from OTN. This contains the JDeveloper version required for this example. Please note that this example will work for SOA 12.2.1 as well, but you will additionally need to follow the steps described in My Oracle Support (MOS) note2186338.1

Maven: Download and install Maven from here.

Access to a Oracle SOA Cloud Services 12.1.3 instance. Details can be found here.

Access to Oracle Developer Cloud Services – this comes as part of the SOA Cloud Services subscription. You will receive an email with details on how to login with the subscription activation.

Creating the GIT repository

Login to the Oracle Developer Cloud Services and Select Create New Project. I am going with a Private Project, but using the Shared project is identical. Make sure to select an Empty Project and select your favourite Wiki Markup. More details can be found here.

image1  image2

A few seconds of provisioning later the Project will be accessible – navigate to the Code Section of the Developer Services Project and hit the New Repository button. This will start the process to create a new git repository. Make sure not to initialize it, but simply create an Empty Repository.

image4

Every git repository has unique URLs to access it. This article uses the HTTP authentication option, if you are using SSH, create an SSH key and add it to Oracle Developer Cloud Service. For more information, see Generating an SSH Key. Make a note of the URL of the newly created repository for use later in the article.

Capture

Creating a simple SOA Composite

In order to demonstrate this process I am going to create a dummy SOA Application using JDeveloper. This is not really the focus of this article – a great place to start with this is Oracle by Example (OBE). For the minimum required open JDeveloper and start by creating a new SOA Application.

image5

Give it a name a make note of the directory the work will be stored in. A project within the application will be automatically created.

image6  image7

For this example I am using a simple BPEL 2.0 process. This is basically just a placeholder to proof the process.

image8  image9

Adjusting Your Project for Maven

There are a few changes that have to be applied to the local project in order to get it working properly with Maven in DevCS. First open DevCS and navigate to the Maven page. This page shows the details for the distribution management. Note the information for the repositories – it needs to be added to three files on the local file system.

image24

First the file repository needs to be added to the maven configuration in the settings.xml – as shown in the screenshot – click to enlarge. This file usually exists in C:\Users\<user>\.m2\settings.xml in Windows, though the location can differ based on the configuration. The Maven configuration guide is the best source for issues.

image26_2

The next files that need adjustment are the pom.xml – there is one pom.xml on the application level and one on the project level. You can edit the files directly out of JDeveloper as shown in the screenshots.

image27  image23

Also make sure to adjust the <sarLocation> to your needs. If you keep the defaults, you will have to add the -SNAPSHOT string as shown below.

image25

Pushing Application to DevCS

Next a local git repository needs to be created to maintain the contents of the project locally. This repository will then be pushed to the DevCS. The repository gets initialized via the Team menu under the option git – select Initialize and enter a new location for the repository.

  image12

Next all the files that are part of this application need to be added to git and afterwards committed into the local git repository, as shown in the screenshots below.

image13  image14

More details about this process including a great introduction video can be found here.

image15  image16

After all files have been committed, the repository needs to be push into the Developer Cloud Services git repository that has been created earlier – this can be done via the Push Assistant, which is accessible via the context menu of the context menu of the application. The Repository URL can be copied from Developer Cloud Services Code page as shown above. The credentials are the credentials for the DevCS – this can be different from your oracle.com account – see here how to set these credentials.

image17_2   image18

Select the master branch and make sure that the Status is Create – it should not be Update at this stage.

image19  image20

You are now able to see the committed and pushed repository objects in the DevCS. Simply navigate to the Code Section of the DevCS.

image21

Populating the local Maven Repository

By default the location for the local Maven repository will be C:\Users\<username>\.m2\repository.  The ORACLE_HOME references the SOA Suite 12.1.3 Quickstart installation directory. The JAVA_HOME points to the latest available JDK installed locally. There are two steps to this process the first command deploys the Oracle Maven Synchronization Plug-In into the local Maven Repository. The second command pushes the local Maven Repository to the Oracle Cloud Developer Services. These commands are executed via the cmd.exe – no administrative execution is necessary. For more details please see here. Please note this process takes a while, if you have a slower internet connection.

 set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_121
 set ORACLE_HOME=C:\oracle\Middleware\Oracle_Home
mvn deploy:deploy-file -DpomFile=%ORACLE_HOME%\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3\oracle-maven-sync-12.1.3.pom
    -Dfile=%ORACLE_HOME%\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.1.3\oracle-maven-sync-12.1.3.jar
    -DrepositoryId=SOA_Maven_CI_Project_repo -Durl=https://developer.us2.oraclecloud.com/profile/developerXXXX-aXXXXXX/s/developerXXXXX-aXXXXXX_soa-maven-ci-project_12619/maven/
    mvn com.oracle.maven:oracle-maven-sync:push -oracleHome=%ORACLE_HOME% -serverId=SOA_Maven_CI_Project_repo
    -P Profile_SOA_Maven_CI_Project_repo

Creating the Build Job

The next step is to create the actual build job that will compile, package and deploy the SOA Composite on SOA Cloud Services using the Developer Services. The Developer Services use Hudson for build tasks – Simply Navigate to the Build page of DevCS and click New Job. You usually can work with the Default JDK.

image29  Capture3

The build requires a number of parameters to execute on the right SOA CS. Make sure to double check your spelling – everything is case sensitive. Please note that oracleServerUrl refers to the Public IP of your SOACS deployment. If you are using a load balanced deployment the Oracle Traffic Director will listen on port 80 to forward them to the Managed Server port 8001. You can also opt out to open the port and deploy directly against the Managed Server that is hosting SOA. The details how to find the correct IP can be obtained here.

It is strongly recommended to encrypt the passwords used here. This process is described in this guide.

 

Name Value Parameter Type
middlewareHome opt/Oracle/Middleware/SOA String
oracleUsername weblogic String
oraclePassword <SOACS Password> String
oracleServerUrl http://10.10.10.10:80 Password

 

Capture4

Navigate to the Source Control Tab and add the git repository that has been created previously. Move to the Triggers tap and make sure to select the – 

Capture5  Capture6

Move on to the Build Steps Tab and click the add Build Step Button – for now we only need to add the Invoke Maven 3 step. You can add additional steps to support your needs at a later stage. Please add the proxy properties with the following options – this will avoid the calls being routed unecssary:

    http.proxyPort=$HTTP_PROXY_PORT
    http.nonProxHosts=localhost|*.oraclecloud.com
    http.proxyHost=$HTTP_PROXY_HOST

I have chosen the pre-integration-test Maven Goal for this example as I haven’t included any tests in my SOA Project. Details about this Goal can be found here. The next step should be to implement the tests to allow a complete “clean install” Maven Goal, however this is out of scope for this article. Finally hit the Save button,

Capture7

You can hit the CC’ed button on the Job Home page to receive the logs right into your inbox. Finally hit the “Build Now” button to test this Job. If everything goes well you should see the outcome with the “Finished: Success” message as shown below.

Capture2

Next Steps

The job will execute every time you push your changes in your JDeveloper Application to the DevCS git repository. This example only shows the basics what is possible with the Oracle Developer Services and SOA Cloud Services. The next step should be to incorporate a test that will validate the successful deployment as described here.

 

Further Reading

Oracle SOA Cloud Service Documentation: http://docs.oracle.com/cloud/latest/soacs_gs

Oracle Developer Services Documentation: http://docs.oracle.com/en/cloud/paas/developer-cloud/index.html

 

Add Your Comment