Hi ABP support team We a using abp commercial
- UI framework: angular
- ABP Version: 7.2.3
- Data access: MongoDB This solution deployed to AKS and running Currently, we want to enable and implement multitenancy feature on this solution. With each tenant is initialized , I need each tenant to have its own database , logo and branch name
64 Answer(s)
-
0
Hi,
It's possible.
You can check the document:
- https://docs.abp.io/en/abp/latest/Multi-Tenancy
- https://docs.abp.io/en/commercial/latest/modules/saas
logo and branch name
You can custom the brand component to display a different brand and logo for each tenant https://docs.abp.io/en/commercial/latest/themes/lepton-x/angular#brand-component
-
0
Hi liangshiwei I implemented with the document: https://docs.abp.io/en/abp/latest/Multi-Tenancy It works on local, But I got the error after deployed to AKS, Can you suggest solution for this. We are using mongo db replicaset, and the error mesage shows like below:
A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "4", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [] }.
-
0
Hi,
Could you share the full error logs? thanks.
-
0
Hi liangshiwei Here is the log:
A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "4", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [] }. System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "4", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [] }. at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description) at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask) at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken) at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken) at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken) at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken) at MongoDB.Driver.MongoClient.StartImplicitSession(CancellationToken cancellationToken) at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken) at MongoDB.Driver.MongoDatabaseImpl.UsingImplicitSession[TResult](Func
2 func, CancellationToken cancellationToken) at MongoDB.Driver.MongoDatabaseImpl.ListCollectionNames(ListCollectionNamesOptions options, CancellationToken cancellationToken) at Volo.Abp.MongoDB.MongoModelBuilder.CreateCollectionIfNotExists(AbpMongoDbContext dbContext, String collectionName) at Volo.Abp.MongoDB.MongoModelBuilder.Build(AbpMongoDbContext dbContext) at Volo.Abp.MongoDB.MongoModelSource.CreateModel(AbpMongoDbContext dbContext) at Volo.Abp.MongoDB.MongoModelSource.<>c__DisplayClass1_0.<GetModel>b__0(Type _) at System.Collections.Concurrent.ConcurrentDictionary
2.GetOrAdd(TKey key, Func2 valueFactory) at Volo.Abp.MongoDB.AbpMongoDbContext.InitializeCollections(IMongoDatabase database) at LogisticsTico.MongoDB.MongoDbLogisticsTicoDbSchemaMigrator.MigrateAsync() in D:\datdv\project\CShap\final_project\LogisticsTico\aspnet-core\src\LogisticsTico.MongoDB\MongoDb\MongoDbLogisticsTicoDbSchemaMigrator.cs:line 49 A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "4", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [] }. System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "4", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [] }. at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description) at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask) at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken) at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken) at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken) at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken) at MongoDB.Driver.MongoClient.StartImplicitSession(CancellationToken cancellationToken) at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken) at MongoDB.Driver.MongoDatabaseImpl.UsingImplicitSession[TResult](Func
2 func, CancellationToken cancellationToken) at MongoDB.Driver.MongoDatabaseImpl.ListCollectionNames(ListCollectionNamesOptions options, CancellationToken cancellationToken) at Volo.Abp.MongoDB.MongoModelBuilder.CreateCollectionIfNotExists(AbpMongoDbContext dbContext, String collectionName) at Volo.Abp.MongoDB.MongoModelBuilder.Build(AbpMongoDbContext dbContext) at Volo.Abp.MongoDB.MongoModelSource.CreateModel(AbpMongoDbContext dbContext) at Volo.Abp.MongoDB.MongoModelSource.<>c__DisplayClass1_0.<GetModel>b__0(Type _) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func
2 valueFactory) at Volo.Abp.MongoDB.AbpMongoDbContext.InitializeCollections(IMongoDatabase database) at LogisticsTico.MongoDB.MongoDbLogisticsTicoDbSchemaMigrator.MigrateAsync() in D:\datdv\project\CShap\final_project\LogisticsTico\aspnet-core\src\LogisticsTico.MongoDB\MongoDb\MongoDbLogisticsTicoDbSchemaMigrator.cs:line 49 -
0
Hi,
It looks like a problem with the MongoDB driver.
Here is some information that might be useful: https://www.google.com/search?q=WaitForDescriptionChangedHelper+site:www.mongodb.com&sxsrf=AB5stBggHEDVtpC-rhwe1L8woOD-mncgJg:1691032670349&sa=X&ved=2ahUKEwiJqvrMw7-AAxWbHHAKHUEzAcIQrQIoBHoECBMQBQ&biw=1920&bih=857&dpr=2
-
0
Thanks liangshiwei reply for me! I have one more question to ask. Yesterday, I tried the following steps:
- use <db_name> in mongo db
- create tenant in UI angular with format connectionString: mongodb://<user>:<password>@<replicaset_name>/<db_name>
I got the error: Cannot create namespace <db_name>.AbpPermissionGrants in multi-document transaction Is it also to this problem?
-
0
I have one more question to ask. I want one tenan to have its own domain, Can you suggesst for me implement solution this? And I also want the way how to implement it both of following solutions:
- Authentication is not separated module
- Authentication is a separated module
-
0
use <db_name> in mongo db
create tenant in UI angular with format connectionString: mongodb://<user>:<password>@<replicaset_name>/<db_name> I got the error: Cannot create namespace <db_name>.AbpPermissionGrants in multi-document transaction
I will check it.
-
0
I have one more question to ask. I want one tenan to have its own domain, Can you suggesst for me implement solution this? And I also want the way how to implement it both of following solutions: Authentication is not separated module Authentication is a separated module
Please create a new question, thanks.
-
0
Thanks liangshiwei!
-
0
Hi liangshiwei I want one tenan to have its own domain, Can you suggesst for me implement solution this?
-
0
Hi,
I think the document can help you:
https://docs.abp.io/en/abp/latest/Multi-Tenancy#determining-the-current-tenant
ABP provide the domain tenant resolve
https://docs.abp.io/en/abp/latest/Multi-Tenancy#domain-subdomain-tenant-resolver
-
0
Thanks liangshiwei I have one more question to ask. Yesterday, I reviewed feature multitenant in my local, I see create first tenant has initialized all collections that host tenant has. But when I create second tenant , I dont see it initialized all collections like host tenant.(Host tenant has about 60 collections, first tenant has 60 collections as host tenant, second tenant has only 7 collections) Is this is bug? How can I resolve ?
-
0
Hi,
Sorry, I didn't get it, could you share some screenshots? thanks.
-
0
Hi liangshiwei Here is the screenshorts
screenshort List db for main tenant - because we have more than 60 collections, a image cannot capture all colelctions:
screenshort List collections for first tenant - it have enough collection:
screenshort List collection for second tenant - it only has 7 collections:
-
0
Hi,
I think the document can help you:
https://docs.abp.io/en/abp/latest/Multi-Tenancy#determining-the-current-tenant
ABP provide the domain tenant resolve
https://docs.abp.io/en/abp/latest/Multi-Tenancy#domain-subdomain-tenant-resolver
Thanks! I'm newbie of ABP framework! I think it is more efficience to make some online meeting. We can easily do it step by step?
-
0
Here is the screenshorts
screenshort error:
This looks like a problem, I'll check it
We can easily do it step by step?
This is a big topic, you can try to implement, if you encounter problems, we will be happy to help you
-
0
Here is the screenshorts
screenshort error:
This looks like a problem, I'll check it
We can easily do it step by step?
This is a big topic, you can try to implement, if you encounter problems, we will be happy to help you
Thanks liangshiwei, I looking forward to your response
-
0
Hi liangshiwei, I want to modify SaaS module so that each tenant has its own logo, company name, and domain. When users access their tenant domain (url), the application automatically switch to their tenant with their own logo and company name. Could you please advise me steps to implement this feature in order to follow ABP best practices. Many thanks in advance.
-
0
Thanks liangshiwei, I looking forward to your response
The
Collections
will be created dynamically, you can ignore this problem, we have suppressed this error message in the latest versionI want to modify SaaS module so that each tenant has its own logo, company name, and domain. When users access their tenant domain (url), the application automatically switch to their tenant with their own logo and company name. Could you please advise me steps to implement this feature in order to follow ABP best practices. Many thanks in advance.
In short, there are two steps.
- Override the component
- Use logical checks to display different logos
You can custom the brand component
- https://docs.abp.io/en/commercial/latest/themes/lepton-x/angular#brand-component
And for auth server login page you can override the account layout page
https://docs.abp.io/en/commercial/latest/themes/lepton-x/mvc#account-layout
For example (Auth server login page)
https://gist.github.com/realLiangshiwei/1f284183284f611fd6fe5bb0890bd781
You can download the LeptonX theme source code via ABP Suite
-
0
Hi liangshiwei I'm using Authentication is not separated module. How i can custom login page on my solution? Could you please show me where is the login page inside the source code, please give me a screen shot of login page. The Collections will be created dynamically So how long collections will be created?
-
0
I'm using Authentication is not separated module. How i can custom login page on my solution? Could you please show me where is the login page inside the source code, please give me a screen shot of login page.
Source code is here: https://gist.github.com/realLiangshiwei/1f284183284f611fd6fe5bb0890bd781
You need to put the in the
Themes/LeptonX/Layouts/Account
folder of the.AuthServer
project:This is actually explained in the document : )
The Collections will be created dynamically So how long collections will be created?
When the collection will be created the first time it is used
-
0
When the collection will be created the first time it is used
I mean how many minutes does it need to create collections and how many minutes does it need to create initialized data Let say when I create tenant at 14:00, so it takes 5 minutes to create all collection and initialized data, right?
You need to put the in the Themes/LeptonX/Layouts/Account folder of the .AuthServer project
When I creating solution I choose not to separate option, so that in project. AuthServer module is not a separated module Currently, I want to custom the login page, Could you please show me where is the login page inside the source code, please give me a screen shot of login page. (Because the Auth server is not an separated module, if you have any source code that config like this, please send me )
-
0
-
0
here is the screen short my solution:
Should be
.HttpApi.Host
project.