How to setup mod-consortia locally

Prerequisite

You will need these tools:

  • Vagrant
  • PostgreSQL
  • Postman

Deploying module on Vagrant

Follow these steps:

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

  1. we created testtenant1
  2. enabled mod-user(mod-users-19.2.0-SNAPSHOT.221)
  3. 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.

  1. Created affiliation with testtenant1 and user.

  2. Get shadow user with x-okapi-tenant: testtenant1 

    test


Process (Let's start to setup):

Create a tenant (testtenant1)

  1. create a consortium (it will be only one consortium)




  2. create tenant 




  3. enable mod-users for tenant




  4. New schema will be created (testtenant1_mod_user → testtenant1 - tenant name, mod_user - enabled module)



Assigning/unassigning process and creating shadow user:

  1. Create a user



    This user also will be created in db primary affiliation with primary tenant (diku)



  2. Then, Create assign affiliation with testtenant




  3. 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)