cap-js / docs

CAP Documentation
https://cap.cloud.sap
Apache License 2.0
45 stars 98 forks source link

Misleading Parameters for CF "health-check"? #797

Closed drvup closed 6 months ago

drvup commented 6 months ago

Hi guys,

I just checked the new feature of CAP, using the new capabilities of Cloud Foundry to perform a http-check after the deployment as kind of readiness check, as announced within the release-notes for march

I checked the referenced documentations on CAPire for more details, but was not able to get more details how to get it embedded on the mta.yaml file. So, I followed instead the example from the picture of the release-note of march. This did not lead me to success. I did supply a "wrong" name to check, the pipeline / cf deployment is failing like expected:

modules:
  - name: my-demo-app
    type: nodejs
    path: .
    parameters:
      disk-quota: 1024M
      memory: 512M
      instances: 1
      buildpack_name: nodejs_buildpack
      readiness-health-check-type: http
      readiness-health-check-http-endpoint: /broken

After some further debugging, checking cf-cli version and mta-build version, I found this example. So, I modified it accordingly and used instead:

modules:
  - name: my-demo-app
    type: nodejs
    path: .
    parameters:
      disk-quota: 1024M
      memory: 512M
      instances: 1
      buildpack_name: nodejs_buildpack
      health-check-type: http
      health-check-http-endpoint: "/broken"

This is working! Can you please check, if it's a typo and correct the page accordingly, so the next one isn't running into the same situation?

Best Regards, Cedric

renejeglinsky commented 6 months ago

Thanky @drvup ! I can confirm, that cds init book --add sample,mta creates an mta.yaml that is according to our docs. @sjvans and @swaldmann could you check if we need to adapt according to @drvup 's findings?

sjvans commented 6 months ago

readiness-health-check-type and readiness-health-check-http-endpoint are correct. see readiness-health-check-http-endpoint in cf docs.

not sure why this would lead to a failure, i.e., looks like an mta bug to me.

renejeglinsky commented 6 months ago

Hi @drvup ,

I created a simple CAP app and deployed it. It worked. my mta.yaml looks like this:

_schema-version: '3.1'
ID: book
version: 1.0.0
description: "A simple CAP project."
parameters:
  enable-parallel-deployments: true
build-parameters:
  before-all:
    - builder: custom
      commands:
        - npm ci
        - npx cds build --production
modules:
  - name: book-srv
    type: nodejs
    path: gen/srv
    parameters:
      buildpack: nodejs_buildpack
      readiness-health-check-type: http
      readiness-health-check-http-endpoint: /health
    build-parameters:
      builder: npm
    provides:
      - name: srv-api # required by consumers of CAP services (e.g. approuter)
        properties:
          srv-url: ${default-url}
    requires:
      - name: book-auth
      - name: book-db

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

resources:
  - name: book-auth
    type: org.cloudfoundry.managed-service
    parameters:
      service: xsuaa
      service-plan: application
      path: ./xs-security.json
      config:
        xsappname: book-${org}-${space}
        tenant-mode: dedicated
  - name: book-db
    type: com.sap.xs.hdi-container
    parameters:
      service: hana
      service-plan: hdi-shared

So thanks again for being alert and opening this issue. But I don't think there's an error in capire or our implementation. All the best, René