Develop and Scale Applications in a
Fully Managed Cloud Runtime

As an application developer, you just want to code without having to deal with all the details of maintaining environments and DevOps activities.

With the emergence of container technology, developers can seamlessly move code to an environment with a dissimilar operating system, security protocol, and topology. This container technology is the basis for Oracle Application Container Cloud Service.

In this technical paper, we describe Oracle Application Container Cloud Service and how developers can use it to deploy applications to Oracle Cloud. We’ll also show an example of how Oracle Application Container Cloud Service is used in the real world.

accs
Contents

What is Oracle Application Container Cloud Service?

Oracle Application Container Cloud Service (ACCS) is based on Docker, the container technology that provides the underlying infrastructure required to run your applications in Oracle Cloud. Application Container Cloud Service currently supports Java Platform, Standard Edition (Java SE); Java EE; Node.js; PHP; Python; and Ruby, with more applications to come.

Based on an open platform, Application Container Cloud Service supports open-source application containers and frameworks, including Jetty, Spring Boot, Tomcat Express, and Laravel. As the developer, you have complete control over what libraries and modules you deploy with your application. Prior knowledge of Docker or other container ecosystems isn’t required.

You can still use your favorite tools and frameworks to develop applications.

You don’t need a specific development tool or SDK to deploy your application on Oracle Application Container Cloud Service. Continue to develop your applications as you have with your on-premises applications.

Application Container Cloud Service lets you leverage the continuous integration capability offered by Oracle Developer Cloud Service. Oracle Developer Cloud Service is a turnkey solution that provides a development sandbox in the cloud with a Git repository and Hudson-based continuous integration. Application Lifecycle Management (ALM) capabilities such as bug tracking, wikis, and team development are also included. With Oracle Developer Cloud Service, you can automatically build and deploy applications to Oracle Application Container Cloud Service.

Oracle Application Container Cloud Service is fully integrated with other Oracle Cloud Platform services. A subscription to Oracle Storage Cloud Service is included and must be activated before you can deploy applications to Oracle Application Container Cloud Service.

If you want to store and retrieve data, then you can subscribe to Oracle Database Cloud Service or Oracle MySQL Cloud Service. For communication, you can subscribe to Oracle Messaging Cloud Service.

To create lightweight event processing microservices, you can use Kafka with Application Container Cloud Service by subscribing to Oracle Event Hub Cloud Service , which provides Apache Kafka.

Why Choose
Application Container Cloud Service?

The traditional server stack consists of physical servers and applications that run on a single operating system. The servers and applications are locked to the operating system, and it’s extremely tedious, if not impossible, to run applications on different operating systems, such as Linux and Windows. Migrating applications from one server to another requires your physical presence at data centers and is really time consuming.

The use of virtual machines has addressed some of the limitations of the physical server stack. Multi-tenancy and shared server resources have become commonplace with VMs, but resource allocation, vendor lock-in, narrow data pipes, and oversubscription issues undermine the benefits of VMs.

So, what’s the solution?

With containers, developers can focus on writing code without having to worry about hardware, environments, downtime, and maintenance. A container bundles the runtime environment for running an application and uses the kernel of the host operating system to run the applications.

Application Container Cloud Service provides a preconfigured environment to develop and deploy Java SE, Java EE, Node.js, PHP, Python, and Ruby applications to Oracle Cloud. The applications run in a Docker container. Application Container Cloud Service supports microservices architecture and allows for scalable applications.

Java SE
PHP
Python
Node.js
Ruby
Application Container Cloud Service
Oracle Cloud

How Do I Deploy an Application?

If you have an Oracle Cloud subscription, then you can deploy your own third-party software in Oracle Application Container Cloud Service. You can also configure a data source and connect your application to Oracle Database Cloud Service and then integrate your application with Oracle Developer Cloud Service and Oracle Storage Cloud Service.

To start using Application Container Cloud Service, buy a subscription of Oracle Application Container Cloud Service to automatically receive a subscription for Oracle Storage Cloud Service and Oracle Developer Cloud Service.

Before you deploy your application on Application Container Cloud Service, take note of the design considerations and replication policy. It’s important that you set the replication policy correctly to deploy your apps to Application Container Cloud Service.

To start deploying your Java SE, Java EE, Node.js, PHP, Python, or Ruby application:

