How to setup mod-consortia locally
Prerequisite
You will need these tools:
Vagrant
PostgreSQL
Postman
Deploying module on Vagrant
Follow these steps:
How to run folio backend modules with IntelliJ Idea and interact with Vagrant box environment
(use this file as an example. it includes Kafka port, PostgreSQL port and some extra functionalities which help vagrant works smoothly)
Postman Collection for Mod-Consortia (it include all basic API request) -
Result:
default port: 8081 for mod-consortia. your requests from postman collection (get list of tenant request) works expected
kafka properties for environment variables: KAFKA_HOST=localhost;KAFKA_PORT=9092;ENV=FOLIO.
put kafka variables in your Machine Environment variables:
Create a tenant locally
If everything is working well until this step, Let's move on to creating tenants locally.
Theory:
Mod-Consortia ER Diagram:
Before creating a tenant, we need to understand why create a tenant locally and use.
If we create a new tenant, we will create schemas for this tenant.
These are tenants. if we enable the module for the tenant, it will create a new schema for this tenant
For example
we created testtenant1
enabled mod-user(mod-users-19.2.0-SNAPSHOT.221)
new schema testtenant1_mod_user created inside Schemas
Mod-consortia stores tenant information inside the tenant table
To create shadow users and work with assigning/unassigning affiliations, we need these tenants. Let's see how to assigning/unassigning user and create shadow user.
Created affiliation with testtenant1 and user.
Get shadow user with x-okapi-tenant: testtenant1
test
Process (Let's start to setup):
Create a tenant (testtenant1)
create a consortium (it will be only one consortium)
create tenant
enable mod-users for tenant
New schema will be created (testtenant1_mod_user → testtenant1 - tenant name, mod_user - enabled module)
Assigning/unassigning process and creating shadow user:
Create a user
This user also will be created in db primary affiliation with primary tenant (diku)Then, Create assign affiliation with testtenant
Get user list to see whether it is created or not. This assigned affiliation creates a shadow user for testtenant1. This user stored in testtenant1_mod_users
you will see user active: true. If you unassigned this user for testtenant1 it will be false
This is how you can create tenants locally and setup multiple tenants. After that If you want to do more operations with tenants locally look at this flow
deletion of user tenant associations - https://github.com/folio-org/mod-consortia/pull/24 (full flow documented with screenshot)