Skip to Content

How to define Dynamically HOST in YAML File

Dear Experts,

Can someone please let me know how to define HOST name dynamically in YAML File.

Currently , I need to change host name once for Development before deploying to Development , and I need to change host name to Qua before deploying to Quality and to PRD before deploying to Production server.

Is there any parameter like $host to dynamically do this job in YAML File

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jul 22, 2020 at 06:32 PM

    Hi Raja VT,

    What do you mean? You mean you already have an MTAR file and you want to deploy it diferente spaces and you want to change the hostname used by the application? Is this what you need?

    If so, you can manage this by using the mtaext file:

    https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.02/en-US/51ac525c78244282919029d8f5e2e35d.html

    You can find an example on how to use it here:

    https://blogs.sap.com/2018/05/03/deploying-a-mtar-application-on-sap-cloud-platform-cloud-foundry-account-with-a-dedicated-hana-database-and-multiple-tenant-databases/

    Please note, that this example is not the same as you require to use. It is just as a reference so you can understand how the mtaext works and how your can override some of the parameters used in your mta.yaml file.

    Best regards,
    Ivan

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Raja VT,

      That's exactly what the mtaext file does. It allows you to send a push command to CF with the same MTAR file (without changing the MTA.yaml file in it) and at the same time, the final yaml used will be merged. Therefore, your mtaext file will have host QAS-APPNAME whereas your MTAR will have DEV-APPNAME as default. When you deploy it to dev space you don't supply an mtaext whereas when you deploy it to qas space, your supply it. The same works for prd space.

      AFAIK there is no environment variables during deploy-time that you could use to make the host parameter take the organization and space into account when determining the url to be used.

      You could also add a route to each application via command line - according to your criteria - via a deployment script. You could disable the application startup and have the yaml file without any routes assigned to your application. And on the script, you could push the app, add a route and start it. On this case you would have a specific script for each environment.

      Best regards,
      Ivan

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.