This page provides comprehensive documentation for the installation of SPAR Self Service API, a service designed for data mapping within the Social Payments Account and Registry (SPAR) system.
Installation
Prerequisites
Any machine running Linux (e.g., Ubuntu), macOS, or Windows
Python3.10 or later
Git
PostgreSQL
virtualenv
eSignet: Ensure that eSignet is properly configured. Refer to the eSignet Deployment Guide for setup instructions.
SPAR Mapper API Configuration: Ensure that the SPAR Mapper API is properly configured according to the SPAR Mapper API Installation.
Python dependencies
The following dependencies are managed in the installation steps below.
This will seed the database with default values. Make sure to update the eSignet configuration in the DB as per your installation.
PostgreSQL DB Setup
Create a new role/user called sparuser and create a new database called spardb, with sparuser as the owner. No need to run this step, if Postgres was installed through OpenG2P's deployment script.
CREATE ROLE sparuser WITH LOGIN NOSUPERUSER CREATEDB CREATEROLE INHERIT REPLICATION CONNECTION LIMIT -1 PASSWORD 'xxxxxx';
CREATE DATABASE spardb WITH OWNER = sparuser CONNECTION LIMIT=-1;
The following optional Env vars can also be passed.
- `VERSION="1.0.0"` Do not set this if you want latest version.
- `DB_PORT="5432"` Default is 5432.
- `DB_NAME="mydb"` Default is spardb.
- `DB_USER="myuser"` Default is sparuser.
- `DEPLOY_DML="false"` Default is true. If false, will not run DML scripts.
- `LOG_DB_QUERY="true"` Default is false. Logs all Db queries.
Set the following environment variables to configure the spar-mapper-api.
# Database credentials for spar-mapper-api (Update these values as per your installation/setup)
SPAR_SELFSERVICE_DB_DBNAME=openg2p_spar_db
SPAR_SELFSERVIC_DB_HOSTNAME='localhost'
SPAR_SELFSERVIC_DB_USERNAME='sparuser'
# Auth (Update these values as per your installation/setup)
SPAR_SELFSERVICE_AUTH_DEFAULT_ISSUERS=[ "https://esignet.dev.sandbox.net/v1/esignet", "https://keycloak.dev.sandbox.net/realms/sandbox" ]
SPAR_SELFSERVICE_AUTH_DEFAULT_JWKS_URLS=[ "https://esignet.dev.sandbox.net/v1/esignet/oauth/.well-known/jwks.json", "https://keycloak.dev.sandbox.net/realms/sandbox/protocol/openid-connect/certs" ]
# SPAR Mapper API Endpoints (change only if required)
SPAR_SELFSERVICE_MAPPER_API_URL="http://localhost:8007/sync"
SPAR_SELFSERVICE_MAPPER_LINK_PATH="/link"
SPAR_SELFSERVICE_MAPPER_UNLINK_PATH="/unlink"
SPAR_SELFSERVICE_MAPPER_RESOLVE_PATH="/resolve"
SPAR_SELFSERVICE_MAPPER_UPDATE_PATH="/update"
Authentication
The spar-self-service-api supports authentication via eSignet. Refer to the deployment documentation for eSignet here for setup instructions.
Setting up redirection
To integrate the SPAR Self-Service UI with any login provider, you need to add the redirect_uri in the authorization_parameter column.