Before You Begin
Purpose
This tutorial shows you how to deploy an application to Oracle Application Container Cloud Service.
Time to Complete
30 minutes
Background
Oracle Application Container Cloud Service can deploy and run Java Platform, Standard Edition (Java SE) and Node.js applications. First, to deploy your application, you compress the application in a zip or Gzipped Tar (TGZ) archive file, which includes required configuration information. Then, you use the Oracle Application Container Cloud Service graphical user interface (GUI) or the REST API to deploy your application.
In this tutorial, you can use your own application archive or you can use the provided sample embedded Tomcat web application as the archive file.
Context
This tutorial covers deploying applications to Oracle Application Container Cloud Service. To deploy your application correctly, you must first develop and package it according to specific guidelines, which are explained in the following learning series. Select the learning series that most closely matches the application and framework that you want to create.
- Java SE: Building and Deploying Java SE Applications on Oracle Application Container Cloud Service Learning Series
- Node.js: Building and Deploying Node.js Applications on Oracle Application Container Cloud Service Learning Series
What Do You Need?
- cURL command-line tool (to deploy an application with the REST API)
- Sample embedded Tomcat web application
Deploying Your Application: Web GUI
-
Package your own application in a zip or TGZ file or download the sample embedded Tomcat web application.
-
Log in to Oracle Application Container Cloud Service with your credentials.
Description of this image The Applications list view is displayed. The picture shows the first time the Applications List is loaded. The view provides additional links and an arrow icon indicating which button to click to get started.
Description of this image -
Click Create Application, and select Java SE.
Description of this image -
In the Create Application dialog box, enter
EmployeeWebApp
for the application name, select Monthly for the subscription type, and enterSample Tomcat application
in the Notes field. For the Application Archive field, select Upload Application Archive.Description of this image The Create Application dialog now looks like this. Click the Browse button and select
employees-web-app.zip
file.Description of this image -
The Create Application dialog now shows the selected file. Under Instance, review the number of instances and the memory size, and make any necessary adjustments. Click Create to deploy your application to Oracle Application Container Cloud Service.
Description of this image -
After the application archived is uploaded, the service determines the archive is properly configured. If it is, the following dialog appears. Click OK.
Description of this image
A status message appears indicating the application is uploading.

The Applications page appears. A "Creating Application" status message is displayed at the top of the page while the application is deployed. It will take several minutes for the application to deploy.

After a few minutes, your application is deployed on the Oracle Application Container Cloud Service. The status message disappears showing the application Overview.

Exploring the GUI for Oracle Application Container Cloud Service
After you configure and deploy the application through the web GUI, you’ll see configuration views that give you options and information about your current settings.
Overview View
This view is the default view for an application. It shows the number of running instances, instance memory size, instance metadata (for example, the time that the instance was started), and application metadata (for example, Java version, date and time deployed, and identity domain):

Deployments View
This view shows information about the current
application’s deployment. The view focuses on
configuration data which includes application
metadata (for example, archive name and archive
size), service bindings to other cloud services,
global environment variables, the launch command
for your instances, and the configuration files
for each application instance (the manifest.json
and deployment.json
files are
linked here).

Administration View
The Administration View allows you to manage the underlying technology version you are using for your application. In this case, the tab allows you to choose the Java version you are using. You can upgrade to a new version of Java or roll back to an older version.

Logs & Recordings View
This view stores application-related log and performance information.
On the Logs tab, you can generate the log file from your instances and then download it to your local machine. You can also view a history of log captures.

On the Recordings tab, you can use Java Flight Recorder to record one minute of your application’s performance data, download the recording to your local machine, and analyze it in Java Mission Control.

