在SAP BTP试用帐户部署SAP Fiori和CAPM应用程序时出现错误。

huangapple go评论88阅读模式
英文:

Error while deploying SAP Fiori and CAPM application in SAP BTP Trial Account

问题

I created a basic SAP CAP/Fiori application using BAS of SAP BTP, with HANA DB Instance created. It's working fine when I run it locally. However, during deployment to SAP BTP Trial Account, I encountered the issue/error below.

After deployment was completed with errors, the SAP CAP Service is working fine, only the SAP Fiori which is not working since an error was encountered during deployment.

Error encountered during deployment

Error starting application "Bookshop2": Some instances have crashed. Check the logs of your application for more information.
Download the application logs via the dmol command and check them for more information.
A step of the process has failed. Retrying it may solve the issue.
Proceeding with automatic retry... (3 of 3 attempts left)

Content of dmol(Logs)

Inside dmol, an error "Cannot open: No space left on device" was encountered.

Steps for deployment

Cds add hana –for production
Cds add xsuaa –for production
Cds add mta (Optional in case you don’t have it yet.)
Cds add approuter –for production
It will generate xs-app and default-env.json inside /app folder.
Npm install

Cds build –production
Mbt build -t gen –mtar mta.tar

cf login
cf deploy gen/mta.tar

Code Snippet

A code snippet use for creating a basic Fiori/CAP application.

mta.yaml

_schema-version: "3.1"
ID: Bookshop2
description: A simple CAP project.
version: 1.0.0
modules:
  - name: Bookshop2-srv
    type: nodejs
    path: gen/srv
    provides:
      - name: srv-api
        properties:
          srv-url: ${default-url}
    parameters:
      buildpack: nodejs_buildpack
    build-parameters:
      builder: npm-ci
    requires:
      - name: Bookshop2-db
      - name: Bookshop2-auth
  - name: Bookshop2-app-content
    type: com.sap.application.content
    path: .
    requires:
      - name: Bookshop2-repo-host
        parameters:
          content-target: true
    build-parameters:
      build-result: resources
      requires:
        - artifacts:
            - combookshopfioribookshop.zip
          name: combookshopfioribookshop
          target-path: resources/
  - name: combookshopfioribookshop
    type: html5
    path: app/bookshop
    build-parameters:
      build-result: dist
      builder: custom
      commands:
        - npm install
        - npm run build:cf
      supported-platforms:
        []

  - name: Bookshop2-db-deployer
    type: hdb
    path: gen/db
    parameters:
      buildpack: nodejs_buildpack
    requires:
      - name: Bookshop2-db

  - name: Bookshop2
    type: approuter.nodejs
    path: app/ # from cds.env.folders. Consider also cds.env.build.target -> gen/app
    parameters:
      keep-existing-routes: true
      disk-quota: 256M
      memory: 256M
    requires:
      - name: srv-api
        group: destinations
        properties:
          name: srv-api # must be used in xs-app.json as well
          url: ~{srv-url}
          forwardAuthToken: true
      - name: Bookshop2-auth
resources:
  - name: Bookshop2-repo-host
    type: org.cloudfoundry.managed-service
    parameters:
      service: html5-apps-repo
      service-name: Bookshop2-html5-srv
      service-plan: app-host
  - name: Bookshop2-destination-service
    type: org.cloudfoundry.managed-service
    parameters:
      config:
        HTML5Runtime_enabled: false
        init_data:
          instance:
            destinations:
              - Authentication: NoAuthentication
                Name: ui5
                ProxyType: Internet
                Type: HTTP
                URL: https://ui5.sap.com
            existing_destinations_policy: update
        version: 1.0.0
      service: destination
      service-name: Bookshop2-destination-service
      service-plan: lite
  - name: Bookshop2-db
    type: com.sap.xs.hdi-container
    parameters:
      service: hana
      service-plan: hdi-shared
  - name: Bookshop2-auth
    type: org.cloudfoundry.managed-service
    parameters:
      service: xsuaa
      service-plan: application
      path: ./xs-security.json
      config:
        xsappname: Bookshop2-${org}-${space}
        tenant-mode: dedicated
