Oracle by Example brandingDeploy a Node.js Application to Oracle Cloud

section 0Before You Begin

This 10-minute tutorial shows you how to create a basic Node.js application on Oracle Application Container Cloud Service.

Background

Oracle Application Container Cloud Service lets you deploy Java SE, Node.js, PHP, and Python applications to the Oracle Cloud.

What Do You Need?

Access to an instance of Oracle Application Container Cloud Service


section 1Create a Node.js Application

  1. Create the myapp.js file in your local system and add the following content:
    var http = require('http');
    // Read Environment Parameters
    var port = Number(process.env.PORT || 8080);
    var greeting = process.env.GREETING || 'Hello World!';
    var server = http.createServer(function (request, response) {
      response.writeHead(200, {"Content-Type": "text/plain"});
      response.end(greeting + "\n");
    });
    server.listen(port);
  2. Create the manifest.json file and add the following content:
    {
      "runtime":{
        "majorVersion":"6"
      },
      "command": "node myapp.js",
      "release": {},
      "notes": "Hello World application"
    }
    
  3. Open a command-line window and go to your project directory.
  4. Compress both the myapp.js and manifest.json files together in a .zip file:
    zip getting-started-node-accs.zip myapp.js manifest.json

section 2Deploy Your Application to Oracle Application Container Cloud

  1. Log in to Oracle Cloud at http://cloud.oracle.com/. Enter your account credentials in the Identity Domain, User Name, and Password fields.
  2. In the Oracle Cloud Services dashboard, click the Action menu Menu, and select Oracle Application Container Cloud Service.
  3. To open the Oracle Application Container Cloud Service console, click Services.
  4. In the Applications list view, click Create Application and select Node.
  5. In the Application section, enter a name for your application and click Browse.
  6. On the File Upload dialog box, select the getting-started-node-accs.zip file you created in the previous section and click Open.
  7. Keep the default values in the Instances and Memory fields and click Create.
  8. Wait until the application is created. The URL is enabled when the creation is completed.
  9. Click the URL of your application.
    NodeSample application response
    Description of the illustration node-app-response.png


more informationWant to Learn More?