The fastest way to a deployable CAP app on SAP BTP Cloud Foundry

So, you have developed your CAP app locally and are wondering: What’s the fastest way to get this on the BTP?

Or, if you are like me, you sometimes want to try something out in a deployed version quickly.

Even if things are running smoothly in your local environment, correctly binding and bundling everything up into a working cloud app, that is connected to the database, handles authorization etc. can be cumbersome.

However, CAP has a few tools, that simplify this a lot.

For me the shortest way to get an application deployed is the following:

After logging on to cf using the cli with 

 

cf l –sso

 

I execute the following in the shell:

 

cds init fast_deploy
cd fast_deploy
cds add sample
cds add mta,hana,xsuaa –for production
cds add workzone
npm i
npm i –prefix app/admin-books
npm i –prefix app/browse
mbt build -t gen –mtar mta.tar
cf deploy gen/mta.tar

 

 Given that there is a working BTP subaccount configured with the correct entitlements as well as HANA Cloud and Workzone ready, this will:

Line1: Initialise a new empty CAP project

Line3: Add a sample application with domain model, service definition and two sample Fiori apps (if you are doing this in your own project you can as well just skip those initial three lines.)

Line 4+5: Let the cds dk add all the relevant configurations and specify

SAP HANA as the target databasexsuaa as the identity servicethe `mta.yaml` file which describes how all of this should be deployedSAP BTP Workzone as the entry page holding the tiles for your Fiori apps

Line 6-8: Installing the dependencies for the CAP app and the two Fiori apps.

Line 9: Building the MTA 

Line 10: Deploying it to Cloud Foundry

So, with 10 lines in the shell, we have created an app, added all dependencies, bundled it up and deployed it to the BTP.

All that is left is to configure the app to show up on the Workzone (updating the content channel, add the apps in the content manager and assign them to a role and a group) after which you can also access the Fiori apps.

And for getting rid of the application without manually removing service keys and instances, just use the following:

 

cf undeploy fast_deploy –delete-services –delete-service-keys

 

That’s it. For any developer who ever spent a few hours trying to manually adjust configurations in yaml or json files while getting a new error message after each redeployment… this should help make life easier 😀

All the best

Daniel

 

​ So, you have developed your CAP app locally and are wondering: What’s the fastest way to get this on the BTP?Or, if you are like me, you sometimes want to try something out in a deployed version quickly.Even if things are running smoothly in your local environment, correctly binding and bundling everything up into a working cloud app, that is connected to the database, handles authorization etc. can be cumbersome.However, CAP has a few tools, that simplify this a lot.For me the shortest way to get an application deployed is the following:After logging on to cf using the cli with  cf l –sso I execute the following in the shell: cds init fast_deploy
cd fast_deploy
cds add sample
cds add mta,hana,xsuaa –for production
cds add workzone
npm i
npm i –prefix app/admin-books
npm i –prefix app/browse
mbt build -t gen –mtar mta.tar
cf deploy gen/mta.tar   Given that there is a working BTP subaccount configured with the correct entitlements as well as HANA Cloud and Workzone ready, this will:Line1: Initialise a new empty CAP projectLine3: Add a sample application with domain model, service definition and two sample Fiori apps (if you are doing this in your own project you can as well just skip those initial three lines.)Line 4+5: Let the cds dk add all the relevant configurations and specifySAP HANA as the target databasexsuaa as the identity servicethe `mta.yaml` file which describes how all of this should be deployedSAP BTP Workzone as the entry page holding the tiles for your Fiori appsLine 6-8: Installing the dependencies for the CAP app and the two Fiori apps.Line 9: Building the MTA Line 10: Deploying it to Cloud FoundrySo, with 10 lines in the shell, we have created an app, added all dependencies, bundled it up and deployed it to the BTP.All that is left is to configure the app to show up on the Workzone (updating the content channel, add the apps in the content manager and assign them to a role and a group) after which you can also access the Fiori apps.And for getting rid of the application without manually removing service keys and instances, just use the following: cf undeploy fast_deploy –delete-services –delete-service-keys That’s it. For any developer who ever spent a few hours trying to manually adjust configurations in yaml or json files while getting a new error message after each redeployment… this should help make life easier 😀All the bestDaniel   Read More Technology Blogs by SAP articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author