parameters:
  deploy_mode: html5-repo
  enable-parallel-deployments: true
build-parameters:
  before-all:
    - builder: custom
      commands:
        - npx -p @sap/cds-dk cds build --production

package.json

{
  "name": "Bookshop2",
  "version": "1.0.0",
  "description": "A simple CAP project.",
  "repository": "<Add your repository here>",
  "license": "UNLICENSED",
  "private": true,
  "dependencies": {
    "@sap/cds": "^6",
    "express": "^4",
    "hdb": "^0.19.0",
    "@sap/xssec": "^3",
    "passport": "^0"
  },
  "devDependencies": {
    "@sap/ux-specification": "^1.108.3",
    "sqlite3": "^5",
    "rimraf": "^3.0.2"
  },
  "engines": {
    "node": "^16"
  },
  "scripts": {
    "start": "cds-serve",
    "watch-bookshop": "cds watch --open bookshop/webapp/index.html?sap-ui-xx-viewCache=false",
    "undeploy": "cf undeploy Bookshop2 --delete-services --delete-service-keys --delete-service-brokers",
    "build": "rimraf resources mta_archives && mbt build --mtar archive",
    "deploy": "cf deploy mta_archives/archive.mtar --retries 1"
  },
  "sapux": [
    "app/bookshop"
  ],
  "cds": {
    "requires": {
      "[production]": {
        "db": {
          "kind": "hana-cloud"
        },
        "auth": {
          "kind": "xsuaa"
        },
        "approuter": {
          "kind": "cloudfoundry"
        }
      },
      "db": {
        "kind": "sql"
      }
    }
  }
}

db/domain-model.cds

namespace com.bookshop2;

