Multitenancy
Introduction to Multitenancy
One of the amazing features of Saltcorn is multitenancy.
From a single hosting you can run a few Saltcorn sites.
Switch to Multitenancy mode
-
Assumption: You have installed Saltcorn using instruction Install on Ubuntu
-
To switch to multitenancy mode you need to logon to your server as a Saltcorn user.
If you were root user before:
su - saltcorn
- Go to ~./.config folder and backup your .saltcorn file. This is the main config of your installation.
cd ~./.config
cp .saltcorn .saltcorn.original
- Open the file:
nano ~/.config/.saltcorn
- Find multi_tenant variable and set it to true.
"multi_tenant":true
- Return to root user and restart Saltcorn service
exit
systemctl restart saltcorn
- Check the service status
systemctl status saltcorn
- To create a new tenant
Go to your saltcorn url, e.g. http://mydomain.com/tenant/create and follow the instructions.
Multitenancy with Digital Ocean
The root domain is the main domain from where other domains will be directed. You will create a Tenant sub-domain, eg. tenant.example.com. This will then be redirected to the new URL, eg. tenant.com
Create a new tenant
Settings / Site structure / Tenants > Create new tenant
Application name tenant.example.com > Create
Note: If you are moving a site, you can build the new site in the subdomain (tenant.example.com) and then complete the next steps
Change DNS
At your domain provider, add the IP address from Digital Ocean of the root domain.
Set base the URL
Settings / About application / Site identity > Base URL The URL at which your site is available. For instance, https://tenant.com/
Restart server
Settings / About application / System > Restart server