Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ resources/

# VitePress
_docs/.vitepress/cache

# secrets
cert
*.mtaext
notes.txt
67 changes: 67 additions & 0 deletions mta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
_schema-version: '3.1'
ID: cap.incidents
version: 1.0.0
description: "S/4HANA to @capire/incidents"

parameters:
enable-parallel-deployments: true

build-parameters:
before-all:
- builder: custom
commands:
- npm ci
- npx cds build --production
- cp -r cert/ gen/srv/cert # deploy the certificates
# deploy the sqlite db
- npx cds deploy
- cp db.sqlite gen/srv

modules:
- name: incidents-srv
type: nodejs
path: gen/srv
parameters:
buildpack: nodejs_buildpack
readiness-health-check-type: http
readiness-health-check-http-endpoint: /health
domain: cert.${default-domain} # needed for mTLS -> do we need the non-cert route as well?
build-parameters:
builder: npm
provides:
- name: incidents-srv-api
properties:
url: ${default-url}
requires:
- name: incidents-logs
- name: incidents-destination
- name: incidents-event-broker
parameters:
config:
authentication-type: X509_PROVIDED
x509:
outbound: # values for certificate and key provided via x509.mtaext
certificate: '***'
key: '***'

resources:
- name: incidents-logs
type: org.cloudfoundry.managed-service
parameters:
service: application-logs
service-plan: lite
- name: incidents-destination
type: org.cloudfoundry.managed-service
parameters:
service: destination
service-plan: lite
- name: incidents-event-broker
type: org.cloudfoundry.managed-service
parameters:
service: event-broker
service-plan: event-connectivity
config:
systemNamespace: cap.incidents # inconsequential value, just shouldn't clash (probably) but "must be fewer than 15 symbols" -> what to recommend?
webhookUrl: ~{incidents-srv-api/url}/-/cds/event-broker/webhook
requires:
- name: incidents-srv-api
67 changes: 51 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,25 @@
"dummy": 0
},
"dependencies": {
"@sap/cds": ">=7",
"@cap-js/sqlite": "^1",
"@sap-cloud-sdk/connectivity": "^3.17.0",
"@sap-cloud-sdk/http-client": "^3.17.0",
"@sap-cloud-sdk/resilience": "^3.17.0",
"@sap/cds": "^8",
"express": "^4"
},
"devDependencies": {
"@cap-js/sqlite": "^1.0.1",
"@sap/cds-dk": "^8",
"@sap/ux-specification": "^1.108.4",
"axios": "^1.4.0",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"chai-subset": "^1.6.0"
},
"scripts": {
"build": "mbt build -t gen --mtar mta.tar",
"deploy": "cf deploy gen/mta.tar -e x509.mtaext",
"undeploy": "cf undeploy cap.incidents --delete-services --delete-service-keys",
"watch": "cds watch",
"start": "cds-serve",
"test": "npx jest --silent",
Expand All @@ -38,29 +45,57 @@
"reset": "read -p 'This will irreversibly reset your working directory including ALL files in this git repo. Continue?' -n 1 -r && echo && if [[ $REPLY =~ ^[Yy]$ ]]; then git clean -fd && git reset --hard && npm i; fi"
},
"jest": {
"modulePathIgnorePatterns": ["<rootDir>/xmpls/"]
"modulePathIgnorePatterns": [
"<rootDir>/xmpls/"
]
},
"sapux": [
"app/incidents"
],
"cds": {
"requires": {
"auth": {
"[development]": {
"users": {
"alice": {
"roles": [
"support",
"admin"
]
},
"bob": {
"roles": [
"support"
]
}
"kind": "mocked",
"users": {
"alice": {
"roles": [
"support",
"admin"
]
},
"bob": {
"roles": [
"support"
]
}
}
},
"db": {
"kind": "sqlite",
"credentials": {
"url": "db.sqlite",
"[test]": {
"url": ":memory:"
}
}
},
"messaging": {
"kind": "event-broker",
"x509": {
"certPath": "./cert/sap.cdsipoc-client-cert-chain.pem",
"pkeyPath": "./cert/sap.cdsipoc-client-cert-key.pem"
},
"[test]": {
"kind": "local-messaging"
}
},
"API_BUSINESS_PARTNER": {
"kind": "odata-v2",
"model": "srv/external/API_BUSINESS_PARTNER",
"credentials": {
"destination": "S4HANA",
"path": "/sap/opu/odata/sap/API_BUSINESS_PARTNER"
}
}
}
},
Expand Down
Loading