Giter Site home page Giter Site logo

sap-samples / btp-cf-cap-multitenant-susaas Goto Github PK

View Code? Open in Web Editor NEW
67.0 18.0 29.0 78.47 MB

Sample project that demonstrates how to setup a multitenant application for a software-as-a-service scenario using the SAP BTP Cloud Foundry environment. Developers learn how to implement their own CAP (mtxs) based SaaS app including an SaaS API and integration with various essential SAP BTP service offerings.

License: Apache License 2.0

api-management ci-cd cloud-foundry logging monitoring saas sample sample-code security btp-use-case-factory

btp-cf-cap-multitenant-susaas's Introduction

Develop a multitenant Software as a Service application in SAP BTP using CAP (Cloud Foundry)

REUSE status

❗️❗️❗️ Unified & Runtime-Agnostic SAP-samples repository available - https://github.com/SAP-samples/btp-cap-multitenant-saas ❗️❗️❗️

Important

Hi follow developers,

We've got some news to share about our SAP-samples repositories, where we show you how to create those cool multitenant SaaS apps using the Cloud Application Programming Model (CAP) based on the SAP BTP, Cloud Foundry and Kyma Runtime. We've brought together these repositories into a single home, and you can check it out right here - https://github.com/SAP-samples/btp-cap-multitenant-saas. We made this change to ensure things stay organized and streamlined in the future. Keeping separate code lines and documentation requires a lot of effort, and we'd rather spend our time enhancing our sample scenario and making things more efficient!

Long story short - originally, we had two stories – one for the SAP BTP, Kyma and one for the Cloud Foundry Environment, but both about building those nifty SaaS apps on SAP BTP. Over the last months, it turned out, they were kind of like cousins, with just a few differences like how they do things (like using API Rules in Kyma or setting up Routes in Cloud Foundry). So, we decided to combine their stories into one central place. This is like having a cool book that has both of their adventures!

What does this mean for you? Well, now you have a single, easy-to-go-to place for learning about developing and deploying our beloved multitenant Sustainable SaaS sample application to both the SAP BTP, Kyma and Cloud Foundry Runtime. This will be where we update stuff from now on. If you need help or want to talk about anything, we've set up a new spot for that too. Just use the GitHub Issues feature of our new repository to get in touch, and remember not to chat about it in the old repositories – we won't be checking there anymore.

While we're moving things around, in this Cloud Foundry-based legacy book, the original parts (branches) of the story called main, basic and advanced will be moving to new branches called archive/main, archive/basic and archive/advanced for a while. So, if you want to remember how that story went, you can still visit it there.

Oh, and one more thing – the documentation is moving too. The latest version now lives in the new place with both stories. Once again, the new repository - https://github.com/SAP-samples/btp-cap-multitenant-saas.

Thanks for being awesome and joining us on this journey!

Alper Dedeoglu & Martin Frick

Description

This SAP-samples repository was centered around the creation of multitenant SaaS applications using CAP and the SAP BTP, Cloud Foundry Runtime. For a consolidated approach, explore the following SAP-samples repository that encompasses deployment specifics for both the Kyma and Cloud Foundry environments.

https://github.com/SAP-samples/btp-cap-multitenant-saas

How to obtain support

Create an issue in the btp-cap-multitenant-saas repository if you find a bug or have questions about the content.

For additional support, ask a question in SAP Community.

Contributing

If you wish to contribute code or offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request for this project. This happens in an automated fashion during the submission process. SAP uses the standard DCO text of the Linux Foundation.

License

Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

btp-cf-cap-multitenant-susaas's People

Contributors

ajinkyapatil8190 avatar alperdedeoglu avatar attilaberencsi avatar bvarwig avatar kaztakata avatar martinfrick avatar maxstreifeneder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btp-cf-cap-multitenant-susaas's Issues

SusaaS or SuSaaS?

Hello @alperdedeoglu and @martinfrick,

just a small thing: In the README.md you introduce Sustainable SaaS as SusaaS. But a bit later it's also mentioned as SuSaaS. Based on the long name Sustainable SaaS I would suggest SuSaaS at all places where currently SusaaS is used.

CU tomorrow
Gregor

TypeError: this.options.selectionStrategy is not a function

Hello SuSaaS Team,

I followed the troubleshooting section for subscriber destination resolution, but no luck.

