Oracle by Example brandingDeploying an Express Application to Oracle Application Container Cloud Service

part 0Before You Begin

This Oracle By Example (OBE) lab shows you how to deploy an application to Oracle Application Container Cloud Service. For this lab, you use an Express application that accepts RESTful calls. You use REST calls to prepare a storage container and upload the application zip file. Then you deploy the application from the storage container, start the application, and test it.

Background

This lab demonstrates how easily you can deploy Express web applications to Oracle Application Container Cloud Service by using just REST API commands. By creating scripts to deploy and test applications without interacting with the Oracle Cloud user interface, you reduce your development time.

What Do You Need?


part 1Gather Credentials from Your Oracle Cloud Account

  1. Sign in to your Oracle Cloud account and change the temporary password.
  2. Log in to your Cloud instance.
  3. Click the Dashboard button.
  4. Click Customize Dashboard.
  5. Select Show for Application Container.
  6. Close the Customize Dashboard window.
  7. On the Application Container tile, select the Action Menu The Action Menu icon. and then select View Details.
  8. The Service Details view for Oracle Application Container Cloud
    Description of the illustration app_service_details.png
  9. Make note of your identity domain and the Application Container REST endpoint URL. You will use this REST Endpoint URL in the cURL scripts to replace app_endpoint in the cURL scripts. Enter the data here so you can cut-and-paste the cURL commands to your terminal window.
    • Identity domain and application endpoint URL (including the https://):
    • Cloud account user name and password:
    • Path to the zip file on your local machine:
    • /employee-node-service.zip

part 2Request an Oracle Storage Cloud Service Authentication Token

  1. Open a Git command-line window (or terminal in Linux).
  2. Request an authentication token for Oracle Storage Cloud Service.
  3. curl -v -i -X GET -H "X-Storage-User: Storage-:" -H "X-Storage-Pass: " https://.storage.oraclecloud.com/auth/v1.0
  4. Make note of the X-Auth-Token returned and use it to replace auth_token in the cURL scripts.
  5. < HTTP/1.1 200 OK
    < date: 1490207770283
    < X-Auth-Token: AUTH_tkfdf3867a44aff29a98cce8ad71c1e0f3
    < X-Storage-Token: AUTH_tkfdf3867a44aff29a98cce8ad71c1e0f3
    < X-Storage-Url: https://dataCenter.storage.oraclecloud.com/v1/Storage-identyDomain
    < Content-Length: 0
    < Server: Oracle-Storage-Cloud-Service

part 3Deploy Your Application to Oracle Storage Cloud Service

  1. Create a storage container where you will will upload the application zip file you downloaded.
  2. curl -i -X PUT -H "X-Auth-Token: auth_token" https://.storage.oraclecloud.com/v1/Storage-/employee-service

    If your authentication token isn't valid, or if it expired, the service returns an HTTP response with the status code 401, and the requested operation fails. Repeat Request a Storage Cloud Authentication Token.

  3. Before you can deploy your application, you must copy it to the storage service. You need your Oracle Cloud service credentials (user name, password, identity domain) to use the REST API. With your credentials, create cURL commands to upload your application to the storage service.
  4. curl -i -X PUT -u : https://.storage.oraclecloud.com/v1/Storage-/employee-service/employee-node-service.zip -T /employee-node-service.zip
  5. Deploy the zip file in the Storage Service container to the Oracle Application Container Cloud Service.
  6. curl -i -X POST -u : -H "X-ID-TENANT-NAME:" -H "Content-Type: multipart/form-data" -F "name=employee-service" -F "runtime=node" -F "subscription=Monthly" -F "archiveURL=employee-service/employee-node-service.zip" -F "notes=Node employees REST service application" /paas/service/apaas/api/v1.1/apps/

part 4Start the Application

  1. Start the application.
  2. curl -i -X POST -u : -H "X-ID-TENANT-NAME:" /paas/service/apaas/api/v1.1/apps//employee-service/start
  3. If your service displays the following failed message, wait about a minute and then restart the application.
  4. "status": "Failed",
     "details": {"message": "Unable to update application [identityDomain] for identity domain [{1}]. Try again after sometime and if the issue persist contact oracle support."
  5. Copy the webURL from the result.
    { ... "webURL":"https://employees-service-identityDomain.apaas.dataCenter.oraclecloud.com","message":[]}

part 5Test your service

  1. Open a web browser and enter the REST endpoint URL for the employee service.
  2. webURL/employees
    Firefox window - Employees Service
    Description of the illustration testing_01.png
  3. To access the front end application, remove "employees" from the URL.
  4. Employees client - Search page
    Description of the illustration testing_02.png

    Enjoy experimenting with this application!


Want to Learn More?