Technical Articles
Simple steps to deploy your CAP project to HANA cloud
I have come through some troubleshooting steps while deploying my CAP project to HANA cloud and it helped me with the below steps to deploy CAP project to HANA cloud.
I assume you have created Cloud application project successfully in Business application studio using (File => New project template) and HANA cloud trial instance is created in cloud foundry. CDS views, OData services are activated.
- Through new terminal command if you run CDS Watch command, initially it will connect to Sqlite in memory database by default.
2.In order to switch the connectivity to Hana cloud, Add the following line in the “cds” section in package.json.
3.Build your project
Stop your running cds process with CTRL+C if it’s already running.
a. export NODE_ENV=production
After this command runs successfully, execute : cds build/all –clean
This command will build all of the relevant HANA artifacts and place them in a newly created folder that you should now see called gen. If you expand it, you should see 2 folders DB and SRV. As you might expect, if you drill into the DB folder, you will see the HANA DB artifacts and if you drill into the SRV, there are new files in there as well.
b. Create HDI container and deploy objects.
(1)create the HANA Deployment Infrastructure (HDI) container on Cloud Foundry
cf create-service hana hdi-shared Pal-db
(2)deploy the HANA Artifacts
cf push -f gen/db -k 256M
(3)deploy the SRV Artifacts
cf push -f gen/srv –random-route -k 320M
Make sure HANA trial cloud instance is in running status.
Check in DB explorer if HDI container is showing there.
Now Run your CDS watch command in terminal.
OData service deployed on SAP HANA cloud.
Congratulations! Your Hana DB is connected and CAP project with OData service is deployed in HANA cloud as a persistence layer.
Hi Om Prakash Jha,
Great blog post.
I have an query, while I am trying to deploy the db into HANA on my trial BAS, I am encountering the below error. Could you please help me?
-------------------------------------------------------------------------------------------------------------
[ERROR] [cds.deploy] - Services not found
at HanaDeployer._getCfServiceName (/home/user/projects/projects/cloud-cap-samples/node_modules/@sap/cds/bin/deploy/to-hana/hana.js:197:15)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async HanaDeployer.deploy (/home/user/projects/projects/cloud-cap-samples/node_modules/@sap/cds/bin/deploy/to-hana/hana.js:128:27)
at async Object.deploy (/home/user/projects/projects/cloud-cap-samples/node_modules/@sap/cds/bin/deploy/index.js:76:5)