I am getting an issue when accessing an S/4HANA onPremise destination maintained in the subscriber subaccount to fetch data from subscribers system via OData.

image

TypeError: this.options.selectionStrategy is not a function at DestinationFromServiceRetriever.getSubscriberDestinationService

image

I've applied additions like adding connectivity as dependency in provisioning.js , and Also added mtx dependencies in server.js according to this Community thread.

image

I also added connectivity to mta.yaml

image

And bound to the application router
image

Also extended cds.requires in package.json with

image

I deployed it to CF after that I did a new subscription, but no luck unfortunately . I am getting the same issue.

I might missed some configuration maybe somewhere. Cloud foundry is not enabled in subscriber account, and only the destination is created there.

In non-SaaS application I was able to fetch data from S/4HANA on Premise systems, there is something specific what I sure missed to do, but was not able to spot out clearly.

I am not sure this is off topic here, due I found references to subscriber destination resolution in troubleshooting section only, but no other documentation in this repository which is about connecting subscribers onPremise system from the cloud. In case this is not related to this SuSaaS solution, we can close this Issue.

Thank You for Your many help already in the past!

Best regards

Attila

Error while deploying caused by non-compliant {org} name in mta.yaml

Dear experts,

While deploying the tar file there is an error causing the registry service to fail with a message about the appname not being compliant to the ^\s*\S+\s*$ format.

The yaml file at line 338 has the following entry: appName: ~{susaas-approuter/application}-${org}.

I think the fix is to remove the -${org} part.

Login Screen in Subscriber subaccount

Hi experts,