1
Activate your Oracle Application Container Cloud Service and Oracle Storage Cloud Service, and set the replication policy for Oracle Storage Cloud Service.
2
Package your application for deployment to Oracle Application Container Cloud Service.
3
Create a new application or modify an existing application for this service. An existing application must be modified to read certain environment variables when it’s deployed. In addition, it needs a launch command and one or two metadata files.
4
Specify a database or cache for your application.
5
Deploy your application to the service:
6
Test your application remotely.
7
Manage your application.

Using the
Command-line Interface

Oracle offers a Platform as a Service (PaaS) command-line interface (CLI) that enables users of Oracle Cloud services to create, monitor, and manage their service instances from a command shell or a script. The CLI provides an alternative to using the web-based user interface.

The CLI is a thin wrapper over PaaS REST APIs that invokes these APIs to create and manage instances for Oracle Application Container Cloud Service and other PaaS features. The CLI also supports Oracle Cloud Stack Manager, a PaaS tool that automates the provisioning and deletion of cloud environments.

A powerful feature of CLI is that it allows you to deploy an application directly on Application Container Cloud Service by using the psm accs push command without having to create a container.

Learn more about using PSM CLI in the PaaS Service Manager Command Line Interface Reference.

Deploying Your Java SE Application on Oracle Application Container Cloud Service

If you’ve developed your Java application on Spring, Tomcat, or Jetty, then consider deploying your application on Application Container Cloud Service.

Deploying a Java application on Application Container Cloud Service primarily involves modifying the manifest.json file. Here are the high-level steps to deploy and run a Java SE application:

1
Compress the application in a zip or Gzipped Tar (TGZ) archive file, which includes required configuration information.
2
Deploy your application using the web interface, PSM CLI, or REST API.
3
Test and run your application, and manage the application instances by scaling up and scaling out. A clustered application can be scaled up by adding more memory and scaled out by adding more server instances.

Deploying Your Java EE Application on Oracle Application Container Cloud Service

You can deploy Java EE 7 .war files to Oracle Application Container Cloud Service. Deploying a Java EE application involves minimum changes to how it is packaged. You can deploy Java EE applications using the PSM CLI or REST API.

Prepare your Java EE application before deploying it on Oracle Application Container Cloud Service.

This tutorial shows you how to deploy a Java EE application to Oracle Cloud and connect to Oracle Database Cloud Service.

Deploying Your Node.js Application on Oracle Application Container Cloud Service

You can use any open-source or commercial Node framework to create applications and then deploy them to Oracle Application Container Cloud Service.

Oracle Application Container Cloud Service comes bundled with clustering and load-balancing features to run your Node.js application at an enterprise level. You can use a web interface, PLM CLI, or REST APIs to deploy your Node.js application.

Load balancers, provided with each container, continuously monitor the root of the Node.js application. If a Node.js instance stops responding, then the load balancer notifies the other instances to take the place of the failed instance. Failed Node.js instances are automatically restarted by Application Container Cloud Service.

To create and deploy your Node.js application:

1
Create a WebSocket server application with Node.js and a WebSocket client application with HTML5 and JavaScript.
2
Deploy the Node.js application to Oracle Application Container Cloud.
3
Connect the deployed service with HTML5 and the JavaScript client.

For more information about how to build and deploy your Node.js application, see these tutorials:

1
RESTful Node.js and HTML5 Application and Deploy to Oracle Application Container Cloud Service
2
RESTful API with Node.js and Express
3
RESTful Node.js Web Service with Oracle Database Enterprise Cloud Service

Deploying Your PHP Application on Oracle Application Container Cloud Service

You can build and deploy a PHP application in Application Container Cloud Service using these examples:

Deploying Your Python Application on Oracle Application Container Cloud Service

Oracle Application Container Cloud Service provides the framework to rapidly deploy Python applications. You can create a Python application, prepare the application for deployment, and then deploy the application to Oracle Application Container Cloud Service.

This tutorial shows you how to create a simple REST service in Python using the Flask framework and Oracle MySQL Cloud Service and how to deploy the application on Oracle Application Container Cloud Service.

Deploying Your Ruby Application on Oracle Application Container Cloud Service

Oracle Application Container Cloud Service provides a pre-configured environment to rapidly deploy Ruby applications.

Follow these steps to create a Ruby application and then deploy your application to Oracle Application Container Cloud Service.

What Does the Caching Feature Do in Oracle Application Container Cloud Service?

The caching feature accelerates access to data, shares data among applications, and offloads state management. It primarily enables low latency access to shared data across applications. The caching feature can be accessed from your application through the REST API. For Java SE applications, you can use a Java API.

Try the caching feature by creating a standalone web service with Jersey and Grizzly, and learn how to integrate the Application Container Cloud Service caching feature using the REST API.

