Sign inSign up

sdcplatform/ras-frontstage

By sdcplatform

•Updated about 5 years ago

Frontstage microservice for RAS

Image
1

10K+

sdcplatform/ras-frontstage repository overview

⁠ras-frontstage

User interface for Respondent Account Services

⁠Setup

Based on python 3.9

Use Pyenv⁠ to manage installed Python versions

Install dependencies to a new virtual environment using Pipenv⁠

pip install -U pipenv
pipenv install

⁠Redis

ras-frontstage requires a redis instance to store user jwt's when they are logged in

For local development this can be installed using Homebrew

brew install redis

For more information see here⁠

It can also be run with docker

docker run --name redis -p 6379:6379 -d redis

⁠ras-frontstage-api

ras-frontstage calls one other service, ras-frontstage-api⁠ See that repo for how to run it and see the config below for the environment variables used to connect to it

⁠Run the application

pipenv run python run.py

⁠Run tests

Install test dependencies with

pipenv install --dev

The Makefile will run the tests in the unit or integration tests folder using pytest, and present a coverage report.
These can be easily run via the following commands:

make unit-tests
make integration-tests

or if you are running redis in the docker environment

make docker-test

or if you wish to run a single test file, it can be specified as follows:

make INTEGRATION_TESTS=tests/integration/views/surveys/test_surveys_list.py integration-tests
make UNIT_TESTS=tests/unit/test_filters.py unit-tests

The syntax above will work equally well with the 'docker-test' target

Note that this script will fail if there is a node_modules folder in the repo

⁠Configuration

Environment variables available for configuration are listed below:

Environment VariableDescriptionDefault
APP_SETTINGSWhich config to use'Config' (use DevelopmentConfig) for developers
SECRET_KEYSecret key used by flask'ONS_DUMMY_KEY'
SECURITY_USER_NAMEUsername for basic auth'admin'
SECURITY_USER_PASSWORDPassword for basic auth'secret'
JWT_SECRETSECRET used to code JWT'testsecret'
VALIDATE_JWTBoolean for turning on/off JWT validation (True=on)True
GOOGLE_ANALYTICSCode for google analyticsNone
GOOGLE_TAG_MANAGERCode for google tag managerNone
REDIS_HOSTHost address for the redis instance'localhost'
REDIS_PORTPort for the redis instance6379
REDIS_DBDatabase number for the redis instance1
RAS_FRONTSTAGE_API_PROTOCOLProtocol used for frontstage-api uri'http'
RAS_FRONTSTAGE_API_HOSTHost address used for frontstage-api uri'localhost'
RAS_FRONTSTAGE_API_PORTPort used for frontstage-api uri8083

These are set in config.py⁠

Tag summary

Content type

Image

Digest

Size

217.1 MB

Last updated

about 5 years ago

docker pull sdcplatform/ras-frontstage:maintenance-prototype