In previous posts we discussed how Microservice applications can be implemented, combined and monitored in Oracle Application Container Cloud service. So far, we focused on a manual deployment process. However, when aiming to implement a working Microservice strategy DevOps is a key success factor. One area DevOps concentrates on is software delivery automation (CI/CD).

With Developer Cloud Service Oracle provides a full team development and delivery cloud platform. It can be used as a service and is perfectly integrated with other Oracle cloud services, including Application Container Cloud Service. Therefore, it is a valid candidate when evaluating new tool chains for cloud native application development. Nevertheless, many organizations already have existing CI/CD solutions in place and do not want to waste the investment. In these scenarios, an understandable requirement for a solution integrated in the existing tool chain exists. This post will show how one can deploy to Oracle Application Container Cloud using Maven as build tool. As Maven is a tool commonly supported by CI/CD solutions, this approach can be integrated easily in existing development process automations.

Basic Deployment Process

First, let us look at the general deployment process for Oracle’s Application Container Cloud Service. It consists of three basic steps. Within the first step the deployable Application Container Cloud Archive containing all required files must be created. Afterwards this archive is uploaded to Oracle Storage Cloud Service. Finally, one must invoke a deployment procedure on Application Container Cloud service providing application metadata and archive location within Oracle Storage Cloud Service. Even if applications are created using ACC service console this process is followed behind the scenes. To implement our deployment process accordingly, existing Oracle Cloud Service REST APIs can be used. For this blog post we will aim to implement the following steps:

  1. Create ACC application archive file
  2. Create deployment container in Storage Cloud Service (optional)
  3. Upload file to Storage Cloud Service
  4. Initiate ACC deployment procedure

Maven Application Assembly

First of all, one has to create a deployable ACC application archive. As in previous posts it has to contain a manifest.json, application.properties and an application Java archive (app.jar).

Maven Assembly

Within Maven such functionality is provided by maven-assembly-plugin. To define how Maven assembles a new artefact during its package lifecycle phase a custom assembly descriptor can be used. The listing below shows how a descriptor for our example project might look like. Within the descriptor’s format section one can see that a tar.gz archive will be created. All required files are selected and renamed within the descriptor’s files section. Furthermore, flag includeBaseDirectory was set to false such that all files are packaged to the archives root-directory.

In addition to this assembly descriptor Maven’s assembly plugin must be configured within the project’s pom.xml. This second listing shows a valid configuration to incorporate archive assembly to Maven’s package lifecycle phase.

By adding these two configurations to the project step one is completed. Afterwards a deployable ACC application archive is created within the projects target directory when executing mvn package.

Uploading to Oracle Storage Cloud

After creating an Oracle ACC application archive one must upload it to Oracle Storage Cloud using the REST API provided. For a step by step description on how to obtain all required information and REST endpoints Oracle’s documentation can be consulted. A full list of available functions is described in Oracle’s REST Endpoint Documentation. In general, a valid Storage Cloud Service REST API endpoint should follow the following schema:

Using this information one can create the optional Oracle Storage Cloud Container mentioned in step two of our deployment process. Storage Cloud Containers are folders within Oracle’s cloud service that help to organize files. To call the respective REST endpoint the command line tool cURL can be used:

After creating the storage container, the ACC application archive stored within our project’s target folder can be uploaded. This can be achieved with the following cURL command line:

To integrate this step into a Maven build process one has several options. Some of these options are:

  1. Using Groovy script implementing REST calls
  2. Using existing third party Maven REST plugins
  3. Development of custom Maven plugin
  4. Using Maven exec plugin to execute curl command line

For this example option four was chosen and implemented. When using the exec plugin one must define which command should be executed and which parameters should be used during this call. The listing below shows a valid Maven exec plugin configuration for the cURL command line.

After adding this configuration to the project’s Maven pom.xml, the goal can be executed using the following command line where push-application is the execution’s ID:

Storage Upload

Initiating Deployment

Now that the ACC application archive is uploaded to Oracle Storage Cloud Service, ACC’s deployment procedure can be invoked. For a detailed description on how to obtain all required information one can consult Oracle’s ACC REST Quick Start Documentation. A valid REST endpoint URL should look as follows:

To invoke ACC’s deployment procedure all required application metadata including subscription type, service runtime, application name and application archive location must be provided. As result a rather long cURL command line is required:

Using the same approach as above, this cURL command can be translated to an additional Maven execution configuration:

To call this execution only the ID must be amended:

In some cases, the application’s manifest file must be explicitly provided as additional parameter. If everything works as expected, Maven executes the cURL command line and an asynchronous deployment process is started.

Maven Deploy

Summary

Throughout this post it became clear that Oracle managed to provide its customers with an open infrastructure which can be easily interacted with using REST APIs. Using these APIs, it is simple to manually execute all administrative tasks required for a sophisticated deployment process. As a natural evolution, these manual tasks can then be automated using proper tools and integrated in new and existing build processes.

Deployed Application

Links

Oracle Storage Cloud REST API Documentation

Oracle Storage Cloud Send Request Documentation

Oracle Application Container Cloud Deployment Quick Start

Oracle Cloud API Catalogue

Maven Exec Plugin

Maven Assembly Plugin