Best Practices from Oracle Development's A‑Team

DevOps With Oracle DeveloperCS, Ansible and Docker

Gaurav Gupta
Principal Solutions Architect (A-team)

This blog shows a sample DevOps cycle using combination of Oracle Developer Cloud Service & Ansible playbook.

Scenario: An organization wants to setup DevOps practice with Oracle public cloud for Dev & test. However production still remains on-premise. In such case Oracle Developer cloud service can deploy artifacts(e.g. JAR file) to JCS (Java cloud Service) or ACCS (Application container Cloud service) for testing. While to get the artifact on premise we can write extension using open source tools. This blog shows one of the possible approach to get artifact on-prem. Docker based production environment is rolled out automatically.

Note that this blog shows one possible soluiton for DeveloperCS users. There could be various approaches/architectures/tools based on organization's existing challenges.

Tools/features used:

  1. Oracle Public Cloud:

    Source code repository – GIT Repository available OOTB with Developer CS. Used to maintain source code of sample Java Spring bootstrap based application

    Continuous Integration- Hudson build server available OOTB with Developer CS. Used to compile code, generate Jar file and perform Unit testing

  2. Internet:

    GIT Hub  - to maintain artifacts/binaries generated by Developer CS. (Here jar generated from Developer CS is moved to GIT Hub)

  3. On Premise:

    Docker – Docker container to run java application

    Ansible – Ansible playbook to download artifact from GIT Hub, configure with Docker and rollout the environment.



  • I am assuming that audience is familiar with Developer Cloud service, Docker concepts, Checkin code from their respective IDE to GIT repository. If you need information on Developer CS please refer to Oracle documentations: (https://docs.oracle.com/en/cloud/paas/developer-cloud/index.html)

  • I have built a Spring bootstrap based J2SE project.

  • Let’s login to Developer CS. Provide your Identity domain and user credential.

  • On successful login you will see projects already configured in Developer CS. In my case I already have a Spring Medrec J2SE Project. A new project can be created from this page.

  • Click on the project and go to Project section. Copy the GIT repository path. That needs to configured with your IDE.

  • Go to IDE (Netbean in my case) and check-in source code in GIT repository. Once source code is successfully pushed go to Code section. Here it shows source code checked-in to the GIT repository. It also has a pom.xml as Maven script, checked in as a part of source code.

  • Now go to build section to create a build job. Here I have created a Job named "Master Build".Go to the configure section of Master build. And click on Source code tab. Here you need to configure repository info where code is checked-in.

  • Now click on Build steps. Add build step “Invoke Maven 3”. And define appropriate goals configured in your maven.xml

  • Go to post build section and select option to archive artifact. If you have Junit test cases select option to publish Junit test cases as well. It will show test results on Developer CS console.

  • Save changes and run the build. You will see an artifact generated as a result of successful build. Here a zip file ‘medrec-0.0.1-SNAPSHOT.zip’ can be seen. This zip contains application JAR inside.

  • Also you can see Junit test results by clicking on ‘Tests’

  • Since the artifact is generated successfully it can be deployed to Oracle ACCS. Click on ‘Deploy’ menu option configure & Deploy application in your ACCS account.

  • Let’s write another build job "Move Artifacts to Remote GIT Hub" to move artifact from Developer CS to GIT Hub.

  • Go to configuration section of this job.

    Click on build steps and select execute shell as an option. Here we will write script to copy artifact generated by previous build and move to GIT Hub.

  • Save the configuration and run build. On successful build ‘medrec-0.0.1-SNAPSHOT.zip’ file can be seen in GIT hub.

  • Next, we will use Ansible playbook to pull zip file from GIT Hub and deploy on Docker. I am using a Linux VM where docker engine & Ansible are already installed.

  • Here is the Ansible playbook (deploy.yml) created to perform following tasks in sequence:

    • Pull Artifacts (medrec-0.0.1-SNAPSHOT.zip file) on local file system

    • Unzip the archive

    • Stop and remove pre existing docker container

    • Build new docker image

    • Start a new container

  • This is how deploy.yml looks like (2 screenshots) :

  • We will execute deploy.yml on localhost. However Ansible can perform same task on remote host as well.

  • Once above command is executed it will perform each task mentioned in playbook.

  • Lets check docker images and container. Access URL to run java application on Docker’s IP address.(Here the application shows Swagger API)

Scripts used in the blog are available to download.

Disclaimer: Scripts provided for free to use “AS-IS” but without any official support from Oracle. Bugs, feedback and enhancement requests are welcome but need to be performed using the comments section of this blog and the A-Team reserves the right of help in the best-effort capacity.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha