cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Develop CAP, MTX, Extensions project in a team

htammen
Active Contributor
1,430

Hi,

we are developing a CAP MTX application in a team. In addition, our application uses MTX extensions.

Each developer is working on different features. Both the application logic and the database structures are therefore different for each developer.

How can we run this application locally and deploy the current development status from each local PC without losing the extensions contained in the database?

Since we use HANA native code in our application, local development with SQLite is out of the question.

I have visualised our scenario in the below graphic.

  • The application was deployed to the provider subaccount of the BTP.
  • We created a subaccount for each developer and subscribed the application in it.
  • In each tenant subaccount there is an HDI container for the runtime data and one for the metadata. The latter contains the information about the extensions.

Our requirements:

  1. we want to connect our application started locally with "cds run" to the runtime HDI container in the associated subaccount. This is already possible.
  2. We would like to deploy the current DB structures of the developer into the HDI container of the assigned subaccount with "cds deploy" without losing the extensions.

Any ideas on that? @Cap team: Is a solution for this already on your roadmap?


P.S.: I created this graphic with pyhon. see here for details.

View Entire Topic
martinfrick
Product and Topic Expert
Product and Topic Expert

Hi Helmut,

I cannot say anything about mtx but just tried a similar setup in our mtxs scenario. Assuming you're talking about consumer developed extensions (deployed via cds push), I was able to deploy into a dedicated tenant HDI container, replacing the respective credentials in the default-env.json file with the credentials taken from the service manager container instance.

That allowed me to do something like the following resulting in a deployment of db model changes still keeping the tenant-specific extensions.

cds deploy db --to hana --profile production --vcap-file default-env.json

Still, I assume the scenario is not 100% comparable, as in mtxs there's only one container per tenant and the META container as such does not exist anymore. Instead, SaaS consumer extensions are stored right within the tenant container in a separate table (as you can see below)

Yes I know, the usage of default-env.json is not the preferred way to go anymore, but it allowed me to deploy right into the tenant container for that scenario. Furthermore, I was able to provide additional deployment parameters in the default-env.json file (to ignore re-processing of cfg files in that case).

"HDI_DEPLOY_OPTIONS": { "auto_undeploy" : false, "include_filter" : ["src/" ]
}

Maybe not the most convenient approach like e.g., cds deploy -tenant xyz123 (which would be nice) but maybe it also solves your issue if upgrading to mtxs is a valid approach for you?

Greetings

Martin

htammen
Active Contributor
0 Likes

Hi martinfrick,

thank you very much. I'm just migrating to mtxs and will give it a try then.
Cause your approach sounds logical. I also already thought about tweeking the credentials of default-env.json and you just confirmed this. So I accepted your answer.

Thanks again for your fast support

BR Helmut

htammen
Active Contributor

Hi martinfrick,

I've migrated to mtxs now and copied the credentials of my tenant container to my default-env.json.

When I run "cds deploy db --to hana --profile hybrid --vcap-file default-env.json" (hybrid is configured equaly to production) I get this error:

[deploy] - Deploying to HANA from /home/helmut/projects/mtxtest/projects/nxe/gen/db
[deploy] - Using HDI deployer from /home/helmut/projects/mtxtest/projects/nxe/node_modules/@sap/hdi-deploy/library.js
[deploy] - Deployment ended at 2022-12-12 18:04:15

[deploy] - Error: no service definition found; there must be at least one service definition for the deployment target
  • I created only a VCAP_SERVICES: { "hana": ... entry in my default-env.json.
  • Then I tried a "hana" entry and a "service-manager" entry
  • At least I downloaded the entire VCAP_SERVICES from CF with `cf de myapp` and added the hana entry with the information from SMCTL list-bindings.
Nothing worked. I get the same error in all three cases.Any idea which service definition I'm missing?
martinfrick
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Helmut,

great to hear that you already work on the upgrade! The following "hana" definition in the default-env.json, did the job on my side (credentials shortened in the screenshot). Do you have all the additional default values for HDI containers like tags, labels aso.? Would need to check but maybe the hdi-deployer is selecting from the env variables based on labels...

Martin