当前位置:网站首页>SaaS application development guide

SaaS application development guide

2022-06-22 17:56:00 Hua Weiyun

Catalog

SaaS project
        SaaS Application development guidance
        SaaS application Samples
        SaaS Multi tenancy routing plug-in
        Services with different architectures SaaS The solution
                 Monomer architecture
                 Microservice architecture
                 k8s framework (CCE)
                 Istio framework
        Exclusive resource mode SaaS Service development
                 Resource preparation of exclusive resource mode
        Shared resource mode SaaS Service development
                 Tenant identification
                 Tenant routing
                 Resource allocation of shared resource pool mode
        Tenants' personalized needs
                 Personalized configuration
                 Metadata driven design
                 Tenant business customization
                 Tenant process customization
        Tenant management
                 Tenant account system
                 Tenant registration
        SaaS The system operational
                 Deploy
                 CICD
                 Stretch and stretch
                 Service release
                 System observability
                         Tenant log data collection and analysis
        SaaS System operation
                 SaaS Service billing policy
                 SaaS Operational data analysis

SaaS project

SaaS Application development guidance

https://support.developer.huaweicloud.com/doc/zh-cn_topic_0000001271256348-0000001271256348

SaaS application Samples

https://gitee.com/HuaweiCloudDeveloper/saas-housekeeper

SaaS Multi tenancy routing plug-in

https://gitee.com/HuaweiCloudDeveloper/saas-tenant-router-starter

 

Services with different architectures SaaS The solution

Monomer architecture

《 Stay tuned 》

Microservice architecture

《 Stay tuned 》

k8s framework (CCE)

 《 Stay tuned 》

Istio framework

 《 Stay tuned 》

Exclusive resource mode SaaS Service development

Exclusive resource mode SaaS Services can be implemented in several modes on Huawei cloud , For example, account isolation ,vpc Isolation , Subnet isolation, etc , There is nothing special to pay attention to in application development , Focus on resource preparation and rapid deployment

Resource preparation of exclusive resource mode

  《 Stay tuned 》

Shared resource mode SaaS Service development

Tenant identification

The service should identify the tenant corresponding to the request , There are usually two ways , First, according to the domain name , Second, the name of the tenant

Tenant routing

According to the different isolation methods of tenants , The tenant routing strategy is also different , It is explained in detail in our application development guide

housekeeper The project adopts domain name identification , This project uses api gateway , When the user requests to enter api The gateway can recognize the domain name requested by the user , Exclusive to the tenant domain Assign request header

https://gitee.com/HuaweiCloudDeveloper/saas-housekeeper/blob/master-dev/saas-housekeeper-gateway/src/main/java/com/huawei/housekeeper/gateway/filter/DomainFilter.java

In the microservice, the request header content will be obtained , Identify tenants

https://gitee.com/HuaweiCloudDeveloper/saas-housekeeper/blob/master-dev/saas-housekeeper-tenant-router-starter/src/main/java/com/huawei/saashousekeeper/interceptor/TenantDomainFilter.java

Storage of tenant identity , Tenant ID usage per request HystrixRequestVariableDefault Storage , See also :

https://gitee.com/HuaweiCloudDeveloper/saas-tenant-router-starter/blob/master-dev/src/main/java/com/huawei/saas/config/TenantContext.java

For tenant routing, please refer to the open source plug-ins we rely on

https://gitee.com/HuaweiCloudDeveloper/saas-tenant-router-starter

When a microservice invokes other services , The context needs to carry the tenant id

For example, inter service requests , Through the Interceptor at openfeign Add the tenant ID in the request header of :

https://gitee.com/HuaweiCloudDeveloper/saas-tenant-router-starter/blob/master-dev/src/main/java/com/huawei/saas/interceptor/FeignRequestInterceptor.java

For example, database requests , Switch database source and schema:

https://gitee.com/HuaweiCloudDeveloper/saas-tenant-router-starter/blob/master-dev/src/main/java/com/huawei/saas/interceptor/MybatisSchemaInterceptor.java

Resource allocation of shared resource pool mode

   《 Stay tuned 》

Tenants' personalized needs

Personalized configuration

Tenants will want to have an enterprise personalized display on their own applications , You need to allow tenants to configure their own enterprise elements , for example logo, Page style, etc

for example housekeeper In the service, the tenant can configure the page style of its own tenant service

https://gitee.com/HuaweiCloudDeveloper/saas-housekeeper/blob/master-dev/saas-housekeeper-service-publish-service/src/main/java/com/huawei/housekeeper/service/impl/StyleCustomizationServiceImpl.java

Metadata driven design

The metadata design of tenants can be understood as making the structure and content of some entities configurable , for example housekeeper In the project , The service published by the service can define the specifications and meanings of various dimensions of the service

https://gitee.com/HuaweiCloudDeveloper/saas-housekeeper/blob/master-dev/saas-housekeeper-service-publish-service/src/main/java/com/huawei/housekeeper/service/impl/HouseKeeperServiceSkuServiceImpl.java

Tenant business customization

    《 Stay tuned 》

Tenant process customization

    《 Stay tuned 》

Tenant management

Tenant account system

SaaS Accounts can be divided into two ways from the scope dimension

One is common in the system , One is common in the tenant domain , Specific see SaaS Application development documentation

housekeeper The project adopts the account system of the tenant domain , See the project jwt Generation :

https://gitee.com/HuaweiCloudDeveloper/saas-housekeeper/blob/master-dev/saas-housekeeper-userinfo-service/src/main/java/com/huawei/housekeeper/utils/JwtGenerateTokenUtil.java

Tenant registration

Tenants can use SaaS The management service registers its own information , Obtain tenant rights through business operations , from SaaS admin The role is responsible for opening the tenant account .

 

SaaS The system operational

Deploy

《 Stay tuned 》

CICD

《 Stay tuned 》

Stretch and stretch

《 Stay tuned 》

Service release

《 Stay tuned 》

System observability

Tenant log data collection and analysis

  The log data needs to obtain the identity of the tenant

See our tenant routing design , Tenant identification is stored in sfl4j Framework of the MDC in , Just reference it in the log output format

https://gitee.com/HuaweiCloudDeveloper/saas-tenant-router-starter/blob/master-dev/src/main/java/com/huawei/saas/interceptor/TenantDomainFilter.java

 

SaaS System operation

SaaS Service billing policy

SaaS The application is generally charged by renting , Instead of a one-time buyout like traditional software . So for SaaS For manufacturers , For different product businesses 、 Customer base 、 Market positioning and business strategy , Developing the most appropriate billing strategy is particularly important .

    https://support.developer.huaweicloud.com/doc/zh-cn_topic_0000001321576393-0000001321576393

SaaS Operational data analysis

原网站

版权声明
本文为[Hua Weiyun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221614013125.html