{"id":16163337,"url":"https://github.com/gregorwolf/mtxs-bookshop","last_synced_at":"2025-07-31T03:39:26.858Z","repository":{"id":172596355,"uuid":"647931334","full_name":"gregorwolf/mtxs-bookshop","owner":"gregorwolf","description":"MTXS Bookshop","archived":false,"fork":false,"pushed_at":"2024-05-22T14:58:11.000Z","size":974,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-22T16:11:50.451Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregorwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-31T20:49:51.000Z","updated_at":"2024-06-25T15:38:06.876Z","dependencies_parsed_at":"2024-04-09T13:56:56.634Z","dependency_job_id":"8102b1c0-f2ac-4c97-889e-e98bf2a7c5f1","html_url":"https://github.com/gregorwolf/mtxs-bookshop","commit_stats":null,"previous_names":["gregorwolf/mtxs-bookshop"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fmtxs-bookshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fmtxs-bookshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fmtxs-bookshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fmtxs-bookshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregorwolf","download_url":"https://codeload.github.com/gregorwolf/mtxs-bookshop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244318626,"owners_count":20433944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T02:35:18.962Z","updated_at":"2025-07-31T03:39:26.842Z","avatar_url":"https://github.com/gregorwolf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MTXS Bookshop\n\nWelcome this Multitenant CAP project using the new MTXS package. The special functionality in this project is the dynamic setting of SERVICE_REPLACEMENTS and VCAP_SERVICES based on a User Provided Service. The credentials of this UPS are retrieved from using the Cloud Foundry API.\n\nIt contains these folders and files, following our recommended project layout:\n\n| File or Folder | Purpose                              |\n|----------------|--------------------------------------|\n| `app/`         | content for UI frontends goes here   |\n| `db/`          | your domain models and data go here  |\n| `srv/`         | your service models and code go here |\n| `package.json` | project metadata and configuration   |\n| `readme.md`    | this getting started guide           |\n\n## Prerequisites\n\nBefore you can test this project you have to fulfill the following prerequisites:\n\n- The project [CS1HDIA](https://github.com/gregorwolf/CS1HDIA) must be deployed to the Cloud Foundry provider subaccount\n- You have created a service key for the HDI Container of the CS1HDIA project. Based on this service key you have created a User Provided Service with the schema `\u003ctenant\u003e_CS1HDIAdb` in the provider subaccount.\n- The destination CFAPI based on the file `CFAPI` exists in the provider subaccount\n\n## Manual steps needed for Service Broker\n\n### Generate Broker Credentials\n\n1. Navigate into folder `/broker`\n2. Run command `npm i` in terminal\n3. Run command `npm run init` in terminal\n4. Store the generated credentials in a safe place\n\n### Create `.mtaext` file\n\n1. Copy file `cf-service-broker-template.mtaext` to `cf-service-broker-private.mtaext`\n2. Copy the hashed broker credentials from your safe place into the `cf-service-broker-private.mtaext` file\n\n### Register broker\n\nBuild and deploy the MTAR as described in the next step. After the deployment you can register the broker with:\n\n```sh\n export CF_BROKER_PASSWORD=\u003cbroker-password\u003e\ncf create-service-broker mtxs-bookshop-api-sb-dev broker-user \u003cbroker-url\u003e\n```\n\nif you want to restrict the broker to a specific space then add `--space-scoped`\n\n- The `broker-url` can be read from e.g. the SAP BTP cockpit by navigating to the broker application in the space where it was deployed.\n\nCheck the broker with:\n\n```sh\ncf service-brokers\n```\n\nWhen you now navigate to the service marketplace in the Cloud Foundry Space you should see the `MTXS Bookshop API dev` service. Create a service instance and a service key for it. The service key can be used with the REST client script `test/use-deployed-api.http` to test the deployed API.\n\n## Run local with redis\n\n### using redis as a container\n\nTo run the project locally with the redis cache you can either start the redis server as a container with the following command:\n\n```bash\ndocker run -p 6379:6379 --name redis -d redis\n```\n\nand add the following to the `.cdsrc-private.json` file in the \"requires\".\"[hybrid]\" section:\n\n```json\n      \"redis-eventQueue\": {\n        \"credentials\": {\n          \"hostname\": \"127.0.0.1\",\n          \"port\": 6379,\n          \"uri\": \"redis://127.0.0.1:6379\",\n          \"cluster_mode\": false\n        }\n      }\n```\n\n### using the redis service from the provider subaccount\n\nOr you can SAP BTP redis service. It can only be reached via an SSH tunnel (see: [Access a Redis-cache Instance from Redis-cli](https://help.sap.com/docs/redis-hyperscaler-option/redis-on-sap-btp-hyperscaler-option/access-redis-cache-instance-from-redis-cli)). The command to establish the tunnel is:\n\n```bash\ncf ssh -L 6380:\u003cyour-redis-hostname\u003e:6380 mtxs-bookshop-srv\n```\n\nNow you can bind the redis service to the project using the following command:\n\n```bash\ncds bind eventqueue-redis-cache --to mtxs-bookshop-redis-cache\n```\n\n## Create Services \u0026 Service Keys\n\nFor an easy creation of the services build the project using `mbt build` and deploy it to the Cloud Foundry provider subaccount using `cf deploy mta_archives/mtxs-bookshop_1.0.0.mtar`. Then create the service keys using the following commands:\n\n```bash\ncf csk mtxs-bookshop-db mtxs-bookshop-db-key\ncf csk mtxs-bookshop-destination mtxs-bookshop-destination-key\ncf csk mtxs-bookshop-uaa mtxs-bookshop-uaa-key\ncf csk mtxs-bookshop-workzone mtxs-bookshop-workzone-key\ncf csk mtxs-bookshop-repo-runtime mtxs-bookshop-repo-runtime-key\ncf csk mtxs-bookshop-credstore-dev mtxs-bookshop-credstore-dev-key\ncf csk mtxs-bookshop-theming mtxs-bookshop-theming-key\ncf csk mtxs-bookshop-jobscheduler mtxs-bookshop-jobscheduler-key\n```\n\n## Bind the CAP App to the service\n\n```bash\ncds bind -2 mtxs-bookshop-db\ncds bind -2 mtxs-bookshop-destination\ncds bind -2 mtxs-bookshop-connectivity\ncds bind -2 mtxs-bookshop-uaa\ncds bind -2 mtxs-bookshop-workzone\ncds bind -2 mtxs-bookshop-repo-runtime\ncds bind -2 mtxs-bookshop-credstore-dev\ncds bind -2 mtxs-bookshop-theming\ncds bind -2 mtxs-bookshop-jobscheduler\n```\n\n## Run local with dynamic binding\n\nTo try with the central service create a `default-env.json` and point it to the port where [bookshop-demo](https://github.com/gregorwolf/bookshop-demo) is running.\n\n```JSON\n{\n  \"destinations\": [\n    {\n      \"name\": \"CatalogService\",\n      \"url\": \"http://localhost:4003\"\n    }\n  ]\n}\n```\n\nTo run with mocked authentication also in hybrid mode you have to remove the line\n\n```\n\"kind\": \"xsuaa\",\n```\n\nfrom the `.cdsrc-private.json` file.\n\nWhen running with `cds watch --profile hybrid` the deployment of tenant containers fail. So please use:\n\n```bash\nnpm run start:hybrid\n```\n\n## Test deployed app\n\nCreate a consumer subaccount, go to the Service Marketplace and create a subscription for the app `mtxs-bookshop`. When you run `cf logs mtxs-bookshop-srv` in parallel you should see a successful subscription when the UPS `\u003csubscribedSubdomain\u003e_CS1HDIAdb` was existing in the provider subaccount.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorwolf%2Fmtxs-bookshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregorwolf%2Fmtxs-bookshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorwolf%2Fmtxs-bookshop/lists"}