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.
Create a '.env' file and configure database credentials
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='spardb'
SPAR_SELFSERVIC_DB_HOSTNAME='localhost'
SPAR_SELFSERVIC_DB_USERNAME='sparuser'
SPAR_SELFSERVICE_DB_PASSWORD='password'
# Auth (Update these values as per your installation/setup)
SPAR_SELFSERVICE_AUTH_DEFAULT_ISSUERS=["https://esignet.dev.openg2p.org"]
SPAR_SELFSERVICE_AUTH_DEFAULT_JWKS_URLS=["https://esignet.dev.openg2p.org/.well-known/jwks.json"]
# 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"
SPAR_SELFSERVICE_OPENAPI_ROOT_PATH='/api/selfservice'
# Bypass auth verification for dev purposes
SPAR_SELFSERVICE_PORTAL_AUTH_DEFAULT_ID_TOKEN_VERIFY_AT_HASH="false"
SPAR_SELFSERVICE_AUTH_COOKIE_SECURE="false"
Database setup (skip this step if database is already setup)
CREATE ROLE sparuser WITH LOGIN NOSUPERUSER CREATEDB CREATEROLE INHERIT REPLICATION CONNECTION LIMIT -1 PASSWORD 'password';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.
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.