DevOps with Oracle Developer Service – Deploy SpringBoot application to Oracle ACCS

Developer need to follow agile way in developing application. DevOps is new way of Software development. Developers need to setup some support service before starting new project. This can be as follows-

  • Wiki  for document authoring and collaboration with your team members
  • Version Control
  • Automated build.
  • Code Reviews
  • Issues Tracking.

Many organization follows these standard for their development practice. But in Oracle Development stack, Some of things are quite new. And reading this article further will be more interesting for them.

Developer Cloud Service is answer for all support service you require. It comes with other cloud development services i.e.

  • Java Cloud Services.
  • Database Cloud Service
  • Java Cloud Service-SaaS Extension
  • Messaging Cloud Service
  • Mobile Cloud Service
  • SOA Cloud Service and 
  • Application Container Cloud

 

The DevCS is a complete development platform provided as a service to enable an agile development process and to automate DevOps & delivery. It covers most of the DevOps cycle including Continuous Integration, Continuous Delivery and Collaboration. 

 

Oracle Developer Cloud Service is a collection of similar software and services hosted on Oracle Cloud. Oracle Developer Cloud Service helps you to manage the application development life cycle effectively through integration with Hudson, Git, Maven, issues, and wikis. Using Oracle Developer Cloud Service, you can commit your application source code to the Git repository on the Oracle Cloud, track assigned issues and defects online, share information using wiki pages, peer review the source code, and monitor project builds. After successful testing, you can deploy the project to Oracle Java Cloud Service – SaaS Extension, publicly available Oracle Java Cloud Service instances, Oracle Application Container Cloud Service instances, or to an on-premise production environment.

 

Following are components in DevCs

  • Ant, Maven, Gradle, npm, Grunt, Bower, Gulp, Command line
  • Continuous Integration – Hudson
  • Issue Tracking
  • Code review
  • Deployment automation
  • Agile process management
  • Wiki
  • Version Management – Git
  • Build Automation
  • Activity Stream 

     

    You can link DevCs with NetBeans and Jdeveloper very easily and work with it quite effectively. If your code is in external GitHub account, it can also map that and make it work for you. Looking at Oracle Development methodologies, DevOps is quite new terms and many organization is not ready with it. This can be great service for them . Specially Customer with Oracle Forms, Pl/Sql, Apex, ADF stack, this can be quite useful and you can set up whole environment in couple of hours. So definitely, it is worth for a give a try .

     

    Use CaseAn 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 making deployment in production, We will make artifact ready for deployment to Production and place in separate Git Hub location.

     


     

    I have spring boot application in Netbeans. Create connection from NetBeans to developer cloud service. Click on Team- Team Server- Add new server.

     


     

    Provide credentials and url of DevCs.

     


     

    After making connection to DevCs, create new project in Developer Cloud service or open project , if project exist in DevCs.

     


     


     


     

    Navigate to DevCs server to see whether project created in console.Open DevCs console, new project will created successfully.

     


     

     

    You can also create project in DevCs console as well. Select Security as private or shared.

     


     

    • Choose template for new project. There are multiple template available


     

     

    If you have existing local github account. You can also import from there as well . Click on Finish.

     


     

    After that , you will see something like

     


     

    Alright , now project is created in DevCs , which we created from Netbeans. Now we will start code uploaded in Code section.

     


     

    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 Control 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

     


     

    And then add maven goals and select pom.xml and provide profile.

     


     

    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. You can do configuration like

    Publish Javadoc,configure to build other jobs. Click on Save.

     


     

    You can set trigger point of these build using schedule.

     


     

    Now click on Build now. It will run that job for building the repository and show you status of that job. You Can also see Git Logs, Audit , Junit test result. It will take a while and show you progress of build.

    You can also configure notification for successful and failed build.

     

     

    See generated archive in artifacts of Last Successful build tab , under target. Expand and see that

     

     

    Click on Console to see build console

     

    Now, we have generated artifact successfully. Now we can configure deployment to Oracle ACCS. Click on ‘Deploy’ menu option configure & Deploy application in your ACCS account.

     

    Now Click on New configuration.Provide Configuration name, application name. Select Deployment target as Application Container cloud

     

    You can select different deployment target as below

    Select ACCS properties as follow and click save and Deploy.

    Now, you can see deployment status and artifact is deployed successfully to Oracle ACCS. Similarly, you can deploy application to Java cloud Service and Java cloud Service- SaaS Extension.

     

    You can stop, redeploy and change configuration easily.

     

    Now, if place artifact to separate GitHub location, we can also write another build job for that. It will move artifact from DevCs to GIT Hub. Navigate to Build and Click on New Job.

    In build steps configure build steps as Execute shell

     

    You can some command to copy archive to remote GitHub Location and push. Its normal command. That’s it. If you see, you can follow whole DevOps in Oracle Cloud easily and it will provide lots of features out of box. You can also configure on premise Jenkins with Developer Cloud Service using hook up. Read this Article.

     

    Keep looking this space for more article about Developer Cloud service in depth. Happy Learning Oracle Cloud.

     

