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.