Skip to content

Development Environment Setup

Introduction

This section is a guide for the developers who intend to perform the development on didmos2-auth, intend to update the customer specific configurations, or intend to make any UX changes in the customer templates.

Before we jump into the development instruction section, we first need to understand the repositories which constitutes didmos2-auth. The didmos2-auth module consists of the following three repositories:

  1. didmos2-auth
  2. didmos2-auth-fe
  3. customer-auth

The didmos2-auth repository consists all the SATOSA related source code. The didmos2-auth-fe repository contains all the Django related source code. The customer-auth repository contains the customer related configurations. Let's dig down on this a bit. The customer-auth repository, for example didmos2-demo-auth, has the following two folders:

  1. didmos2-auth
  2. didmos2-auth-fe

The didmos2-auth contains the SATOSA related configurations, for example, which backend, frontend, and microservices to enable/disable and their respective customer specific configurations.

The didmos2-auth-fe contains the customer specific templates for the Django.

Therefore, in order to set up the development environment, all the three repositories are required to be cloned. In the rest of this guide, we would use didmos2-demo-auth as an example customer project for all the commands.

Environment variables

didmos2-auth environment requires a set of environment variables which are being used in the SATOSO configurations and Django settings.py. For the docker setup, these environment variables are defined via the docker-compose files, which is not possible for the local development environment setup. Therefore, for the development, and for convenience, an environment variable file dev.env exists in didmos2-demo-auth. All these environment variables need to be created before starting didmos2-auth and didmos2-auth-fe.

Instructions

Please clone the following repositories in the same folder, for example, in the compose-project folder:

git clone git@gitlab.daasi.int:didmos2/didmos2-auth.git
git clone git@gitlab.daasi.int:didmos2/didmos2-auth-fe.git
git clone git@gitlab.daasi.int:didmos2-demo/didmos2-demo-auth.git

Perform cd didmos2-auth to go inside the didmos2-auth folder and then execute the ./bootstrap-devel.sh to execute the shell script which would install all the required libraries and would set up a python virtual environment which would be created inside the didmos2-auth folder with name venv. This would also install the didmos-auth and didmos2-auth-fe pip packages.

Run locally without an IDE

If you have a recent version of didmos2-demo-auth or a repository based on didmos2-demo-auth, go inside the didmos2-demo-auth Folder and run

make up

otherwise you need to execute the following commands manually one by one (from <customer>-auth-Folder)

In Terminal1

 ../scripts/startup.sh -l "auth" -s "frontend didmos ldap proxy mongo"
set -a && source ./dev.env && set +a
source ../didmos2-auth/venv/bin/activate
python ../didmos2-auth/venv/bin/gunicorn satosa.wsgi:app -c ../didmos2-auth/gunicorn_config.py

In Terminal2

set -a && source ./dev.env && set +a
source ../didmos2-auth/venv/bin/activate
python ../didmos2-auth/venv/bin/gunicorn didmos2_auth_fe.wsgi:app -c ../didmos2-auth/fe_gunicorn_config.py

Run with an IDE (Pycharm)

Make sure you have the EnvFile-Plugin installed.

Next create a new run configration for each didmos2-auth-fe and didmos2-auth

setup config for didmos2-auth-fe

Parameter Value
Name didmos-auth-fe-run
Script path ../didmos2-auth/venv/bin/gunicorn
Parameters didmos2_auth_fe.wsgi:app -c ../didmos2-auth/fe_gunicorn_config.py
Python interpreter ../didmos2-auth/venv/bin/python
Working directory ABSOLUTE-PATH-TO didmos2-demo-auth

Next go to th EnvFile Tab and select dev.env

setup config for didmos2-auth

Parameter Value
Name didmos2-auth-run
Script path ../didmos2-auth/venv/bin/gunicorn
Parameters satosa.wsgi:app -c ../didmos2-auth/gunicorn_config.py
Python interpreter ../didmos2-auth/venv/bin/python
Working directory ABSOLUTE-PATH-TO didmos2-demo-auth

Next go to th EnvFile Tab and select dev.env

Run

  1. In a Terminal execute ../scripts/startup.sh -l "auth" -s "frontend didmos ldap proxy mongo"
  2. run didmos2-auth-fe-run in run or debug mode
  3. run didmos2-auth-run in run or debug mode