btp-deploy-doctor
v0.1.0
Published
Finds and explains SAP BTP / CAP deployment problems before and after cf deploy.
Maintainers
Readme
btp-deploy-doctor
CLI and library that check SAP CAP / MTA projects for deployment mistakes and explain Cloud Foundry deploy logs.
btp-doctor check [dir] # static checks on mta.yaml, package.json, .cdsrc.json
btp-doctor fix [dir] --dry-run # preview automatic fixes
btp-doctor fix [dir] # apply them
btp-doctor diagnose deploy.log # explain a saved log
cf deploy mta_archives/x.mtar 2>&1 | btp-doctor diagnose
btp-doctor diagnose --app my-srv # runs cf logs my-srv --recent
btp-doctor diagnose --mta-op <id> # runs cf dmol -i <id>
btp-doctor connectivity --app my-srv # checks the app's destinations with your cf loginAdd --json for machine-readable output. check exits 1 when it finds errors, so it can gate CI.
Automatic fixes
fix applies every fix that needs no decision, one at a time, re-checking the project after each. Edits are minimal: comments, key order and formatting elsewhere in mta.yaml and package.json are kept. A fix is refused if the file changed since it was computed. Findings with several possible fixes (for example two similar dependency names) are left for you to choose in the editor.
After fixes that change package.json, run npm install so package-lock.json matches.
Rules
Rules marked ✔ have an automatic fix (sometimes only when the right value is unambiguous). "review" fixes are offered as quick fixes but skipped by fix, because they can affect local development.
UI rules apply to Fiori / UI5 apps deployed as html5 modules to the HTML5 application repository (managed approuter, SAP Build Work Zone). MT rules apply when cds.requires.multitenancy is on in production.
| ID | Severity | Checks | Fix |
|---|---|---|---|
| MTA001 | error | mta.yaml is valid YAML | |
| MTA002 | error/warning | ID and _schema-version present | ✔ |
| MTA003 | error | Names unique across modules, resources, provides | |
| MTA004 | error | Every requires entry resolves | ✔ |
| MTA005 | error | Module paths exist, or are generated by a cds build before-all step | ✔ |
| MTA006 | error | HDI deployer has exactly one target container | ✔ |
| MTA007 | error | Managed services have service and plan | ✔ |
| MTA008 | error | XSUAA security descriptor file exists | ✔ |
| MTA009 | warning | Approuter has xs-app.json | |
| MTA010 | warning | CAP service memory at least 256M | ✔ |
| MTA011 | warning | cds build is run with npx and a pinned @sap/cds-dk | ✔ |
| CDS000 | error | package.json / .cdsrc.json are valid JSON | |
| CDS001 | error | HANA in production has a runtime driver | ✔ |
| CDS002 | error | Real auth has @sap/xssec | ✔ |
| CDS003 | warning | HDI deployer in mta.yaml matches CAP production db | |
| CDS004 | warning | No real auth in the development profile | ✔ |
| CDS005 | error | @sap/cds is a runtime dependency | ✔ |
| CDS006 | warning | No mock auth in production | |
| CDS007 | warning | No SQLite in production | |
| CDS008 | info | Node version pinned | |
| X001 | error | CAP service module is bound to the auth service it is configured for | ✔ |
| X002 | error | Destinations used by CAP have the destination service bound | ✔ |
| REPO001 | warning | Credential files are git-ignored | ✔ |
| UI001 | error | Every html5 module is packaged by a content module | ✔ |
| UI002 | error | Artifact name in mta.yaml matches the ui5-task-zipper archiveName | ✔ |
| UI003 | error | Content module uploads to an html5-apps-repo app-host (content-target) | ✔ |
| UI004 | error | Build scripts called from mta.yaml exist in the app's package.json | ✔ |
| UI005 | error | The UI5 build produces a zip (zipper task configured and installed) | ✔ |
| UI006 | warning | xs-app.json exists and is packaged into the zip | ✔ |
| UI007 | error/warning | xs-app.json is valid, route patterns compile, destinations exist | ✔ |
| UI008 | warning/error | manifest.json sap.cloud.service is set and matches mta.yaml | ✔ |
| UI009 | warning | Data source URIs are relative (managed approuter / Work Zone) | review |
| UI010 | warning | Destination service has HTML5Runtime_enabled | ✔ |
| UI011 | error | Destination content points at real instances and service keys | ✔ |
| UI012 | warning | html5 modules are build-only (supported-platforms: []) | ✔ |
| MT001 | error | Multitenancy has @sap/cds-mtxs at runtime | ✔ |
| MT002 | error | XSUAA tenant-mode is shared | ✔ |
| MT003 | error | A Service Manager (container) resource exists | ✔ |
| MT004 | error | A SaaS registry exists and has an onSubscription URL | |
| MT005 | error | The with-mtx-sidecar profile has a sidecar module | |
| MT006 | error | The approuter has TENANT_HOST_PATTERN | ✔ |
| MT007 | error | Service and sidecar modules are bound to Service Manager | ✔ |
| MT008 | error | SaaS registry and XSUAA use the same xsappname | ✔ |
| MT009 | warning | No static HDI deployer in a multitenant app | |
The log analyzer knows the failure signatures in src/logs/patterns.ts.
