Giter Site home page Giter Site logo

saphanaacademy / generator-saphanaacademy-saas Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 6.0 1.82 MB

Yeoman Generator for SAP Cloud Platform Multitenant SaaS Apps

License: Apache License 2.0

JavaScript 81.66% HTML 0.98% Makefile 7.08% Dockerfile 1.20% Smarty 9.08%

generator-saphanaacademy-saas's Introduction

generator-saphanaacademy-saas NPM version Build Status Dependency Status

Yeoman Generator to jump-start BTP Multitenant SaaS Apps

Installation

First, install Yeoman and generator-saphanaacademy-saas using npm

npm install -g yo
npm install -g generator-saphanaacademy-saas

SAP BTP, Cloud Foundry runtime

We assume you have pre-installed node.js and the Cloud Foundry CLI with the multiapps plugin.

In order to build the project ensure the Cloud MTA Build Tool (MBT) is installed.

This is already the case for SAP Business Application Studio.

If using SAP HANA Cloud ensure you have created an instance and have configured a database mapping to the SAP BTP, Cloud Foundry runtime org and space that you will be deploying to.

Ensure that you are logged in to the SAP BTP, Cloud Foundry runtime CLI and are targeting the org and space into which you want to deploy the app.

To generate your new project:

yo saphanaacademy-saas

NB: If you prefer a rich user experience when generating your projects consider the Application Wizard.

SAP BTP, Kyma runtime

We assume you have pre-installed node.js, have a Docker Hub ID and the ability to build and push containers either via Docker Desktop or an alternative such as Paketo Builder with the pack CLI, Rancher Desktop or podman or a CI/CD pipeline with kaniko.

The Kubernetes command-line tool kubectl is required with the kubelogin extension.

In order to build or deploy the project via the Makefile ensure that GNU Make is installed.

In order to deploy the project ensure that Helm is installed or use a CI/CD pipeline.

If using SAP HANA Cloud ensure you have created an instance and have configured a database mapping to the SAP BTP, Kyma runtime namespace that you will be deploying to.

Ensure that you have set the KUBECONFIG environment variable, have optionally created a namespace into which you would like to deploy the project and are logged in to Docker Hub. For example:

Mac/Linux:

chmod go-r {KUBECONFIG_FILE_PATH}
export KUBECONFIG={KUBECONFIG_FILE_PATH}
kubectl create ns dev
docker login

Windows:

$ENV:KUBECONFIG="{KUBECONFIG_FILE_PATH}"
kubectl create ns dev
docker login

You can also specify the path to your Kubeconfig file in the generator.

To generate your new project:

yo saphanaacademy-saas

NB: If you prefer a rich user experience when generating your projects consider the Application Wizard.

To build and push your project containers to Docker Hub:

cd <projectName>
make docker-push

If you prefer, you can issue the build & push commands manually (see the generated /Makefile) or use a CI/CD pipeline.

To deploy your new project to SAP BTP, Kyma runtime:

cd <projectName>
make helm-deploy

If you prefer, you can issue the helm commands manually (see the generated /Makefile) or use a CI/CD pipeline.

To undeploy your new project from SAP BTP, Kyma runtime:

cd <projectName>
make helm-undeploy

Important

Please pay special attention to messages produced by the generator!

Video Tutorials

For hands-on video tutorials click here.

Getting To Know Yeoman

  • Yeoman has a heart of gold.
  • Yeoman is a person with feelings and opinions, but is very easy to work with.
  • Yeoman can be too opinionated at times but is easily convinced not to be.
  • Feel free to learn more about Yeoman.

License

Copyright (c) 2022 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.

generator-saphanaacademy-saas's People

Contributors

saphanaacademy avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

generator-saphanaacademy-saas's Issues

Do we need standalone/managed app router to get rea.authInfo.checkLocalScope()..?

Hello,

I am trying to build a multi-tenant application by using the below series of videos on youtube.

https://www.youtube.com/watch?v=E816z61O_S8&list=PLkzo92owKnVx3Sh0nemX8GoSNzJGfsWJM&index=1&ab_channel=SAPHANAAcademy

Do we need standalone/managed app router to get rea.authInfo.checkLocalScope()..?

Or app folder will consider as approuter..?
image

I am trying to get scope by using the below methods but I am not getting?
Can you help to get scopes?