Scenario: How Gluon CloudLink Uses Oracle Application Container Cloud Service to Host Its MBaaS Offering

Gluon CloudLink offers Mobile Backend as a Service (MBaaS) and is hosted on Oracle Cloud. An MBaaS contains a number of functions, and Gluon CloudLink implements these functions as a set of microservices. Each microservice is a stateless Java EE 7 application executed inside a Payara Micro server. Each microservice exposes its functionality using a set of REST endpoints that can be accessed by other microservices within the same network.

When Gluon CloudLink is deployed to Oracle Cloud, the microservices are deployed inside Application Container Cloud Service. Using a set of built-in features, Application Container Cloud Service handles the issues commonly encountered when deploying microservices in a clustered and scalable environment.

Getting Started

Here are the steps to replicate the Gluon CloudLink deployment.

Before you start deploying an application on Application Container Cloud Service, you must have an Oracle Cloud account. You can also subscribe to a 30-day Oracle Cloud Service trial account.

To sign in to Oracle Cloud, provide your user name, password, and domain identity details. Make a note of these details because you’ll need to provide this information later for the following parameters:

User name: ${USER_ID}
Password: ${USER_PASSWORD}
Identity Domain: ${ID_DOMAIN}
Note:
A domain has a name and an ID. Use the ID here.
Region: ${APAAS_HOST}

Note: If you’re accessing a data center in the United States, then the ${APAAS_HOST} parameter value is apaas.us.oraclecloud.com. If you’re accessing a data center in Europe, then the ${APAAS_HOST} parameter value is apaas.europe.oraclecloud.com .

These details are also required when you sign in to Oracle Cloud using REST APIs.

Deploying an Application on Oracle Application Container Cloud Service

In Application Container Cloud Service, a microservice is an application. Multiple applications can be deployed in an Application Container Cloud Service environment. The Gluon CloudLink provisioning tools install seven microservices, or applications, into the Application Container Cloud Service environment of the Oracle Cloud subscriber. An Application Container Cloud Service application is a zip file that contains the required code and resources to run the application, along with a manifest.json file that specifies the launch command Application Container Cloud Service should run and the Java version.

Here’s an example of the manifest.json file:

*Press and hold to copy

The runtime block states that the application will run on Java SE 8. The command block describes the command to be executed.

In this example, we have a simple application that requires a WAR file to be deployed inside the Payara Micro container. Both the payara-micro-4.1.1.164.jar file and the helloworld.war file must be included in these zip files:

manifest.json
payara-micro-4.1.1.164.jar
helloworld.war

Now, upload the zip file to Application Container Cloud Service. You can upload a zip file in one of three ways: by using the Application Container Cloud Service service console, PSM CLI, or a REST API call. The Gluon CloudLink Dashboard that provisions Gluon CloudLink to Oracle Cloud creates several REST calls using Java code. This example shows how REST calls are executed using the cURL command.

To load the zip file using the Application Container Cloud Service service console, sign in to Oracle Cloud and then:

1
Select Application Container Cloud.
2
Click Open Service Console.
3
Click Create Application to create a new application:
Enlarge
4
Select the application type. For this example, select Java SE.
Enlarge
5
Type a name for the application in the Create Application page.
Enlarge
6
Select Java SE because you’re deploying a Java SE application in this scenario.
7
Type a name for the application and select a subscription type.

Note: At this stage, you can decide about scalability. You can choose to have multiple instances for the service or you can scale up by adding more memory to a single instance.

For this example, upload the sample Java SE application using the REST API. To do that, you first upload the application to a container in Oracle Storage Cloud Service. Before an application can be uploaded to the container, ensure that a container exists.

Create a Container

Use this cURL command to create a container:

*Press and hold to copy

Upload the Application to the Container

After you create a container, upload the application to the container. The parameters used here are described in the Getting Started section. The result of this call is the creation of a storage container named hello.

Use this cURL command to create a container:

*Press and hold to copy

Finally, we can create the application on Application Container Cloud Service:

*Press and hold to copy

The Java SE application is now uploaded to Oracle Cloud and ready for use. The Application Container Cloud Service service console displays the URL that’s hosting the application.

This image shows the Gluon CloudLink data microservice uploaded to an Application Container Cloud Service container and made accessible using the URL emphasized:

Enlarge

The application must be accessed using HTTPS on the default port 443. Application Container Cloud Service forwards traffic it receives at port 443 to port 8080 of the deployed application (the default HTTP port for the Payara Micro server).

