This is a continuation from Part-1: CAPM Basics – Part 1
Hello Colleagues,
This blog will guide you on how to deploy your CAP application on the cloud environment.
From your subaccount Instances and Subscriptions page, click on Create.
Create a “SAP HANA Cloud” service with the “tools” plan as shown below.
Open your SAP HANA Cloud application by clicking on the link as shown below.
When your application opens, you will either see the below error or your application will not open in the first place.
In order to resolve this, come back to your subaccount, click on Users and for your username assign the additional Role Collections required for SAP HANA Cloud.
Once the above roles are added, logout, login and open your SAP HANA Cloud application once more (delete browser cache if same issue persists). Now we will create a hana instance.
Click on Create.
Sign in to your Cloud Foundry account.
Once signed in, you will be able to choose your dev space inside your organization where you want to create your hana instance. Upon selecting space, click on Next Step.
Give your DB instance a name and assign credentials. Click on Next Step.
Use the default memory and storage for provisioning your DB instance. Click on Next Step.
Click on Next Step.
Select the options as shown below and click on Next Step.
Click on Review and Create.
Click on Create Instance.
Hana DB instance is created successfully.
Now create a hdi-container as shown below.
Now let us prepare to deploy our application to cloud.
Run the commands “cds add hana –for production” and “cds add xsuaa –for production” as shown below. We will not add any role-templates/scopes to our xsuaa file in this blog.
We will be using a MTA based deployment, so add a mta feature as shown below.
In the mta.yaml file update the following command from “npm ci” to “npm i” as shown below.
Now run “cds build –production”. All the necessary files required for production deployment are generated in the “gen” folder as shown below.
Now right-click on the mta.yaml file and select “Build MTA Project”. This creates the mtar file which will be used to deploy all the artifacts to the cloud.
Now do a “cf login” to login to your organization and dev space and then right-click on the mtar file and click on “Deploy MTA Archive”.
Upon successful deployment, you should be able to see the following instances created.
Now its time to test our application.
From your simple_proj-srv application deployed in your dev space, make a note of the application route url.
Now click on Environment Variables and make a note of the XSUAA “url”, “clientid” and “clientsecret” key values. These will be used to authenticate our service.
Open Postman and create a new HTTP GET request. We will use oAuth 2.0 Client Credentials as authentication type.
Append your application route url with the /<service_type>/<service_name>/<entity_name>.
Use the XSUAA url, clientid and clientsecret for your oAuth authentication. Please remember to append the url with /oauth/token to generate the token.
Use the generated token and send the GET request. You will get back the data from the HANA db deployed on cloud.
Now change the HTTP verb to POST and post an object to the DB.
Now we will manually login to our HANA DB and validate this data.
Once signed in, you will be able to see the deployed DB instance.
You will see this error. Keep refreshing periodically.
Once available, you can validate the data that we posted previously.
This concludes Part-2 of our CAPM Basics series. If you have any questions, feel free to leave a comment below.
This is a continuation from Part-1: CAPM Basics – Part 1 Hello Colleagues,This blog will guide you on how to deploy your CAP application on the cloud environment.From your subaccount Instances and Subscriptions page, click on Create.Create a “SAP HANA Cloud” service with the “tools” plan as shown below.Open your SAP HANA Cloud application by clicking on the link as shown below.When your application opens, you will either see the below error or your application will not open in the first place.In order to resolve this, come back to your subaccount, click on Users and for your username assign the additional Role Collections required for SAP HANA Cloud.Once the above roles are added, logout, login and open your SAP HANA Cloud application once more (delete browser cache if same issue persists). Now we will create a hana instance.Click on Create.Sign in to your Cloud Foundry account.Once signed in, you will be able to choose your dev space inside your organization where you want to create your hana instance. Upon selecting space, click on Next Step.Give your DB instance a name and assign credentials. Click on Next Step.Use the default memory and storage for provisioning your DB instance. Click on Next Step.Click on Next Step.Select the options as shown below and click on Next Step.Click on Review and Create.Click on Create Instance.Hana DB instance is created successfully.Now create a hdi-container as shown below. Now let us prepare to deploy our application to cloud.Run the commands “cds add hana –for production” and “cds add xsuaa –for production” as shown below. We will not add any role-templates/scopes to our xsuaa file in this blog.We will be using a MTA based deployment, so add a mta feature as shown below.In the mta.yaml file update the following command from “npm ci” to “npm i” as shown below. Now run “cds build –production”. All the necessary files required for production deployment are generated in the “gen” folder as shown below.Now right-click on the mta.yaml file and select “Build MTA Project”. This creates the mtar file which will be used to deploy all the artifacts to the cloud.Now do a “cf login” to login to your organization and dev space and then right-click on the mtar file and click on “Deploy MTA Archive”. Upon successful deployment, you should be able to see the following instances created.Now its time to test our application. From your simple_proj-srv application deployed in your dev space, make a note of the application route url.Now click on Environment Variables and make a note of the XSUAA “url”, “clientid” and “clientsecret” key values. These will be used to authenticate our service.Open Postman and create a new HTTP GET request. We will use oAuth 2.0 Client Credentials as authentication type.Append your application route url with the /<service_type>/<service_name>/<entity_name>.Use the XSUAA url, clientid and clientsecret for your oAuth authentication. Please remember to append the url with /oauth/token to generate the token.Use the generated token and send the GET request. You will get back the data from the HANA db deployed on cloud.Now change the HTTP verb to POST and post an object to the DB.Now we will manually login to our HANA DB and validate this data.Once signed in, you will be able to see the deployed DB instance. You will see this error. Keep refreshing periodically.Once available, you can validate the data that we posted previously.This concludes Part-2 of our CAPM Basics series. If you have any questions, feel free to leave a comment below. Read More Technology Blogs by Members articles
#SAP
#SAPTechnologyblog