From e8156ce08a79298785cf5b514dff8ea5d46f7265 Mon Sep 17 00:00:00 2001 From: Matthias Buehl Date: Tue, 24 Mar 2020 15:47:03 +0100 Subject: [PATCH] streamline branches --- README.md | 67 +++++++++ mta.yaml | 78 ---------- packages/bookshop/db/package.json | 2 +- packages/bookshop/db/src/.hdiconfig | 136 ++++++++++++++++++ packages/bookshop/mta.yaml | 1 - packages/bookshop/package.json | 5 +- ...e_local.json => package_local_DELETE.json} | 0 7 files changed, 206 insertions(+), 83 deletions(-) delete mode 100644 mta.yaml create mode 100644 packages/bookshop/db/src/.hdiconfig rename packages/bookshop/{package_local.json => package_local_DELETE.json} (100%) diff --git a/README.md b/README.md index 3718c5cf..e31c5d2c 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,73 @@ After that, watch out for the little popup in the lower right corner of SAP Busi ## Deploy to Cloud Foundry +Clean-up the CF space in your trial account if you already used it before. Make sure that there are no services or applications deployed. + +Generation of the xs-security.json +```sh +cds compile srv/ --to xsuaa > xs-security.json +``` + +In this unit we use [MTA](https://sap.github.io/cloud-mta-build-tool/) to do the deployment to CF +```sh +npm install -g mbt +``` +You can generate the MTA.yaml from CDS and do manual modifications or simply use the already generated and adapted mta.yaml in the branch and directly generate the .mtar file + + + +### BEGIN OPTIONAL PART + +If you do not want to generate the MTA.YAML yourself please do the following: + +- Generate the mta.yaml with the HANA dependency +```sh +cds add hana --force +cds add mta +``` + +- Add the path to the generated xs-security.json in the MTA.YAML +``` + parameters: + path: ./xs-security.json + service:xsuaa + service-plan: application + .... +``` +- Add the application block in the MTA.YAML +``` + ############## APP ######################### + - name: capire-bookshop-app + type: nodejs + path: gen/app + parameters: + memory: 256M + build-parameters: + requires: + - name: capire-bookshop-srv + requires: + - name: capire-bookshop-uaa + - name: srv-binding + group: destinations + properties: + forwardAuthToken: true + name: srv-binding + url: ~{srv-url} +``` +- Make sure to use service hanatrial instead of hana in the MTA.YAML +``` + parameters: + service: hanatrial +``` +### END OPTIONAL PART + +Generate the .mtar file for the deployment and deploy to cloud foundry: +```sh +mbt build -t ./ +cf login -a https://api.cf.eu10.hana.ondemand.com +cf deploy sap.capire-bookshop_1.0.0.mtar +``` + ## Get Support Check out the cap docs at https://cap.cloud.sap.
diff --git a/mta.yaml b/mta.yaml deleted file mode 100644 index 4981c041..00000000 --- a/mta.yaml +++ /dev/null @@ -1,78 +0,0 @@ -####### Generated mta.yaml based on template version 0.2.0 -####### appName = capire-samples -####### language=nodejs; multiTenant= -####### approuter= - -_schema-version: '3.1' -ID: sap.capire-samples -version: 1.0.0 -description: "The umbrella project for all samples to easily setup for local development and tests." - -build-parameters: - before-all: - - builder: custom - commands: - - npm install - - cds build/all - -parameters: - enable-parallel-deployments: true - -modules: - ############## SERVER MODULE ########################## - - name: capire-samples-srv - type: nodejs - path: - properties: - EXIT: 1 # required by deploy.js task to terminate - - - requires: - #### Resources extracted from CAP configuration #### - - name: capire-samples-db - - name: capire-samples-uaa - - provides: - - name: srv-binding # required by consumers of CAP services (e.g. approuter) - properties: - srv-url: ${default-url} - - ############################################################ - - ############## SIDECAR MODULE ######################### - - name: db - - type: hdb - path: gen/db - parameters: - app-name: capire-samples-db - requires: - #### Hana and xsuaa resources extracted from CAP configuration #### - - name: capire-samples-db - - name: capire-samples-uaa - ############################################################ - - -############## RESOURCES ################################## -resources: - ##### Services extracted from CAP configuration #### - ##### 'service-plan' can be configured via 'cds.requires..vcap.plan' - - name: capire-samples-db - type: com.sap.xs.hdi-container - - parameters: - service: hanatrial - properties: - hdi-service-name: ${service-name} # required for Java case - - name: capire-samples-uaa - - type: org.cloudfoundry.managed-service - parameters: - path: ./xs-security.json - service: xsuaa - service-plan: application - config: - xsappname: capire-samples-${space} # name + space dependency - tenant-mode: dedicated - ### scopes and role templates will be added below by a developer or by CAP tools -############################################################ diff --git a/packages/bookshop/db/package.json b/packages/bookshop/db/package.json index 247b99df..e06a85a3 100644 --- a/packages/bookshop/db/package.json +++ b/packages/bookshop/db/package.json @@ -4,7 +4,7 @@ "@sap/hdi-deploy": "^3.8.2" }, "engines": { - "node": "^8" + "node": "^12" }, "scripts": { "start": "node node_modules/@sap/hdi-deploy/deploy.js" diff --git a/packages/bookshop/db/src/.hdiconfig b/packages/bookshop/db/src/.hdiconfig new file mode 100644 index 00000000..b1a1e281 --- /dev/null +++ b/packages/bookshop/db/src/.hdiconfig @@ -0,0 +1,136 @@ +{ + "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" + } + } +} \ No newline at end of file diff --git a/packages/bookshop/mta.yaml b/packages/bookshop/mta.yaml index 635d640d..5a33fcfd 100644 --- a/packages/bookshop/mta.yaml +++ b/packages/bookshop/mta.yaml @@ -2,7 +2,6 @@ ####### appName = capire-bookshop ####### language=nodejs; multiTenant= ####### approuter= - _schema-version: '3.1' ID: sap.capire-bookshop version: 1.0.0 diff --git a/packages/bookshop/package.json b/packages/bookshop/package.json index 0946784e..14d449f9 100644 --- a/packages/bookshop/package.json +++ b/packages/bookshop/package.json @@ -16,11 +16,10 @@ "cds": { "requires": { "db": { - "kind": "sqlite", + "kind": "hana", "[production]": { "kind": "hana" - }, - "model": "srv" + } }, "uaa": { "kind": "xsuaa" diff --git a/packages/bookshop/package_local.json b/packages/bookshop/package_local_DELETE.json similarity index 100% rename from packages/bookshop/package_local.json rename to packages/bookshop/package_local_DELETE.json