cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy complete app (with UI to the SCP)

former_member624584
Participant
0 Kudos

Hi guys,

with the openSAP CAP course I was able to deploy the bookshop from (week 3 - unit 4) manually as well as an MTA. I wanted to extend the app by providing the UI and therefore I tried to deploy the UI part as well. Hence, I changed the version in the 'mta.yaml' and copied some lines from the generated mta.yaml file regarding the app (from week3 - unit 5), resulting with the following file:

## Generated mta.yaml based on template version 0.2.0
## appName = capire-bookshop
## language=nodejs; multiTenant=false
## approuter=
_schema-version: '3.1'
ID: sap.capire-bookshop
version: 1.0.1
description: "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages."
parameters:
  enable-parallel-deployments: true
  
  
build-parameters:
  before-all:
   - builder: custom
     commands:
      - npm install
      - npx cds build

modules:
 # --------------------- SERVER MODULE ------------------------
 - name: capire-bookshop-srv
 # ------------------------------------------------------------
   type: nodejs
   path: gen/srv
   properties:
     EXIT: 1  # required by deploy.js task to terminate 
   requires:
    # Resources extracted from CAP configuration
    - name: capire-bookshop-db
   provides:
    - name: srv-binding      # required by consumers of CAP services (e.g. approuter)
      properties:
        srv-url: ${default-url}

 # -------------------- SIDECAR MODULE ------------------------
 - name: db
 # ------------------------------------------------------------
   type: hdb
   path: gen/db  
   parameters:
     app-name: capire-bookshop-db  
   requires:
    # 'hana' and 'xsuaa' resources extracted from CAP configuration
    - name: capire-bookshop-db

  ##############    APP   #########################
 - name: capire-bookshop-app
   type: nodejs
   path: gen/app
   parameters:
      memory: 256M
   build-parameters:
     requires:
       - name: capire-bookshop-srv


resources:
 # services extracted from CAP configuration
 # 'service-plan' can be configured via 'cds.requires.<name>.vcap.plan'
# ------------------------------------------------------------
 - name: capire-bookshop-db
# ------------------------------------------------------------
   type: com.sap.xs.hdi-container
   parameters:
     service: hanatrial  # or 'hanatrial' on trial landscapes
     service-plan: hdi-shared
   properties:
     hdi-service-name: ${service-name}



After building the mtar archive and trying to deploy the update I receive the following error:

Error staging application "capire-bookshop-app": StagingError - Staging error: No process types returned from stager

Did I miss some properties in the mta.yaml file?
What triggers the error and how can I resolve it?

Cheers,
Thorsten

Accepted Solutions (1)

Accepted Solutions (1)

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

Your MTA.yaml file doesn't look wrong. Can you double-check that a valid nodejs app (probably an approuter) is present in "gen/app"?

I developed a sample application a while ago that also includes a UI component. You can compare your app against that one: https://github.com/SAP-samples/cloud-foundry-cap-azure-cities/

former_member624584
Participant
0 Kudos

Hi mariusobert,

Thanks for the hint, your app looks great!

I just added the app-router (I copied it from the week 3 - unit 4 of the openSAP course). Defines the app router the different tiles displayed on the fiori launchpad?

The deployment of your app failed in my case as well. The error says:

>Creating service "azure-blob-storage" from MTA resource "azure-blob-storage"...
>Service operation failed: Controller operation failed: 404 Updating service "azure-blob-storage" failed: Not Found: Error creating service "azure-blob-storage" from offering "azure-storage-blob-storage-account-and-container" and plan "all-in-one": Service plan all-in-one not found
Do you have an idea for that error?
former_member624584
Participant
0 Kudos

* I meant week 3 - unit 5

* I tried to deploy your without the 'azure-blob-storage' but now the 'city-image-uploader' crashes immediately after it starts (which is the same behavior as with the deployed bookshop).

mariusobert
Developer Advocate
Developer Advocate
0 Kudos

In your case, it makes sense to deploy the app without the city-image-uploader via

cf deploy mta_archives/city-explorer-demo-app.mtar \
    -m city-cap-router \
    -m city-cap-db \
    -m  city-cap-srv \
    -r city-hdi-container

I'm not sure why you see the same error again. I assume this means that both projects (bookshop and cities) are valid and the issue might be your CF environment. Did you have a look at Stevens suggestion?

former_member624584
Participant
0 Kudos

Hi Marius,

I got your example working. For some reason I received an error when I tried you command. I solved it in my case by just commenting the not requires parts in the mta.yaml (as well as switch line 19&20). Moreover I had to delete the 'route/1' in the app-router (thanks cf logs).

I'm still wondering if there is a technical description of the mta.yaml file (explaining the single commands)?
Also I'm wondering why the build command doesn't generate a gen folder like its generated in the cap sample?