Communicating Between Applications

Until now, we’ve deployed only a single application on Application Container Cloud Service. As explained earlier, Gluon CloudLink contains a number of microservices that communicate with each other, and Application Container Cloud Service provides support for this configuration. Each microservice can be deployed as a separate application on Application Container Cloud Service and made accessible to other microservices deployed in the same container by using a simple HTTP request where the host name is the name of the application.

The only required change is the addition of the isClustered property to the manifest.json file that’s part of the application zip file.

Here’s the updated manifest.json file:

*Press and hold to copy

An application named hello can be accessed by other applications in the same host by using this URL:

https://<app_name>-<identity_domain>.apaas.<dc>.oraclecloud.com/endpoint

So, if the application helloworld.war is deployed at the helloworld URL and exposes a REST endpoint, say/hi, then that endpoint can be accessed by another application in the same Application Container Cloud Service environment by calling this URL:

http://hello:8080/helloworld/say/hi

Note: The application that’s exposing its endpoints and the application that’s calling that application must have the isClustered property set to true in their manifest.json files.

When a call is made by an application to access another application, the Oracle Cloud infrastructure routes the requests to the required application instance.

Binding to Database Services

Most enterprise applications need data persistence. Oracle Cloud provides the option to deploy Oracle Database or MySQL Database.

In Application Container Cloud Service, you can bind an application to a database service running in the same domain by adding a service binding. This allows the Gluon CloudLink microservices to bind with a database in Oracle Cloud. While an application is binding, the configuration details for connecting to the database are added as environment variables.

For the hello application example, let’s use Oracle MySQL Cloud Service. To install it, click Create Service to open the installation wizard.

Storing Data

Gluon CloudLink uses Java Persistence API (JPA) for storing relational data. Inside the microservice itself, a persistence.xml configuration file defines the name of the data source:

*Press and hold to copy

The link between the data source and the physical database is specified in the gcl-domain.xml file, where a jdbc-resource named jdbc/datasource is defined:

*Press and hold to copy

This resource now points to a pool named gluoncloudlink_mysql_jdbc_pool, which is defined as shown in the file gcl-domain.xml:

*Press and hold to copy

The values for the names in capitals in the example must come from the newly created MySQL service. Before the microservice can access that service, you must create a binding, which can be done manually from the service console using these steps:

1
Select the application.
2
Click Service Bindings.
3
Click Add.
4
Specify the type and the name of the service.

Using Oracle Cloud Stack Manager

Gluon CloudLink is a complex application containing a number of microservices deployed in Application Container Cloud Service together with one or more data storage services. Rather than creating and configuring the microservices individually, you can configure them together using Oracle Cloud Stack Manager. Oracle Cloud Stack Manager provides a template to create and configure multiple microservices as a group, which can be done using the user interface or through the REST API.

The template describes several services and allows parameters to be shared across services. While using a template makes it easier and more convenient to perform all steps in a single command, it adds complexity because some of the properties created by the services must be leveraged by other services.

This is especially true in the case of Oracle MySQL Cloud Service. However, to make things easier, the properties from Oracle MySQL Cloud Service are exposed as environment variables.

In the startup script for the microservices that use Oracle MySQL Cloud Service, you can replace the placeholders for the database properties with the generated environment variables.

Oracle MySQL Cloud Service adds the following environment variables:

MYSQLCS_CONNECT_STRING
MYSQLCS_MYSQL_PORT
MYSQLCS_USER_NAME

The custom gcl-domain.xml configuration file is updated before the Payara Micro server is started by using the environment variables that are provided by the service binding. This action implies that the start command for the application must be changed. Rather than immediately executing the Payara Micro server, you must start a shell script that first replaces the MySQL properties in the gcldomain.xml file with the properties provided by Oracle MySQL Cloud Service. Here’s an example of the shell script.

*Press and hold to copy

Note that the MySQL driver was added to the classpath. Remember to provide the gcldomain.xml file, which is the modified version of the built-in domain.xml file.

Summary

In the Gluon CloudLink scenario, we explained how to deploy an application consisting of many microservices to Oracle Cloud. We also explained how Oracle Cloud allows easy and scalable deployment of a Java SE application consisting of multiple microservices using Java EE APIs. While the instructions provided here might require some boilerplate code and configuration, as this scenario demonstrated, they can be easily combined into a script or a Java application.

Try It Yourself

Try deploying a Java SE or Node.js application using the steps in the lab:
Getting Started with Oracle Application Container Cloud for Java SE and Node Applications.

Free Cloud Trial