diff --git a/.gitignore b/.gitignore index c161f22..4d50999 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ default-env.json **/.mta/ *.mtar +*.mta *.log* gc_history* diff --git a/db/package-lock.json b/db/package-lock.json new file mode 100644 index 0000000..6b48654 --- /dev/null +++ b/db/package-lock.json @@ -0,0 +1,348 @@ +{ + "name": "deploy", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "deploy", + "dependencies": { + "@sap/hdi-deploy": "^5", + "hdb": "^0" + }, + "engines": { + "node": "^22.0.0" + } + }, + "node_modules/@sap/hdi": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@sap/hdi/-/hdi-4.8.0.tgz", + "integrity": "sha512-tkJmY2ffm6mt4/LFwRBihlQkMxNAXa3ngvRe2N/6+qLIsUNdrH/M03S5mkygXq56K+KoVVZYuradajCusMWwsw==", + "license": "See LICENSE file", + "dependencies": { + "async": "^3.2.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@sap/hana-client": "^2 >= 2.5", + "hdb": "^2 || ^0" + }, + "peerDependenciesMeta": { + "@sap/hana-client": { + "optional": true + }, + "hdb": { + "optional": true + } + } + }, + "node_modules/@sap/hdi-deploy": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@sap/hdi-deploy/-/hdi-deploy-5.5.1.tgz", + "integrity": "sha512-5r9SIkXX7cO+MwRFF32O566sMx6LP1mLin0eT9F+Adqy+0SrdwkWv4JslQzYetiWLuNsfqQljcao62alaxts8A==", + "license": "See LICENSE file", + "dependencies": { + "@sap/hdi": "^4.8.0", + "@sap/xsenv": "^5.2.0", + "async": "^3.2.6", + "dotenv": "^16.4.5", + "handlebars": "^4.7.8", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=18.x" + }, + "peerDependencies": { + "@sap/hana-client": "^2 >= 2.6", + "hdb": "^2 || ^0" + }, + "peerDependenciesMeta": { + "@sap/hana-client": { + "optional": true + }, + "hdb": { + "optional": true + } + } + }, + "node_modules/@sap/xsenv": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@sap/xsenv/-/xsenv-5.6.1.tgz", + "integrity": "sha512-4pDpsYLNJsLUBWtTSG+TJ8ul5iY0dWDyJgTy2H/WZGZww9CSPLP/39x+syDDTjkggsmZAlo9t7y9TiXMmtAunw==", + "license": "SEE LICENSE IN LICENSE file", + "dependencies": { + "debug": "4.4.0", + "node-cache": "^5.1.2", + "verror": "1.10.1" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || ^22.0.0" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "license": "MIT" + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/extsprintf": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz", + "integrity": "sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==", + "engines": [ + "node >=0.6.0" + ], + "license": "MIT" + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/hdb": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/hdb/-/hdb-0.19.12.tgz", + "integrity": "sha512-vv+cjmvr6fNH/s0Q2zOZc4sEjMpSC0KuacFn8dp3L38qM3RA2LLeX70wWhZLESpwvwUf1pQkRfUhZeooFSmv3A==", + "license": "Apache-2.0", + "dependencies": { + "iconv-lite": "^0.4.18" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "license": "MIT" + }, + "node_modules/node-cache": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz", + "integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==", + "license": "MIT", + "dependencies": { + "clone": "2.x" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/uglify-js": { + "version": "3.19.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", + "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", + "license": "BSD-2-Clause", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/verror": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz", + "integrity": "sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg==", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "license": "MIT" + } + } +} diff --git a/db/package.json b/db/package.json new file mode 100644 index 0000000..c721ccc --- /dev/null +++ b/db/package.json @@ -0,0 +1,14 @@ +{ + "name": "deploy", + "dependencies": { + "hdb": "^0", + "@sap/hdi-deploy": "^5" + }, + "engines": { + "node": "^22.0.0" + }, + "scripts": { + "start": "node node_modules/@sap/hdi-deploy/deploy.js --use-hdb --parameter com.sap.hana.di.table/try_fast_table_migration=true", + "build": "npm ci && npx cds build .. --for hana --production" + } +} diff --git a/db/src/.hdiconfig b/db/src/.hdiconfig new file mode 100644 index 0000000..03673f2 --- /dev/null +++ b/db/src/.hdiconfig @@ -0,0 +1,139 @@ +{ + "file_suffixes": { + "csv": { + "plugin_name": "com.sap.hana.di.tabledata.source" + }, + "hdbafllangprocedure": { + "plugin_name": "com.sap.hana.di.afllangprocedure" + }, + "hdbanalyticprivilege": { + "plugin_name": "com.sap.hana.di.analyticprivilege" + }, + "hdbcalculationview": { + "plugin_name": "com.sap.hana.di.calculationview" + }, + "hdbcollection": { + "plugin_name": "com.sap.hana.di.collection" + }, + "hdbconstraint": { + "plugin_name": "com.sap.hana.di.constraint" + }, + "hdbdropcreatetable": { + "plugin_name": "com.sap.hana.di.dropcreatetable" + }, + "hdbflowgraph": { + "plugin_name": "com.sap.hana.di.flowgraph" + }, + "hdbfunction": { + "plugin_name": "com.sap.hana.di.function" + }, + "hdbgraphworkspace": { + "plugin_name": "com.sap.hana.di.graphworkspace" + }, + "hdbhadoopmrjob": { + "plugin_name": "com.sap.hana.di.virtualfunctionpackage.hadoop" + }, + "hdbindex": { + "plugin_name": "com.sap.hana.di.index" + }, + "hdblibrary": { + "plugin_name": "com.sap.hana.di.library" + }, + "hdbmigrationtable": { + "plugin_name": "com.sap.hana.di.table.migration" + }, + "hdbprocedure": { + "plugin_name": "com.sap.hana.di.procedure" + }, + "hdbprojectionview": { + "plugin_name": "com.sap.hana.di.projectionview" + }, + "hdbprojectionviewconfig": { + "plugin_name": "com.sap.hana.di.projectionview.config" + }, + "hdbreptask": { + "plugin_name": "com.sap.hana.di.reptask" + }, + "hdbresultcache": { + "plugin_name": "com.sap.hana.di.resultcache" + }, + "hdbrole": { + "plugin_name": "com.sap.hana.di.role" + }, + "hdbroleconfig": { + "plugin_name": "com.sap.hana.di.role.config" + }, + "hdbsearchruleset": { + "plugin_name": "com.sap.hana.di.searchruleset" + }, + "hdbsequence": { + "plugin_name": "com.sap.hana.di.sequence" + }, + "hdbstatistics": { + "plugin_name": "com.sap.hana.di.statistics" + }, + "hdbstructuredprivilege": { + "plugin_name": "com.sap.hana.di.structuredprivilege" + }, + "hdbsynonym": { + "plugin_name": "com.sap.hana.di.synonym" + }, + "hdbsynonymconfig": { + "plugin_name": "com.sap.hana.di.synonym.config" + }, + "hdbsystemversioning": { + "plugin_name": "com.sap.hana.di.systemversioning" + }, + "hdbtable": { + "plugin_name": "com.sap.hana.di.table" + }, + "hdbtabledata": { + "plugin_name": "com.sap.hana.di.tabledata" + }, + "hdbtabletype": { + "plugin_name": "com.sap.hana.di.tabletype" + }, + "hdbtrigger": { + "plugin_name": "com.sap.hana.di.trigger" + }, + "hdbview": { + "plugin_name": "com.sap.hana.di.view" + }, + "hdbvirtualfunction": { + "plugin_name": "com.sap.hana.di.virtualfunction" + }, + "hdbvirtualfunctionconfig": { + "plugin_name": "com.sap.hana.di.virtualfunction.config" + }, + "hdbvirtualpackagehadoop": { + "plugin_name": "com.sap.hana.di.virtualpackage.hadoop" + }, + "hdbvirtualpackagesparksql": { + "plugin_name": "com.sap.hana.di.virtualpackage.sparksql" + }, + "hdbvirtualprocedure": { + "plugin_name": "com.sap.hana.di.virtualprocedure" + }, + "hdbvirtualprocedureconfig": { + "plugin_name": "com.sap.hana.di.virtualprocedure.config" + }, + "hdbvirtualtable": { + "plugin_name": "com.sap.hana.di.virtualtable" + }, + "hdbvirtualtableconfig": { + "plugin_name": "com.sap.hana.di.virtualtable.config" + }, + "properties": { + "plugin_name": "com.sap.hana.di.tabledata.properties" + }, + "tags": { + "plugin_name": "com.sap.hana.di.tabledata.properties" + }, + "txt": { + "plugin_name": "com.sap.hana.di.copyonly" + }, + "hdbeshconfig": { + "plugin_name": "com.sap.hana.di.eshconfig" + } + } +} diff --git a/db/undeploy.json b/db/undeploy.json new file mode 100644 index 0000000..aa14b9f --- /dev/null +++ b/db/undeploy.json @@ -0,0 +1,7 @@ +[ + "src/gen/**/*.hdbview", + "src/gen/**/*.hdbindex", + "src/gen/**/*.hdbconstraint", + "src/gen/**/*_drafts.hdbtable", + "src/gen/**/*.hdbcalculationview" +] diff --git a/mta.yaml b/mta.yaml new file mode 100644 index 0000000..afa3f53 --- /dev/null +++ b/mta.yaml @@ -0,0 +1,63 @@ +_schema-version: 3.3.0 +ID: xflights +version: 1.0.0-SNAPSHOT +description: "xflights for Java" +parameters: + enable-parallel-deployments: true +modules: + - name: xflights-srv + type: java + path: srv + parameters: + instances: 1 + buildpack: sap_java_buildpack_jakarta + routes: + - route: "${default-host}.cert.${default-domain}" + properties: + SPRING_PROFILES_ACTIVE: cloud + JBP_CONFIG_COMPONENTS: "jres: ['com.sap.xs.java.buildpack.jre.SAPMachineJRE']" + JBP_CONFIG_SAP_MACHINE_JRE: '{ version: 21.+ }' + build-parameters: + builder: custom + commands: + - mvn clean package -DskipTests=true --batch-mode + build-result: target/*-exec.jar + provides: + - name: srv-api # required by consumers of CAP services (e.g. approuter) + properties: + srv-url: ${default-url} + srv-cert-url: '${protocol}://${default-host}.cert.${default-domain}' + requires: + - name: xflights-ias + parameters: + config: + credential-type: X509_GENERATED + app-identifier: srv + - name: xflights-db + + - name: xflights-db-deployer + type: hdb + path: db + parameters: + buildpack: nodejs_buildpack + build-parameters: + builder: custom + commands: + - npm run build + requires: + - name: xflights-db + +resources: + - name: xflights-ias + type: org.cloudfoundry.managed-service + parameters: + service: identity + service-name: xflights-ias + service-plan: application + config: + display-name: xflights-java + - name: xflights-db + type: com.sap.xs.hdi-container + parameters: + service: hana + service-plan: hdi-shared diff --git a/srv/pom.xml b/srv/pom.xml index 7f11ed6..6f967ac 100644 --- a/srv/pom.xml +++ b/srv/pom.xml @@ -20,6 +20,12 @@ cds-starter-spring-boot + + com.sap.cds + cds-starter-cloudfoundry + runtime + + com.sap.cds cds-adapter-odata-v4 @@ -38,6 +44,12 @@ runtime + + org.springframework.boot + spring-boot-starter-actuator + runtime + + org.springframework.boot spring-boot-devtools diff --git a/srv/src/main/resources/application.yaml b/srv/src/main/resources/application.yaml index f2dd283..d222354 100644 --- a/srv/src/main/resources/application.yaml +++ b/srv/src/main/resources/application.yaml @@ -1,4 +1,17 @@ server.port: 8081 # leave 8080 for xtravels +management: + endpoint: + health: + show-components: always + probes.enabled: true + endpoints: + web: + exposure: + include: health + health: + defaults.enabled: false + ping.enabled: true + db.enabled: true --- spring: config.activate.on-profile: default