when I try to run the app from the subscriber subaccount, then I get redirected to an SAP HANA XS Advanced(https://authentication.us10.hana.ondemand.com/login) login screen instead of the Cloud Identity Service login screen.

image

The routes got created automatically:

image

I established trust to my Identity Authentication Tenant in the subaccount. I'm not sure what I did wrong, I also tried to redeploy and I created a another subscriber subaccount without success. Can you point me into right direction?

Thanks,

Nicolas

Variant Management & Personalization

Hi All,

I've noticed that you have deactivated the personalization and variant management - certainly because the sandbox fiori launchpad does not offer an "lrep" endpoint (from the on-prem world).
Do you know any solution for hosting a multi tenant application while still beeing able to use personalization?

Thanks!

Local testing in BAS using the HTML5 Repo Mock - "cds.xt.Extensions" does not exist.

Dear SuSaas Team,

when executing step 2.2, and launching the users application I am getting the following error in the Basic scope in BAS .

image

image

Maybe I missed some doc ?

Thank You in advance

P.S.:
I did not change any extension related configuration so far, but will need it definitely anyway in the future, to manage different S4 system versions of subscribers when calling their backend systems with difference in metadata by older/newer version of the same service imported.

VSCode - Hybrid Development - UI5 Version 1.111.1 Failure

Dear SuSaaS Team,

following step 2.5 in the hybrid development guide we're facing the following issue.

image

image

This issue happens on UI5 version 1.111.1.

After rebooting the application with the help of UI5 Diagnostics with version 1.108.10 the application loads as expected

image

image

image

I did a trick in default-env.json (I saw it at another place).

image

This resulted to load the application with lower version by default and fixed the issue.

Can we fix this somehow in the GitHub repository as well ? I am not sure this is the best approach to push such, but works.

Thank you in advance

Best regards

Attila

Subscription failed.

Hello,
I tried to follow basic scope in trial accounts but I get an error when I try to subscribe deployed application.
The error in -susaas-srv as follows.

{ "level": "error", "logger": "cds", "component_type": "application", "correlation_id": "b048537b-e0b4-44f5-4116-d85f1c83f4f9", "tenant_id": "sap-provisioning", "host": "d3920515trial-spance-dev-susaas-srv.cfapps.us10-001.hana.ondemand.com", "user_agent": "Java/11.0.19", "content_length": "983", "accept": "text/plain, application/json, application/*+json, */*", "authorization": "Bearer ***", "b3": "0fe1452c66a7609539f60e99fb6e1296-39f60e99fb6e1296", "content_type": "application/json", "sap_passport": "<removed>", "traceparent": "00-57339f2a70d6b65e99411c901256527a-0ce868afe6328c20-01", "tracestate": "5b7c6964-f3bef2ea@dt=fw4;d;511b99cd;56dd;25;0;0;136;e830;2h01;3h511b99cd;4h56dd;5h01", "x_b3_spanid": "39f60e99fb6e1296", "x_b3_traceid": "0fe1452c66a7609539f60e99fb6e1296", "x_cf_applicationid": "5140b746-be29-4a26-b7de-253c56b31844", "x_cf_instanceid": "778b8c24-80d6-486c-5492-cc29", "x_cf_instanceindex": "0", "x_correlationid": "b048537b-e0b4-44f5-4116-d85f1c83f4f9", "x_dynatrace": "FW4;-205589782;13;1360763341;22237;37;1534880100;310;e830;2h01;3h511b99cd;4h56dd;5h01", "x_forwarded_for": "52.202.170.155, 10.0.200.1", "x_forwarded_proto": "https", "x_request_start": "1684962859818", "x_scp_request_id": "3f23ad5a-84a8-42b9-9f52-1937c1e24c2f-646E7E29-26E55", "x_vcap_request_id": "ab41650f-563d-4701-5cf8-32f1ff4e5f36", "x_correlation_id": "b048537b-e0b4-44f5-4116-d85f1c83f4f9", "timestamp": "2023-05-24T21:14:30.372Z", "msg": "HDI deployment failed with exit code 1", "stacktrace": [ "Error: HDI deployment failed with exit code 1", "at /home/vcap/app/node_modules/@sap/cds/bin/deploy/to-hana/hdiDeployUtil.js:124:35", "at ChildProcess.<anonymous> (/home/vcap/app/node_modules/@sap/hdi-deploy/library.js:102:14)", "at ChildProcess.emit (node:events:513:28)", "at maybeClose (node:internal/child_process:1091:16)", "at ChildProcess._handle.onexit (node:internal/child_process:302:5)", "at Process.callbackTrampoline (node:internal/async_hooks:130:17)" ], "layer": "cds", "tenant_subdomain": "sap-provisioning" }
Complete log files of susaas-srv ->
susaas-Spance_dev-2023-05-24 21_23_56.304+0000.txt

Could you please help me which step I miss ?
Regards.

Error when deploying susaas-db-com

Hi,

I'm trying to follow the steps from here, deploying the application in the BTP Trial using the BAS, but the deployment fails for the susaas-db-com-dev service with:

ERR! network request to http://nginx-redirector.repo-cache.svc.cluster.local/repository/appstudio-npm-group/@sap/hdi-deploy/-/hdi-deploy-4.5.1.tgz failed, reason: getaddrinfo ENOTFOUND nginx-redirector.repo-cache.svc.cluster.local

Full log: susaas-db-com-dev-2022-11-14 14 06 33.329+0000.txt

When googling, I found this discussion in the SAP Community: https://answers.sap.com/questions/13588682/deploy-error-when-using-cap-and-hana-database.html
But I was expecting the sample to work out of the box, without doing any changes to the npm registry, deleting the package-lock.json or anything else. Can you confirm/recreate this issue on the trial landscape?

Thanks & KR
Nico

Missing API Service Broker instance

Hi @alperdedeoglu,

me again :-)
I finally had time to work through the next chapter 04 but again I'm stuck.

Step 1.) I could successfully subscribe from a consumer subaccount.
grafik

Step 2.) But unfortunately, there is no API Service Broker instance (Sustainable SaaS API dev) I can subscribe to.
Can you give me any hint, what and where I can check to fix this?
grafik

Thanks!

There is one other thing I wonder about. I tried to directly open the approuter url from the provider account, but this leads to an HANA XS Advanced login. Is this the normal behavior?! Just wanted to check if I can view the application frontend this way.

grafik

When hitting "Go to Application" from the subscriber account, the route was missing. Therefore I created a new route for my subscribed tenant, and this route seems to open the launchpad/application correctly.
grafik

grafik

I'm still trying to understand how the saas-registry and approuter work together, as I could not find any documentation on that.
I guess the provisioning logic here and the service handler here are responsible for creating the necessary URL (which is maybe also provided to the approuter in some way?!) which then needs to be created as a route?

Thanks & BR
Nico

Documentation update

Dear SuSaas Team,