Deploy to Application Container Cloud Service from Oracle Storage Cloud via REST API

As mentioned in my previous post about Application container cloud. We can use two options to upload application archive to ACSS

  • UI console (Already covered in previous post)
  • From Stroge cloud service via REST API

In this post, we will talk about upload archive via storage cloud Service using REST API. There is two steps for that

  1. Store archive to Storage Cloud service.
  2. Deploy Archive to ACCS.

tttttt

Information credentials for cloud account should be handy as identity, domain, password for using in REST API. Using cURL scripts to upload your application to the storage service.

 

Note :  cURL is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP.

 

Store archive to Storage Cloud service

 

Before uploading in Storage cloud, We need to build container in Storage Cloud Service. Either you can via Storage cloud UI console. Building using UI console is pretty easy and straightforward.

 



 

We will create container via curl command.

  1. Below Script will create storage container.    
# CREATE STORAGE CONTAINER
curl -i -X PUT \ -u User-Name:Password \ https://hostname/v1/Storage-Identity-Domain/App-Name

 

  1. Now upload your application archive to the storage container.
# PUT ARCHIVE IN STORAGE CONTAINER
curl -i -X PUT \-u User-Name:Password \ https://hostname/v1/Storage-Identity-Domain/App-Name/Archive-File-Name -T Path-to-local-file/Archive-File-Name

For example use following script to upload it

curl -i -X PUT \ -u sampleUserName:samplePassword \ https://storage.oraclecloud.com/v1/Storagecontainer/DeveloperSkillsApp/SpringBootJpaDev-1.0-dist.zip -T target/SpringBootJpaDev-1.0-dist.zip

After running these script, it is uploaded to Storage cloud container.

 


 

Deploy Archive to ACCS –

After uploading archive to Storage cloud servicee, ACC’s deployment procedure can be invoked. We need to provide standard set of information while deploying. Sample schema of script should be as follows

# Mock Deployment Script
url -i -X POST  \
  -u User-Name:Password \
  -H "X-ID-TENANT-NAME:Identity-Domain" \
  -H "Content-Type: multipart/form-data" \
  -F "name=App-Name" \
  -F "runtime=java" \
  -F "subscription=Monthly" \
  -F "[email protected]" \
  -F "archiveURL=App-name/Archive-File-Name" \
  -F "notes=Your Notes here" \
  https://hostname/paas/service/apaas/api/v1.1/apps/Identity-Domain

Trying to upload with following script –

curl -v -u "USERNAME:PASSWORD” -X POST -H "X-ID-TENANT-NAME: IDENTITY_DOMAIN" -H "Content-Type: multipart/form-data" -F "name=Developer-skills-service" -F "runtime=java" -F "subscription=Monthly" -F "archiveURL= Storagecontainer/SpringBootJpaDev-1.0-dist.zip " -F "notes=Developer Skills Service Deployment" https://apaas.REGION.oraclecloud.com/paas/service/apaas/api/v1.1/apps/IDENTITY_DOMAIN

 

When you deploy your application, you can reference a deployment.json file. Information about deployment like memory , instances etc. can be pass via deployment.json.

 

You can automate these two process using maven. You can also configured this by maven plugin in Oracle Developer cloud services.

 

 

That’s all for now. Happy Oracle Cloud learning.

Introduction to Docker and Docker Compose

Aim- What is Docker and Docker Compose. I will try to explain about linux container then goes more into Docker and Docker Compose for a beginner.

Now in this cloud buzz world, what developers want –

● Scalability, maintainability, Agility, Portability.
● DevOps tools.
● Improved resource utilization.
● A continuum of abstraction levels.