console.log("reqObj",req.authInfo);
console.log("checkLocalScope",req.authInfo.checkLocalScope('admin'));
console.log("checkLocalScope",req.authInfo.checkLocalScope('enduser'));
console.log("getGrantType: ",req.authInfo.getGrantType());
console.log("getAttribute: ",req.authInfo.getAttribute());
console.log("getAttributes: ",req.authInfo.getAttributes());
console.log("getConfigType: ",req.authInfo.getConfigType());
console.log("getUniquePrincipalName: ",req.authInfo.getUniquePrincipalName());
console.log("getAdditionalAuthAttribute: ",req.authInfo.getAdditionalAuthAttribute());
console.log("uaaUser",req.authInfo.checkScope('uaa.user'));
console.log("reqAuthCheck", req.authInfo.checkScope('trtrialbalacesaasapp!t50889.admin'),req.authInfo.checkScope('$XSAPPNAME.enduser'));
console.log("reqAuthInfoscopes", req.authInfo.scopes);
console.log("reqAuthInfoscopes",req.authInfo.checkLocalScope("otpdev-trtrialbalacesaasapp!t50889.admin"));
if (req.authInfo !== undefined && req.authInfo.checkLocalScope("otpdev-trtrialbalacesaasapp!t50889.admin")){
console.log("checkLocalScope admin");
}
if (req.authInfo !== undefined && req.authInfo.checkLocalScope("otpdev-trtrialbalacesaasapp!t50889.enduser")){
console.log("checkLocalScope User");
}

Regards,
Chamdeep

Using destination as tenant aware services

Hi Team,

We are trying to build a simple mulit-tenant application as per the below link:
https://www.youtube.com/watch?v=9qQ9DB2Clc4&list=PLkzo92owKnVx3Sh0nemX8GoSNzJGfsWJM&index=5

but I do not see that the module.exports does not contain the "getDestination" and its corresponding function in the library.js. Could you please check if something is missing and provide any update in the plugin that is missing. Please let us know if you have any questions. Thank you !

Regards
Srinivas Rao.

Simplify mta by defining global parameter appname

In line with SAP Help a global mta parameter could be set to define the application name.

This then eliminates the need for the application property provided by the html5 app and theapp_api/application can be replaced by ${appname}.

I also like in the sample of SAP Help that all resources have a simple name like 'approuter', 'xsuaa' or 'saas-registry' and then consistently use service-name.

PS: I don't know why this project is using the name of the space in the xsappname, whereas the SAP Help sample is just using ${appname}. Is there a disadvantage for not including the name of the space?
If we don't need it, then it would be simpler to use ${appname} and avoid the need for the additional custom parameter ${xsuaa-app}.

Saas solution update issue

Hi,
when i add a new table to the solution as a update, this newly added table is not getting available for the tenants that are already subscribed to the SaaS solution but a new tenant coming in after the update will get this table How can this be resolved?

Also for the db users generated how can i grant the privilege CREATE ANY to the schema ?
a screenshot of current privilege's are attached, if i can add additional privilege i will be able to generate this tables manually
image

Destinations are not picking from tenant sub accounts

Hi Team,

I am trying to build a multi-tenant application by using the below series of videos on youtube.

https://www.youtube.com/watch?v=E816z61O_S8&list=PLkzo92owKnVx3Sh0nemX8GoSNzJGfsWJM&index=1&ab_channel=SAPHANAAcademy

The provider account has two destinations. The application is working as expected from the provider account.

Subscribed application from Tenant subaccount.

The tenant account has two destinations. Application is not picking the destinations from the Tenant account. It is picked from the Provider subaccount.

I have gone through most of the sap blogs, unfortunately, I didn't find the solution for this problem.

If the application has to pick the destinations from the tenant subaccount do we need to write the additional logic?
If yes, guide us on the steps to write or share the sample code with me?

Could you help me to resolve this issue?

Regards,
Chandeep

Use a destination to store the CF API credentials

Hello SAP HANA Academy Team,

when running this generator and choosing "Yes" for the option "Would you like to include creation/deletion of tenant routes on subscribe/unsubscribe (using the CF API)?" the output after the generation is:

Important: The CF API is being used so please be sure to issue the following CF CLI commands after deployment:

  cf set-env mt-app-srv cf_api_user '<email>'
  cf set-env mt-app-srv cf_api_password '<password>'

I don't think that this is a good practice and would suggest to replace this by suggesting to create a destination named e.g. "CFAPI" with the Authentication OAuth2Password and store all required details there. Using this destination should allow also to use the SAP Cloud SDK for Javascript. As documentd in Authentication and JSON Web Token Retrieval it supports OAuth2Password. So for all requests to the Cloud Foundry API the Generic HTTP Client could be used.

Best Regards
Gregor

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.