can You please confirm and update the docu if You also think, that testing WebApplications in step 2.1 is not possible, just in step 2.2 ?

So the green part of the docu should go to from 2.1 to 2.2.

image

Until the default-env.json.sample is not renamed to default-env.json

image

the ui5 resources cannot be served when executing npm run start:local in the app/approuter folder
image

Thank You

Best regards, Attila

Target Mapping/Tile Restriction based on User Roles

Hi SuSaaS Team,

I am getting this dialog when accessing the Manage Users Tile

image

I understood the reason, this is because the user is not Admin, just has the Member role, despite he can see the Admin Group/Manage Users tile.

Can we restrict the visibility of tiles/groups/target mappings based on the Role Collections we defined to avoid user confusion ?

We have the fioriSandboxConfig.json/js files. Can we make the launchpad config dynamic using the js script (we have a user api call already ) or use a binding in the json file like this

image

and call to an API during UI5 bootstrapping and setting the ui5 model with visibility configurations ?

Would it be actually acceptable such for production scenario, or we have to expose the encapsulated applications differently to a launchpad service/ work zone in production cases ?

Is actually possible for example to create the frontends in separate projects for SaaS solutions and manage the tile visibility by launchpad service / work zone authorizations ?

Thank You,
Best regards
Attila

Hybrid development with SAP Business Application Studio

Hello,

First of all thank you for all this content. I have been using it as a reference for my first SaaS project and it's been very helpful so far.

For my project I have been trying to get hybrid development working using "How to do local/hybrid development" from the expert scope as a reference. If I'm not mistaken the guide is written for development with Visual Studio Code since it's using localhost:5000 in step 2.5 from the hybrid development section.

I'm working with SAP Business Application Studio and I'm having difficulties getting step 2.5 to work. What I did is I replaced localhost:5000 by the cloud variant, so I replaced localhost:5000 by port5000-workspaces-ws-xxxxx.eu10.applicationstudio.cloud.sap.
In front of this cloud variant of the localhost I put the subdomain of the consumer like in your guide.
However, this gives the following error which I'm unable to resolve:
image

Do you have an idea how to get hybrid development working with SAP Business Application Studio?

Regards, Daan

Documentation update to latest project structure

Hello here on this great repository,

I'd like to ask You to update the documentation to the latest project structure. This topic is complex enough and would be support understanding the basic components and their responsibilities of the solution in the first steps :):

https://github.com/SAP-samples/btp-cf-cap-multitenant-susaas/blob/main/docu/2-basic/1-understand-repo-structure/README.md

Some folder do not exists anymore, the hierarchy, structure and names changed etc., especially in the app folder.

Current documentation

image

Project

image

Thank You

Kind regards
Attila

SAP Build Work Zone Integration

Hi,

First thanks for your amazing resource here. It is really really helpful and saved my life multiple times while setting up my saas application.
What I am still missing is a use case for a Build Work Zone Integration. I understand that in this example a "full solution" (including an own launchpad etc..) - In our case we have a "simple" application which should be integrated into existing customer portals (i.E. build work zone) - we do not want/need an own link.

My understanding: Tiles are possible using "link-based-navigation" only - for a direct integration (especially over multiple global-accounts) is not really planned. As link-based integration is also not really working out of the box (approuter config is required) a short explanation might be helpful.

Thanks again,
Timo

Missing parameter subaccountId for function registerBTPServiceBroker?

Hi @martinfrick and @alperdedeoglu,

I'm trying to understand more details how the Service Broker will appear in the marketplace of the consumer subaccounts that subscribed the multitenant app. I think this is triggered during subscription in srv/utils/automator.js#L27 by calling the registerBTPServiceBroker function. But to me it seems that the parameter subaccountId which is passed to the unregisterBTPServiceBroker function is missing here. That way there will not be a subaccount specific registration. Also the deletion will fail as the registration that is searched for does not exist.

Looking forward for your clarification.

Best Regards
Gregor

There are no applications in this space

Hello here,

deployment, subscription and creating the API as described in the BASIC branch was successful. However when trying to establish the binding at 2.5. You can now create a Service Binding here displays the following message:
image

The API instance is in DEV space. I was able to create only new keys but no bindings:
image

After the subscription the application is visible under the subaccount but no applications are under the space.

image

Can You please advise ?

Thank You

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.