Linux Containers -contain applications in a way that keep them isolated from the host system that they run on. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. And they are designed to make it easier to provide a consistent experience as developers and system administrators move code from development environments into production in a fast and replicable way.
In a way, containers behave like a virtual machine. To the outside world, they can look like their own complete system. But unlike a virtual machine, rather than creating a whole virtual operating system, containers don’t need to replicate an entire operating system, only the individual components they need in order to operate. This gives a significant performance boost and reduces the size of the application. They also operate much faster, as unlike traditional virtualization the process is essentially running natively on its host, just with an additional layer of protection around it

Linux Containers
● Use Linux kernel isolation features to give a VM like environment.
● Process isolation /Sandboxing.
● Example: Lxc, lmctfy, Docker.

Now, What is Docker
● An easy to use Linux container technology.
● Docker image format.
● It helps in application packaging and delivery.

Docker is a tool that can package an application and its dependencies in a virtual container that can run on any Linux server. This helps enable flexibility and portability on where the application can run, whether on-premises, public cloud, private cloud, bare metal, etc. (Wikipedia)


Docker Vs Virtualization-

– Docker is lighter than virtual machines.
– The size of Docker images is very small compared.
– We can run more Docker container on a reasonably sized host.
– Deploying and scaling is relatively easy.
– Docker has less start up time.

Technologies behind docker
● Control groups:
○ Control Groups are another key component of Linux Containers
○ With Cgroup we can implement resource accounting and limit.
○ Ensure that each container gets its fair share of memory, CPU, disk I/O.
○ Thanks to Cgroup, we can make sure that single container cannot bring the system down by exhausting resources.

● Union file systems: ○ Layered file system so you can have a read only part and a write part, and merge those together. ○ Docker images made up with are layers.

● Namespaces
○ It helps to create an isolated workspace for each process.
○ When you run a container, Docker creates a set of namespaces for that container.
● SELinux
○ SELinux provides secure separation of containers by applying SELinux policy and labels.

What are components of Dockers

Docker Images – An image is an inert, immutable, file that’s essentially a snapshot of a container. Images are created with the build command, and they’ll produce a container when started with a run. Images are stored in a Docker registry such as registry.hub.docker.com
Docker containers – is an open source software development platform. Its main benefit is to package applications in “containers,” allowing them to be portable to any system running the Linux operating system
Docker Hub – is a cloud-based registry service which allows you to link to code repositories, build your images and test them, stores manually pushed images, and links to Docker Cloud so you can deploy images to your hosts
Docker Registry -is a cloud-based registry service which allows you to link to code repositories, build your images and test them, stores manually pushed images, and links to Docker Cloud so you can deploy images to your hosts
Docker daemon -This is the part which does rest of the magic and knows how to talk to the kernel, makes the system calls to create, operate and manage containers, which we as users of Docker dont have to worry about.
Docker client – This is the utility we use when we run any docker commands e.g. docker run (Docker container run), Docker images, docker ps etc. It allows us to run these commands which a human can easily understand.

docker

As you see above screen shot, we have docker client where the user performs build, pull and run operation.The client interacts with a host which contains different container, Docker Daemon and images via Registry.

If you guy reading this line, then you must be getting something about docker now. You know basic components and vocabulary.
Now let’s take an example of real life applications.
● One application consists of multiple containers.
● One container is dependent on another.
● Mutual dependency/ startup order.
● Process involves building containers and then deploy them
● Long docker run commands
● Complexity is proportional to the number of containers involved

dockerwithMultiContainer

Take example of above image, this will look multicontainer docker .The containers include (1) NGINX container, (3) Tomcat containers, (1) MongoDB container, and (1) ELK container. But have’t docker came to help us, This look quite difficult process to manage it all. To rescue us, Docker Compose is there.

Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you create and start all the services from your configuration.Compose is great for development, testing, and staging environments, as well as CI workflows.

compose

Docker Compose
● Tool for defining and running multi-container Docker application.It is a YML file and compose contains information about how to build the containers and deploy containers. It is integrated with Docker Swarm. It competes with Kubernetes.

Compose is basically a three-step process.

1- Define your app’s environment with a Dockerfile so it can be reproduced anywhere.
2- Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.
3- Lastly, run docker-compose up and Compose will start and run your entire app.

docker-yml

You can explore more with Docker Swarm, which I will explain in next post. Till then happy learning with Vinay