cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy MTAR to another Subaccount fails (Hardcoded HANA database_id --> mta.yaml)

chathia
Explorer
0 Kudos

Hello experts,

System used: SAP Cloud Platform, Cloud Foundry

I have developed an MTA application composes of (HANA DB, Node.js, Java, UI5 etc.) in the developer subaccount and tested fine. However, I need to deploy the MTAR into the production subaccount, and while performing the steps, the deployment fails in the production subaccount.

The reason is: I have hardcoded the database_id (copied from the HANA DB service instance) in the mta.yaml (as per the openSap course documentation).

resources:
  - name: hdi_xxxxx
    parameters:
      config:
        schema: SCHEMA_XXXX
        database_id: slkdfjkd-ssdf-xxxx-xxxx-xxxxxxxxx
    properties:
      hdi-container-name_2: '${service-name}'
    type: com.sap.xs.hdi-container

Workaround: we have manually edit the mta.yaml (database_id) to enter the production HANA DB id and then build it and deploy to production sub account. After this step, we need to revert the changes back for the Dev/QA subaccount deployment.

Question: What is the right way to set the "database_id" like a mapping parameter etc., so that the deployment works for both Dev/QA Subaccount and Production subaccount, without manually changing it? Can you pls guide here?

Regards,

Chathia.

Accepted Solutions (1)

Accepted Solutions (1)

mariusobert
Developer Advocate
Developer Advocate

Those parameters aren't mandatory. You could leave it empty and the runtime will check if there is an existing database and created the mapping automatically.

Or do you have mulitple dbs in the repesctive spaces?

chathia
Explorer
0 Kudos

Thanks Marius! It worked fine after commenting out database_id..

For understanding better.. For example: if we have 2 databases in the same space, do we need to manually change this database_id while deploying to another subaccount each time?

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

Hi,

I'm glad it worked! I've actually never been in this situation, so I don't know for sure. Maybe it's possible to define the HaaS as a managed service in the mta.yaml and to pass the database id as a variable to the HDI container service.

Maybe someone else can provide more info.

sahud
Participant
0 Kudos

Hi Marius,


We have a situation where we have to use a hard-coded schema name since the schema name is always going to be same across all environments. But if the schema already exists, the next deployment fails with a "301: Unique Constraint error". Is it possible to have the same schema_name and deploy it to multiple times. Would the db deployer make sure not to create the schema if it already exists?

Below is the example setup I have

# -------------------- SIDECAR MODULE ------------------------
 - name: backend-db-deployer
# ------------------------------------------------------------
type: hdb
path: gen/db  
parameters:
buildpack: nodejs_buildpack
requires:
# 'hana' and 'xsuaa' resources extracted from CAP configuration
    - name: backend-db
    - name: backend-uaa
<br>resources:
# ------------------------------------------------------------
 - name: backend-db
# ------------------------------------------------------------
type: com.sap.xs.hdi-container
parameters:
shared: true
service: hana
service-plan: hdi-shared
config:
  schema: 'MYTESTSCHEMA'
properties:
hdi-service-name: ${service-name}
HDI_DEPLOY_OPTIONS:
auto_undeploy: true

Thanks in Advance.

Deepak

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

Hi Deepak,

I'm afraid I don't know the answer. Please open a new question for this so that others see it too.

sahud
Participant
0 Kudos

Thanks Marius,
Will open a new question on this.

Answers (1)

Answers (1)

Hi Chathia,

You can use MTA extension descriptors that adjust the MTA depending on the env - dev/qual/prod.
Extension descriptors will have specific parameters for different accounts, such is database_id, or service plans, etc.
More information:
https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/50df803465324d36851c79fd07e...

Best Regards,
Boyan