Skip to Content

Deploy Your Node.js App with the Cloud Foundry CLI

test
0 %
Deploy Your Node.js App with the Cloud Foundry CLI
Details
// Explore More Tutorials

Deploy Your Node.js App with the Cloud Foundry CLI

Prepare your Node.js app to be deployed to the SAP Cloud Platform with the Cloud Foundry command line interface.

You will learn

  • Which metadata needs to be specified to deploy the Node.js app to Cloud Foundry
  • How to check whether the application has successfully been deployed


Step 1: Create the manifest file

Create a manifest.yaml file in the nodetutorial directory. This file is the deployment descriptor and contains all required information to deploy an application to a SAP Cloud Platform Cloud Foundry instance.

Copy the following content to the recently created file:

---
applications:
- name: myapp
  random-route: true
  path: myapp
  memory: 128M

The property random-route will generate a route, which does not conflict with any other application in the same Cloud Foundry instance.

Explanation for the manifest properties:

Property Name Value
name The application name with which the application will be deployed on Cloud Foundry.
host Where the application (subdomain of the SAP Cloud Platform region) should be reachable.
path The path of the local file system from which the content/artifact has to be deployed.
memory The memory quota which should be allocated for this application.

Refer to the official documentation for more fields of the manifest file.

How can you create your manifest file?
×
Step 2: Push the app to your SAP Cloud Platform Cloud Foundry space

Make sure you are logged in to your SAP Cloud Platform Cloud Foundry endpoint cf login and navigate to your space via cf space <SPACE>). Execute the following command inside the nodetutorial directory:

cf push

The Cloud Foundry command line interface implicitly uses the manifest.yaml file to deploy the application. After the deployment process the status of the application should be displayed in the command line:

command line output app status
Log on to answer question
Step 3: Figure out the application URL

To open the application in a browser, there are two ways to figure out the according URL. You should see the URL in the console output when the deployment has completed.

deployment output app URL

Or you could generally access the application overview. It shows among other information the URL. Accessing the application overview is done via:

cf apps
application URL in application overview

Access the URL shown in this list. You should get a 'Hello World' response when accessing the web server at the according URL.

Log on to answer question

Next Steps

Back to top