A user management portal for iNethi that uses React and Django.
- Ensure your server can locate
paum.inethilocal.net
,keycloal.inethilocal.net
, etc.
- Ensure you have keycloak and traefik running and a volume folder to store data at
/mnt/data/inethi_user_management_mysql
. Set up a keycloak client found in the config file. Use local or prod version, depending on whether you're building a prod or test version, but make sure to name the client 'portal-local' in the keycloak UI to ensure the code works. Recreate your JWT credentials after importing the client to ensure your credentials are unique to you. - run the build script located at
payment-and-management/build.sh
:
./build.sh
- Ensure you have traefik running with a keycloak instance running.
- Ensure a keycloak client is set up for both django and react purposes. The configs can be found in here and can be imported when creating a new client. Recreate your JWT credentials after importing the client to ensure your credentials are unique to you.
- Start a mysql database for the django backend by running the build script here:
./build.sh
- Set up and run the backend
- To do this you will need to edit your
settings.py
file here to look like this:
- To do this you will need to edit your
DATABASES = {
'default': {
# MySQL engine. Powered by the mysqlclient module.
'ENGINE': 'django.db.backends.mysql',
'NAME': 'inethi-user-management-api',
'USER': 'root',
'PASSWORD': '',
'HOST': '0.0.0.0',
# 'HOST': 'inethi-user-management-mysql',
'PORT': '3316',
},
# 'radiusdeskdb': {
# 'NAME': 'rd',
# 'ENGINE': 'django.db.backends.mysql',
# 'USER': 'rd',
# 'PASSWORD': 'rd',
# 'HOST': 'inethi-radiusdesk-mariadb',
# 'PORT': '3306',
# }
}
-
Start the backend from the backend directory in this repo here by running:
-
python manage.py migrate
-
python manage.py makemigrations inethi_management_app
-
python manage.py migrate
-
python manage.py createsuperuser
-
python manage.py create_dummy_data
-
python manage.py runserver
-
Start the frontend from here:
npm start
- Navigate to
payment-and-management/front-end/inethi-portal/src/pages
and change the linesaxios.defaults.baseURL =
variable to have a value of'http://127.0.0.1:8000';
- Navigate to the front end in your browser. Login with a keycloak user and test the app.
- portal-local client: a public client used to authenticate users when they want to make an API call and login to the React app. It allows the backend token-based authentication.