Before 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?
- Access to an instance of Oracle Application Container Cloud Service
- A storage replication policy for your service instance.
- Git (Git CMD shell to execute cURL commands)
- employee-node-service.zip downloaded to your local directory
Gather Credentials from Your Oracle Cloud Account
- Sign in to your Oracle Cloud account and change the temporary password.
- Log in to your Cloud instance.
- Click the Dashboard button.
- Click Customize Dashboard.
- Select Show for Application Container.
- Close the Customize Dashboard window.
- On the Application Container tile, select the Action Menu
and then select View Details.
- 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

Request an Oracle Storage Cloud Service Authentication Token
- Open a Git command-line window (or terminal in Linux).
- Request an authentication token for Oracle Storage Cloud Service.
- Make note of the X-Auth-Token returned and use it to replace
auth_token
in the cURL scripts.
curl -v -i -X GET -H "X-Storage-User: Storage-:" -H "X-Storage-Pass: " https://.storage.oraclecloud.com/auth/v1.0
< 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
Deploy Your Application to Oracle Storage Cloud Service
- Create a storage container where you will will upload the application zip file you downloaded.
- 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.
- Deploy the zip file in the Storage Service container to the Oracle Application Container Cloud Service.
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.
curl -i -X PUT -u : https://.storage.oraclecloud.com/v1/Storage-/employee-service/employee-node-service.zip -T /employee-node-service.zip
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/
Start the Application
- Start the application.
- If your service displays the following
failed
message, wait about a minute and then restart the application. - Copy the
webURL
from the result.{ ... "webURL":"https://employees-service-identityDomain.apaas.dataCenter.oraclecloud.com","message":[]}
curl -i -X POST -u : -H "X-ID-TENANT-NAME:" /paas/service/apaas/api/v1.1/apps//employee-service/start
"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."
Test your service
- Open a web browser and enter the REST endpoint URL for the employee service.
- To access the front end application, remove "employees" from the URL.
webURL/employees


Enjoy experimenting with this application!
Want to Learn More?
- Node.js website nodejs.org
- Using Oracle Application Container Cloud Service