entity Books {
    key ID  : Integer;
    title   : String(100);
    stock   :

<details>
<summary>英文:</summary>

I created a basic **SAP CAP/Fiori application** using BAS of SAP BTP, with HANA DB Instance created. It&#39;s working fine when I run it locally. However, during deployment to SAP BTP Trial Account, I encountered the issue/error below.

After deployment was completed with errors, the **SAP CAP Service** is working fine, only the **SAP Fiori** which is not working since an error was encountered during deployment.

**Error encountered during deployment**
---------------------------------------

```Starting application &quot;Bookshop2&quot;...
Error starting application &quot;Bookshop2&quot;: Some instances have crashed. Check the logs of your application for more information.
Download the application logs via the dmol command and check them for more information.
A step of the process has failed. Retrying it may solve the issue.
Proceeding with automatic retry... (3 of 3 attempts left)

Content of dmol(Logs)

Inside dmol, an error Cannot open: No space left on device was encountered.

######org.cloudfoundry.multiapps.controller.persistence.services.ProcessLogger########flowable-async-job-executor-thread-8326###
[PollStageAppStatusExecution] [Bookshop2] 238506b3-8a7f-415f-bcab-7c8de217ee09 [2023-04-19T16:44:37.035921] Copying droplet into the container failed: stream-in: nstar: error streaming in: exit status 2. Output: tar: ./app/bookshop/node_modules/@sap/di.code-validation.xml/src/fioriAnalysis/ui5Versions/1.60.13/_sap.m.json: Wrote only 512 of 10240 bytes (STDERR, CELL)#

#2.0#2023 04 19 17:15:28.108#Z#DEBUG#com.sap.cloud.lm.sl.xs2.783edf34-ded5-11ed-8416-eeee0a9a8355.Bookshop2.stageAppTask#
######org.cloudfoundry.multiapps.controller.persistence.services.ProcessLogger########flowable-async-job-executor-thread-8326###
[PollStageAppStatusExecution] [Bookshop2] 238506b3-8a7f-415f-bcab-7c8de217ee09 [2023-04-19T16:44:37.035939] tar: ./app/bookshop/node_modules/@sap/di.code-validation.xml/src/fioriAnalysis/ui5Versions/1.60.13/_sap.ui.commons.json: Cannot open: No space left on device (STDERR, CELL)#

Steps for deployment

Cds add hana –for production
Cds add xsuaa –for production
Cds add mta (Optional in case you don’t have it yet.)
Cds add approuter –for production
It will generate xs-app and default-env.json inside /app folder. 
Npm install

Cds build –production
Mbt build -t gen –mtar mta.tar

cf login
cf deploy gen/mta.tar

Code Snippet

A code snippet use for creating a basic Fiori/CAP application.
<hr/>

mta.yaml

ID: Bookshop2
description: A simple CAP project.
version: 1.0.0
modules:
  - name: Bookshop2-srv
    type: nodejs
    path: gen/srv
    provides:
      - name: srv-api
        properties:
          srv-url: ${default-url}
    parameters:
      buildpack: nodejs_buildpack
    build-parameters:
      builder: npm-ci
    requires:
      - name: Bookshop2-db
      - name: Bookshop2-auth
  - name: Bookshop2-app-content
    type: com.sap.application.content
    path: .
    requires:
      - name: Bookshop2-repo-host
        parameters:
          content-target: true
    build-parameters:
      build-result: resources
      requires:
        - artifacts:
            - combookshopfioribookshop.zip
          name: combookshopfioribookshop
          target-path: resources/
  - name: combookshopfioribookshop
    type: html5
    path: app/bookshop
    build-parameters:
      build-result: dist
      builder: custom
      commands:
        - npm install
        - npm run build:cf
      supported-platforms:
        []

  - name: Bookshop2-db-deployer
    type: hdb
    path: gen/db
    parameters:
      buildpack: nodejs_buildpack
    requires:
      - name: Bookshop2-db

  - name: Bookshop2
    type: approuter.nodejs
    path: app/ # from cds.env.folders. Consider also cds.env.build.target -&gt; gen/app
    parameters:
      keep-existing-routes: true
      disk-quota: 256M
      memory: 256M
    requires:
      - name: srv-api
        group: destinations
        properties:
          name: srv-api # must be used in xs-app.json as well
          url: ~{srv-url}
          forwardAuthToken: true
      - name: Bookshop2-auth
resources:
  - name: Bookshop2-repo-host
    type: org.cloudfoundry.managed-service
    parameters:
      service: html5-apps-repo
      service-name: Bookshop2-html5-srv
      service-plan: app-host
  - name: Bookshop2-destination-service
    type: org.cloudfoundry.managed-service
    parameters:
      config:
        HTML5Runtime_enabled: false
        init_data:
          instance:
            destinations:
              - Authentication: NoAuthentication
                Name: ui5
                ProxyType: Internet
                Type: HTTP
                URL: https://ui5.sap.com
            existing_destinations_policy: update
        version: 1.0.0
      service: destination
      service-name: Bookshop2-destination-service
      service-plan: lite
  - name: Bookshop2-db
    type: com.sap.xs.hdi-container
    parameters:
      service: hana
      service-plan: hdi-shared
  - name: Bookshop2-auth
    type: org.cloudfoundry.managed-service
    parameters:
      service: xsuaa
      service-plan: application
      path: ./xs-security.json
      config:
        xsappname: Bookshop2-${org}-${space}
        tenant-mode: dedicated
parameters:
  deploy_mode: html5-repo
  enable-parallel-deployments: true
build-parameters:
  before-all:
    - builder: custom
      commands:
        - npx -p @sap/cds-dk cds build --production

package.json

  &quot;name&quot;: &quot;Bookshop2&quot;,
  &quot;version&quot;: &quot;1.0.0&quot;,
  &quot;description&quot;: &quot;A simple CAP project.&quot;,
  &quot;repository&quot;: &quot;&lt;Add your repository here&gt;&quot;,
  &quot;license&quot;: &quot;UNLICENSED&quot;,
  &quot;private&quot;: true,
  &quot;dependencies&quot;: {
    &quot;@sap/cds&quot;: &quot;^6&quot;,
    &quot;express&quot;: &quot;^4&quot;,
    &quot;hdb&quot;: &quot;^0.19.0&quot;,
    &quot;@sap/xssec&quot;: &quot;^3&quot;,
    &quot;passport&quot;: &quot;^0&quot;
  },
  &quot;devDependencies&quot;: {
    &quot;@sap/ux-specification&quot;: &quot;^1.108.3&quot;,
    &quot;sqlite3&quot;: &quot;^5&quot;,
    &quot;rimraf&quot;: &quot;^3.0.2&quot;
  },
  &quot;engines&quot;: {
    &quot;node&quot;: &quot;^16&quot;
  },
  &quot;scripts&quot;: {
    &quot;start&quot;: &quot;cds-serve&quot;,
    &quot;watch-bookshop&quot;: &quot;cds watch --open bookshop/webapp/index.html?sap-ui-xx-viewCache=false&quot;,
    &quot;undeploy&quot;: &quot;cf undeploy Bookshop2 --delete-services --delete-service-keys --delete-service-brokers&quot;,
    &quot;build&quot;: &quot;rimraf resources mta_archives &amp;&amp; mbt build --mtar archive&quot;,
    &quot;deploy&quot;: &quot;cf deploy mta_archives/archive.mtar --retries 1&quot;
  },
  &quot;sapux&quot;: [
    &quot;app/bookshop&quot;
  ],
  &quot;cds&quot;: {
    &quot;requires&quot;: {
      &quot;[production]&quot;: {
        &quot;db&quot;: {
          &quot;kind&quot;: &quot;hana-cloud&quot;
        },
        &quot;auth&quot;: {
          &quot;kind&quot;: &quot;xsuaa&quot;
        },
        &quot;approuter&quot;: {
          &quot;kind&quot;: &quot;cloudfoundry&quot;
        }
      },
      &quot;db&quot;: {
        &quot;kind&quot;: &quot;sql&quot;
      }
    }
  }
}

db/domain-model.cds

namespace com.bookshop2;

entity Books {
    key ID  : Integer;
    title   : String(100);
    stock   : Integer;
    price   : Decimal(9,2);
    author  : Association to Authors;
}

entity Authors {
    key ID  : Integer;
    name    : String(100);
    books   : Composition of many Books on books.author = $self;
}

srv/service.cds

using { com.bookshop2 as bookshop } from &#39;../db/domain-model&#39;;

service AdminService {
    entity Books as projection on bookshop.Books;
    entity Authors as projection on bookshop.Authors;
}

SAP UI5 / Fiori App

Basic Freestyle or Any Fiori Element Template.

SAUI5 ui5.yaml

metadata:
  name: com.bookshop.fiori.bookshop
type: application

SAPUI5 ui5-deploy.yaml

specVersion: &#39;2.4&#39;
metadata:
  name: com.bookshop.fiori.bookshop
type: application
resources:
  configuration:
    propertiesFileSourceEncoding: UTF-8
builder:
  resources:
    excludes:
      - &quot;/test/**&quot;
      - &quot;/localService/**&quot;
  customTasks:
  - name: webide-extension-task-updateManifestJson
    afterTask: replaceVersion
    configuration:
      appFolder: webapp
      destDir: dist
  - name: ui5-task-zipper
    afterTask: generateCachebusterInfo
    configuration:
      archiveName: combookshopfioribookshop
      additionalFiles:
      - xs-app.json

Update: Solution to the Deployment Issue.

You need to change the disk-quota and memory of your Fiori/SAUI5 app from 256M to at least 1024MB.
在SAP BTP试用帐户部署SAP Fiori和CAPM应用程序时出现错误。

答案1

得分: 2

我已经通过SAP专家的帮助成功解决了部署问题,通过将mta.yaml文件中SAPUI5/Fiori应用的disk-quotamemory256M更改为1024MB

英文:

I have managed to solve the deployment issue with the help of SAP Experts by changing the disk-quota and memory of SAPUI5/Fiori App of mta.yaml file from 256M to 1024MB.

在SAP BTP试用帐户部署SAP Fiori和CAPM应用程序时出现错误。

huangapple
  • 本文由 发表于 2023年4月20日 01:46:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76057448.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定