Skip to content

Commit

Permalink
deploy bookshop
Browse files Browse the repository at this point in the history
  • Loading branch information
vl-leon committed Dec 9, 2024
1 parent 32bc0ab commit 1a0df4d
Show file tree
Hide file tree
Showing 11 changed files with 5,972 additions and 3,215 deletions.
2,329 changes: 2,329 additions & 0 deletions app/router/package-lock.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions app/router/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "approuter",
"dependencies": {
"@sap/approuter": "^17.0.0"
},
"engines": {
"node": "^20"
},
"scripts": {
"start": "node node_modules/@sap/approuter/approuter.js"
}
}
21 changes: 21 additions & 0 deletions app/router/xs-app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"routes": [
{
"source": "^/app/(.*)$",
"target": "$1",
"localDir": ".",
"cacheControl": "no-cache, no-store, must-revalidate"
},
{
"source": "^/appconfig/",
"localDir": ".",
"cacheControl": "no-cache, no-store, must-revalidate"
},
{
"source": "^/(.*)$",
"target": "$1",
"destination": "bookshop-api",
"csrfProtection": true
}
]
}
14 changes: 14 additions & 0 deletions bookshop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,22 @@
},
"dependencies": {
"@sap/cds": ">=7",
"@sap/xssec": "^4",
"@cap-js/hana": "^1",
"express": "^4.17.1"
},
"cds": {
"requires": {
"[production]": {
"auth": "xsuaa",
"db": "hana",
"messaging": "enterprise-messaging"
}
}
},
"sql": {
"native_hana_associations": false
},
"scripts": {
"genres": "cds serve test/genres.cds",
"start": "cds-serve",
Expand Down
139 changes: 139 additions & 0 deletions db/src/.hdiconfig
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
7 changes: 7 additions & 0 deletions db/undeploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
"src/gen/**/*.hdbview",
"src/gen/**/*.hdbindex",
"src/gen/**/*.hdbconstraint",
"src/gen/**/*_drafts.hdbtable",
"src/gen/**/*.hdbcalculationview"
]
31 changes: 31 additions & 0 deletions event-mesh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"emname": "samples-emname",
"version": "1.1.0",
"namespace": "default/samples/1",
"options": {
"management": true,
"messagingrest": true,
"messaging": true
},
"rules": {
"topicRules": {
"publishFilter": [
"${namespace}/*"
],
"subscribeFilter": [
"*"
]
},
"queueRules": {
"publishFilter": [
"${namespace}/*"
],
"subscribeFilter": [
"${namespace}/*"
]
}
},
"authorities": [
"$ACCEPT_GRANTED_AUTHORITIES"
]
}
79 changes: 79 additions & 0 deletions mta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
_schema-version: 3.3.0
ID: capire.samples
version: 2.1.0
description: "A monorepo with several samples for CAP."
parameters:
enable-parallel-deployments: true
build-parameters:
before-all:
- builder: custom
commands:
- npm ci
- npx cds build --for hana --production --ws
- npx cds build ./bookshop --for nodejs --production --ws-pack
modules:
- name: bookshop-srv
type: nodejs
path: bookshop/gen/srv
parameters:
buildpack: nodejs_buildpack
readiness-health-check-type: http
readiness-health-check-http-endpoint: /health
build-parameters:
builder: npm
provides:
- name: bookshop-api # required by consumers of CAP services (e.g. approuter)
properties:
srv-url: ${default-url}
requires:
- name: samples-messaging
- name: samples-db
- name: samples-auth

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

- name: samples
type: approuter.nodejs
path: app/router
parameters:
keep-existing-routes: true
disk-quota: 256M
memory: 256M
requires:
- name: bookshop-api
group: destinations
properties:
name: bookshop-api # must be used in xs-app.json as well
url: ~{srv-url}
forwardAuthToken: true
- name: samples-auth

resources:
- name: samples-messaging
type: org.cloudfoundry.managed-service
parameters:
service: enterprise-messaging
service-plan: default
path: ./event-mesh.json
- name: samples-db
type: com.sap.xs.hdi-container
parameters:
service: hana
service-plan: hdi-shared
- name: samples-auth
type: org.cloudfoundry.managed-service
processed-after:
- samples-messaging
parameters:
service: xsuaa
service-plan: application
path: ./xs-security.json
config:
xsappname: samples-${org}-${space}
tenant-mode: dedicated
Loading

0 comments on commit 1a0df4d

Please sign in to comment.