Here is the updated mta.yaml:

_schema-version: 3.3.0
ID: city-explorer-demo-app
version: 1.7.6
parameters:
  enable-parallel-deployments: true

build-parameters:
  before-all:
    - builder: custom
      commands:
        - npm install
        - npx cds build

modules:
  - name: city-cap-router
    type: approuter.nodejs
    path: app
    deployed-after:
      - city-cap-srv
#      - city-image-uploader
    parameters:
      disk-quota: 256M
      memory: 256M
    requires:
      - name: srv_api
        group: destinations
        properties:
          forwardAuthToken: true
          strictSSL: false
          name: srv_api
          url: ~{url}
#      - name: uploader_api
#        group: destinations
#        properties:
#          forwardAuthToken: true
#          strictSSL: false
#          name: uploader_api
#          url: ~{url}
  - name: city-cap-db-deployer
    type: hdb
    path: db
    parameters:
      app-name: city-cap-db-deployer
    requires:
      - name: city-hdi-container
  - name: city-cap-srv
    type: nodejs
    path: srv
    provides:
      - name: srv_api
        properties:
          url: ${default-url}
    requires:
      - name: city-hdi-container
#  - name: city-image-uploader
#    type: nodejs
#    path: uploader
#    parameters:
#      memory: 512M
#      disk-quota: 512M
#    provides:
#      - name: uploader_api
#        properties:
#          url: ${default-url}
#    requires:
#      - name: azure-blob-storage
resources:
  - name: city-hdi-container
    type: com.sap.xs.hdi-container
    properties:
      hdi-container-name: ${service-name}
    parameters:
      service: hanatrial
      service-alternatives: ["hana"]
#  - name: azure-blob-storage
#    type: org.cloudfoundry.managed-service
#    parameters:
#      service: azure-storage-blob-storage-account-and-container
#      service-plan: all-in-one
#      config:
#        location: "northeurope"
#        resourceGroup: "SAPCloudPlatform"
#        accessTier: "Cool"



and the updated xs-app.json:
{
    "welcomeFile": "/webapp/",
    "authenticationMethod": "none",
    "routes": [{
        "source": "^/webapp/(.*)$",
        "target": "$1",
        "localDir": "webapp/"
    }, {
        "source": "^(.*)$",
        "target": "$1",
        "destination": "srv_api"
    }]
}


former_member624584
Participant
0 Kudos

That's the error I receive when I try the command for some of the modules:

>Detected new MTA version: "1.7.6"
>Version rule will be ignored, as the deployed MTA is in inconsistent state
>Error resolving merged descriptor properties and parameters: Modules city-cap-db, specified for deployment, are not part of deployment descriptor modules 
>Proceeding with automatic retry... (3 of 3 attempts left)
>Process failed.
mariusobert
Developer Advocate
Developer Advocate
0 Kudos

I'm glad you were able to make it run!

Your first question about the MTA.yaml field has been asked here recently. In short, you can check out these two links: link1, link2 (note the subpages of this page).

The CAP configuration (target) allows you to specify whether you want to have the "gen" folders in the project root or in each model, I prefer the second option. This is why you won't find a gen folder at the root of that project.

former_member624584
Participant
0 Kudos

Ah perfect, thanks a lot.


These links are great, exactly what I was looking for

Answers (3)

Answers (3)

0 Kudos

We are facing similar issue while deploying our java app. The logs throws the following message

2020-08-24T15:35:25.252+0000 [STG/0] ERR No start command specified by buildpack or via Procfile.
2020-08-24T15:35:25.252+0000 [STG/0] ERR App will not start unless a command is provided at runtime.

https://github.wdf.sap.corp/cap/issues/issues/5716

mariusobert
Developer Advocate
Developer Advocate

It seems like you face a different issue. To keep things separated, please open a new question and ask for help there.

0 Kudos

i faced the same problems. did you fixed it?? hope that you share with us if you find the issue

former_member624584
Participant
0 Kudos

yeah, its written in the comments of the answer...

I also have asked several questions regarding this topics but to keep it short; use 'cf logs yourApp' in order to receive the actual error and then to solve it or to get help on the error

Steven_UM
Contributor
0 Kudos

I had a similar issue at one point and it seemed somehow the processes were stalled due to previous correctly deployment failures.

So after doing a cf logoff and logging on again it worked fine.

I would also recommend opening a second session with cf logs capire-bookshop-app to watch the detailed deployment logs. That might give additional hints as well.

former_member624584
Participant
0 Kudos

Hi Steven,
Thanks for the hint. The logoff and login was not the problem (but its definitely worth keeping it in mind).

The cf logs command is great. It's way more detailed than to download the logs of the cf deploy command (in which I though it would not make a difference) .