Deploying Your Application: REST API
In this section, you deploy your Java SE application to Oracle Application Container Cloud Service by using the REST API. For this deployment, use the cURL command-line tool, which runs on any major operating system (Windows, Mac OS X, or Linux). You can use your own application archive or you can download the sample embedded Tomcat web application, if you haven’t already downloaded it.
Here are the steps needed to deploy your application:
- Upload your application to the storage service.
- Deploy your application to Oracle Application Container Cloud Service.
Uploading Your Application to the Storage Service
Before you can deploy your application, you must copy it to the storage service. You need your Oracle Cloud service credentials (User ID, password, ID domain) to use the REST API. With your credentials, you create cURL scripts to upload your application to the storage service.
Here are sample values that are used in the cURL script examples that follow. You'll use your own values instead of the sample values if you upload your own application.
- App Name:
EmployeeWebApp
- Archive File Name:
employees-web-app.zip
- Path to Local File:
target/employees-web-app.zip
- User Name:
johndoe
- Password:
johnpassword
- Identity Domain:
john-acct01
- Host Name:
apaas.us.oraclecloud.com
This example shows the script structure that creates a storage container:
# CREATE STORAGE CONTAINER
curl -i -X PUT \
-u User-Name:Password \
https://hostname/v1/Storage-Identity-Domain/App-Name
After you create the storage container, you can upload your application archive to the storage container.
This example shows the script structure that uploads 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
This example script uses the provided sample values to create the storage container:
# CREATE STORAGE CONTAINER
curl -i -X PUT \
-u johndoe:johnpassword \
https://storage.oraclecloud.com/v1/Storage-john-acct01/EmployeeWebApp
This example script uses the provided sample values to upload the sample application to the storage service:
# PUT ARCHIVE IN STORAGE CONTAINER
curl -i -X PUT \
-u johndoe:johnpassword \
https://storage.oraclecloud.com/v1/Storage-john-acct01/EmployeeWebApp/employees-web-app.zip -T target/employees-web-app.zip
Deploying Your Application to Oracle Application Container Cloud Service
To deploy your application, you need to include standard information in your script. The following example script shows placeholders for the required information:
# 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 "deployment=@deployment.json" \
-F "archiveURL=App-name/Archive-File-Name" \
-F "notes=Your Notes here" \
https://hostname/paas/service/apaas/api/v1.1/apps/Identity-Domain
Here are a few key points about this example:
-H
specifies headers that are added to the HTTP request.-F
allows cURL to submit data like it's coming from a form (so,POST
as the HTTP method).archiveURL
specifies where your archive file is located. The URL consists of your application's name, a slash, and the archive's file name.
Note: Rather than using default values for your application, you can specify the deployment.json file at deployment.
Here's a sample deployment script that contains
actual data, including the deployment.json
file:
# Deployment Script
url -i -X POST \
-u johndoe:johnpassword \
-H "X-ID-TENANT-NAME:john-acct01" \
-H "Content-Type: multipart/form-data" \
-F "name=EmployeeWebApp" \
-F "runtime=java" \
-F "subscription=Monthly" \
-F "deployment=@deployment.json" \
-F "archiveURL=EmployeeWebApp/employees-web-app.zip" \
-F "notes=REST app for testing" \
https://apaas.us.oraclecloud.com/paas/service/apaas/api/v1.1/apps/john-acct01
After your application is deployed to Oracle Application Container Cloud Service, view any application details in the web GUI.
Specifying the deployment.json File
When you deploy your application, you can
reference a deployment.json
file.
The file provides configuration settings for the
container that your application runs in. The
settings include the memory size of the
application and specific information about the
environment.
Example deployment.json
File
{
"memory": "2G",
"instances": "1",
"environment": {
"NO_OF_CONNECTIONS":"25",
"TWITTER_ID":"JAVA"
},
"services": [{
"identifier": "ProdService",
"name": "Jaas Service",
"type": "JAAS"
"username": "username",
"password": "***"
}]
}
JSON Fields
memory
defines the size of the applications container. Valid values are 1G to 7G.instances
are the number of application instances to run.notes
are notes about the deployment plan.environment:
key
is the name of an environment variable that the application uses.value
is the value of the environment variable that the application uses.
services:
identifier
is the user-defined name.name
is the name of the service.type
is the type of service.username
is the name used to access the service (optional).password
is the password for the service (optional).
Here's the actual deployment.json
file used for an application:
{
"memory": "2G",
"instances": "1",
"environment":{
"TEST_ENV_VAR": "TestValue"
}
}
When you deploy the application, just reference the file in the cURL script. Then the file's settings are used to deploy the application.
Updating Your Application: REST API
Updating your Configuration with deployment.json
To update your application's deployment configuration, execute a command like the following:
curl -X PUT \
-u johndoe:johnpassword \
-H "X-ID-TENANT-NAME:john-acct01" \
-H "Content-Type: multipart/form-data"\
-F deployment=@deployment.json" \
-F "notes=notes for deployment" \
https://apaas.us.oraclecloud.com/paas/service/apaas/api/v1.1/apps/john-acct01/EmployeeWebApp
In the URL, the identity domain and the
application’s name specify what is updated. The
deployment.json
file contains your
changes to the configuration. Changes restart
your application or start new instances.
Redeploying your Application
To update the entire application, use the following command:
curl -X PUT \
-u johndoe:johnpassword \
-H "X-ID-TENANT-NAME:john-acct01" \
-H "Content-Type: multipart/form-data"\
-F "deployment=@deployment.json" \
-F "archiveURL=/EmployeeWebApp/employees-web-app.zip" \
-F "notes=notes for deployment" \
https://apaas.us.oraclecloud.com/paas/service/apaas/api/v1.1/apps/john-acct01/EmployeeWebApp
In the URL, the identity domain and the
application’s name specify what is updated. The
deployment.json
file contains your
changes to the configuration, but the file isn’t
required. If you don’t want to change the
deployment settings, don’t specify a file. In
this case, your application restarts.
Want to Learn More?
Credits
Curriculum Developer: Michael Williams