Skip to Content

Deploy a Micro Service Built on YaaS on the SAP HCP


Deploy a Micro Service Built on YaaS on the SAP HCP

By Seyedehmorvarid Khademhaghighat

In this tutorial you will set up a cloud account on the HANA Cloud Platform through your YaaS project. You will then deploy your Tips micro service to the cloud and point your Storefront to it.

You will learn

You will learn how to deploy a micro service to the SAP HCP. As an example you will use the Tips micro service created in the Extend the YaaS Storefront’s Functionality tutorial. In order to deploy a micro service you will need to set up your Cloud Foundry Command Line interface and create a SAP HCP account. In the end you will run the micro service on the cloud.


  1. Run cf -v to see if you have the Cloud Foundry CLI installed. If not, download the Cloud Foundry CLI: Go to, and install Cloud Foundry’s CLI. Run cf from your command line to verify your installation.

    CF Command

  2. Set the Cloud Foundry CLI’s endpoint to SAP’s HCP address, by running the command: cf api

    CF Endpoint

  3. Go to Builder. Choose the YaaS Project which you created in the Getting Started with YaaS tutorial to subscribe to the HCP, starter edition for cloud foundry services (beta) package. This package allows you to develop, deploy and run services and applications.

    • Open your YaaS Projects Administration page.
    • Click Subscription, select + Subscription, select the Beta Worldwide tab, and subscribe to the package called HCP, STARTER EDITION FOR CLOUD FOUNDRY SERVICES (BETA) in there.
  4. Wait 10 seconds and your package will appear in Builder in your YaaS Project*. If your package did not appear, log out and back in to the YaaS Builder, find your project, and you should see SAP HANA Cloud Platform in your YaaS Project’s Menu on the left side of the page. Select the SAP HANA Cloud Platform menu and click Create to activate your HCP account. This will trigger the email mentioned in the next step.

  5. You should now get an email from HCP, guiding you through steps to activate your HCP account.

    NOTE: You can skip this step if you already have an HCP Account.

  6. You can then log in using the command cf login. After entering your credentials, your HCP Cloud foundry account will be ready to deploy to.

  7. Familiarize yourself with the manifest.yml file which is located on the root folder of your Tips Service in your folder (2)/yaasbite200. This is the file that instructs your Cloud Foundry CLI where and how to deploy your war file.

    NOTE: If you have skipped the tutorial Extend the YaaS Storefront’s Functionality, you can clone the Tips Micro Service with this command. git clone

  8. Ensure your deployment name is unique to you, by adjusting the name value in the file manifest.yml to for example yourNameTipsService. This will ensure that your application will not clash with other applications deployed to the same environment by other users.

    Name Value

  9. Run mvn -v to confirm that you have maven installed. If not, follow instructions on Apache Maven Website, and confirm that mvn -v then runs. Now build and package your micro service into a war file, by running the command mvn clean package from the folder (2)/yaasbite200.

  10. Push the war file to the cloud, by running cf push from the same location. This will use the information in manifest.yml to guide the deployment.

    NOTE: The default HCP settings require the secure, https protocol. Therefore you must use https for all calls to your deployed services and when accessing your website in the cloud @ https://

  11. Run cf apps to check whether the war file was successfully deployed and started and note the URL where it is running. It should be something like

    CF Apps

  12. Now that your service has been deployed to the cloud, you could access it directly from your StoreFront. However, YaaS is all about security, so instead we should register this service in the YaaS Builder, so that instead, we can access it via the YaaS Security Proxy. To register your service on YaaS:

    • Go to your YaaS Project’s page.
    • Select Services, select + Service and here you need to add the URL to your service on HCP:
    • Enter the other required fields and then click Save.

    Register Service

    • Click the Deploy button and you will see a Generated Proxy URL which is the URL to your service on YaaS. Calls to this address will be checked by the YaaS Security framework and only if okay, passed along to your service.

    NOTE: In order to access your service at the Generated Proxy URL you will need to acquire an Access Token. This is because all calls to a service on YaaS are secured. If you are interested to learn more about this please refer to YaaS Dev Portal.

  13. Now that you have deployed your service to the cloud, you need to tell your StoreFront about it. Open the file (1) site-config.js in yaas-storefront/public/js/app/shared and modify the baseUrl of the tipsEndpoint to point to the Generated Proxy URL found given in the previous step, giving you something like the code below. Rebuild your storeFront with grunt build, and restart the storefront with npm start. Your storeFront should now be communicating with your deployed service. Open your Chrome developer tools to observe the REST traffic and confirm that this is the case.

tipsEndpoint: {
                    // NEEDS_ADJUSTING : Define the end-point of your Tips Service e.g. http://localhost:8080
                    baseUrl: ''               


In this tutorial you learned how to deploy a micro service based on YaaS to the HANA Cloud Platform, and how to modify your storefront to communicate with it.

Next Steps

Updated 09/14/2016

Time to Complete

20 Min.



Next Steps

Back to top