Multi-tenant Web Store. Downloadable services platform with multi-tenancy.
It is a platform where developers can register and start using the web store. They can publish their software packages so that their registered clients can then download them. In addition, they can publish updates for specific packages and personalize the appearance of their store by modifying the footer fields and color theme.
This software is part of my final degree project from the degree in Mathematics and Computer Science of the University of Granada, years 2018-2023.
The following list shows the software required to execute the platform:
- PostgreSQL 16 or newer:
This should be installed on the database server. For development and testing purposes, we set it up on the same machine as the Web server.
- Python 3.11 or newer:
Also it is required to install all the Python packages in the requirements.txt file.
The maximum number of tenants in this scenario is limited to five.
- Install PostgreSQL version 16.
- Create a user called
mws_user
with some strong password on the PostgreSQL instance. This user must have rights to create databases. In the following steps its password must be wrote on a file in the Django folder structure. - Create a database called
mwsdb
whose owner ismws_user
.
- Clone the MWS source code with
git clone
. - Create a file called
mwsdb_password.txt
in the foldersrc/mws/
of the Django project and write themws_user
password on the previous file. - (Optional) Create a virtual environment on the project root folder and activate it.
- Install the required packages using
pip install -r requirements.txt
. - If you want some sample data to appear on the platform, you can execute in the
'src/' directory the command
python manage.py populate_db <ntenants>
. - This step needs to be made carefully. In order to make the web server accept requests to some subdomains, which is the way the tenants are redirected to their respective stores, we need to modify the host file of the operative system. Back it up before proceeding.
- If you are setting up the platform on Windows, you need to add the following
lines to the file
C:\Windows\System32\drivers\etc\hosts
:
127.0.0.1 mws.local
127.0.0.1 tenant1.mws.local
127.0.0.1 tenant2.mws.local
127.0.0.1 tenant3.mws.local
127.0.0.1 tenant4.mws.local
127.0.0.1 tenant5.mws.local
- If you are on an UNIX-based OS, you need to modify the file
/etc/hosts
by adding the following lines:
127.0.0.1 mws.local
127.0.0.1 tenant1.mws.local
127.0.0.1 tenant2.mws.local
127.0.0.1 tenant3.mws.local
127.0.0.1 tenant4.mws.local
127.0.0.1 tenant5.mws.local
This is the reason why the number of tenants is limited to five, because we would need to modify the host file to add more tenants, something not yet implemented.
- Finally, the last step is to migrate the models to the database created with
python manage.py migrate
.
Once in the src/
directory, to run the server on the localhost is just necessary to
execute python manage.py runserver
and the IP address and port of the web application
will appear on screen.