-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'multi-tenant' of 'https://github.com/jjmerchante/grimoi…
…relab-sortinghat' Merges #755 Closes #755
- Loading branch information
Showing
28 changed files
with
948 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from .testing import * # noqa: F403,F401 | ||
from .testing import SQL_MODE, DATABASES | ||
|
||
|
||
DATABASES.update({ | ||
tenant: { | ||
'ENGINE': 'django.db.backends.mysql', | ||
'USER': 'root', | ||
'PASSWORD': 'root', | ||
'NAME': tenant, | ||
'OPTIONS': { | ||
'charset': 'utf8mb4', | ||
'sql_mode': ','.join(SQL_MODE) | ||
}, | ||
'TEST': { | ||
'NAME': tenant, | ||
'CHARSET': 'utf8mb4', | ||
'COLLATION': 'utf8mb4_unicode_520_ci', | ||
}, | ||
'HOST': '127.0.0.1', | ||
'PORT': 3306 | ||
} | ||
for tenant in ['tenant_1', 'tenant_2'] | ||
}) | ||
|
||
DATABASE_ROUTERS = [ | ||
'sortinghat.core.middleware.TenantDatabaseRouter' | ||
] | ||
|
||
TEST_RUNNER = 'tests.runners.OnlyMultiTenantTestRunner' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: Multi-tenancy mode | ||
category: added | ||
author: Jose Javier Merchante <jjmerchante@bitergia.com> | ||
issue: null | ||
notes: > | ||
SortingHat allows hosting multiple instances with a single service having each | ||
instance's data isolated in different databases. | ||
To enable this feature follow these guidelines: | ||
- Set `MULTI_TENANT` settings to `True`. | ||
- Define the tenants in `sortinghat/config/tenants.json`. | ||
- Assign users to tenants with `sortinghat-admin set-user-tenant` command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"tenants": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.