No description
This repository has been archived on 2026-04-20. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Python 94.3%
  • Smarty 5.2%
  • HTML 0.3%
  • Shell 0.2%
Find a file
Kashim Aziz ea66ffd4e2
Some checks failed
build / build (push) Has been cancelled
build / release (production) (push) Has been cancelled
build / release (staging) (push) Has been cancelled
feature/wal-3408-add-cred-is-stored-flag (#702)
2024-04-23 11:39:59 +01:00
.github/workflows WAL-3373 move to poetry 2024-02-27 15:25:58 +02:00
api_messaging feature/wal-3408-add-cred-is-stored-flag (#702) 2024-04-23 11:39:59 +01:00
common WAL-3373 move to poetry 2024-02-27 15:25:58 +02:00
hermes WAL-3385 Account Closure FileScript 2024-04-10 13:29:58 +03:00
history WAL-3387 account closure event 2024-04-16 14:19:48 +03:00
magic_link black formatting 2023-06-29 10:51:28 +01:00
order admin or not return something useful 2022-02-15 09:02:38 +00:00
payment_card exclude migrations from ruff linter but not from formatter 2024-04-18 14:15:40 +03:00
periodic_corrections black formatting 2023-06-29 10:51:28 +01:00
periodic_retry WAL-3373 move to poetry 2024-02-27 15:25:58 +02:00
prometheus Added GitHub Actions, Ran Black 2021-11-25 21:43:06 +00:00
scheme feature/wal-3408-add-cred-is-stored-flag (#702) 2024-04-23 11:39:59 +01:00
scripts exclude migrations from ruff linter but not from formatter 2024-04-18 14:15:40 +03:00
sso WAL-3375 refuse unknown groups 2024-04-22 14:50:53 +03:00
templates/admin fix missing field in copy operation added new line at end of html file. 2022-08-17 17:33:48 +01:00
ubiquity feature/wal-3408-add-cred-is-stored-flag (#702) 2024-04-23 11:39:59 +01:00
user WAL-3375 migrate auth groups 2024-04-18 14:15:40 +03:00
.coveragerc Relock Pipfile 2023-02-22 11:58:39 +00:00
.gitignore WAL-3373 move to poetry 2024-02-27 15:25:58 +02:00
celerybeat-schedule.db WAL-3374 RTBF script runner POC 2024-03-27 14:24:40 +02:00
Dockerfile WAL-3373 move templates to pyproject.toml 2024-02-28 12:48:16 +02:00
entrypoint.sh WAL-3373 add entrypoint.sh to dockerfile 2024-02-27 15:59:08 +02:00
example_local_secrets.json WAL 3197 - Remove barclays SFTP loyalty card status code 2023-10-16 10:36:26 +01:00
generate_sql_template.sh add script to generate hermes template pg dump 2023-08-02 13:19:45 +03:00
manage.py update manage.py to latest template 2019-10-18 09:09:44 +01:00
poetry.lock WAL-3369 add RTBF FileScript 2024-03-27 14:24:40 +02:00
pyproject.toml exclude migrations from ruff linter but not from formatter 2024-04-18 14:15:40 +03:00
README.md LOY-2807 remove twitter and facebook auth 2023-05-02 17:44:17 +03:00
style.sh WAL-3373 move to poetry 2024-02-27 15:25:58 +02:00

Hermes

build status coverage report

From the minds of Andrew Kenyon and Ben Olsen, (Sponsored by Paul Batty and Mick Latham Inc.), we give you Hermes....a self contained user registration module. Incorporating all your payment and loyalty card registration too...

Components

  • Django 1.9
  • Postgresql 9.1+

Installation (Ubuntu Linux)

  • Install Python 3 virtual environment and Postgres dependencies required for C bindings to PsycoPG2 driver
    • sudo apt-get install python3-pip python3-dev libpq-dev postgresql postgresql-contrib
    • sudo pip3 install virtualenv
    • virtualenv ~/.virtualenvs/hermes
  • Install Python dependencies (Or setup PyCharm to use a Docker based Python)
    • source ~/.virtualenvs/hermes/bin/activate
    • cd ~/code_dir/hermes
    • pip install -r requirements.txt
  • Install Docker and docker-compose
  • Setup environment specific settings
    • Create .env file in project root
    • Add entry for DB connection: HERMES_DATABASE_URL="postgres://postgres@localhost:5432/postgres"
    • DB name can be changed however you need to tell docker by setting environment var POSTGRES_USER="DB-NAME"
  • Start postgres
    • cd app_dir
    • docker-compose up
  • Run DB Migrations - ./manage.py migrate
  • Run application - ./manage.py runserver
  • Creating an entity relationship diagram
    • Note: Do not check any of these changes in please; this is a guide only.
    • sudo apt-get install graphviz libgraphviz-dev pkg-config
    • Add 'django_extensions' to INSTALLED_APPS in settings.py.
    • pip install django-extensions pydotplus pygraphviz
    • Run python manage.py graph_models -a -o hermes_models.png

Installation (MacOS)

  • Install Python 3 virtual environment and Postgres dependencies required for C bindings to PsycoPG2 driver
    • Install Xcode from the Mac App Store
    • Install Python 3
    • Install homebrew if not already installed
    • Install correct Postgres version but do not run from homebrew: brew install postgres@9.5
  • Install requirements for librabbitmq
    • brew install autoconf automake pkg-config libtool
  • Install Python dependencies (Or setup PyCharm to use a Docker based Python)
    • source ~/.virtualenvs/hermes/bin/activate
    • cd ~/code_dir/hermes
    • pip install -r requirements.txt
  • Install Azure-CLI for keyvault access (or alternatively you are able to use a local secrets file)
    • brew install azure-cli
    • Then: az login will take you to a browser to sign into Azure.
    • When trying to run an application in Pycharm it may abort when trying to load secrets
    • if you have this issue especially after just rebooting run az login before running PyCharm
  • Install Docker and Postgres
    • Download and install Docker
    • Pull Docker Postgres: docker pull postgres:9.5
  • Start Postgres
    • docker run --name hermes-postgres -p 127.0.0.1:5432:5432 -d postgres
  • Create Hermes Database
    • psql -h localhost -U postgres
    • create database hermes;
  • Run DB Migrations - ./manage.py migrate
  • Run application - ./manage.py runserver

Docker Configuration

Environment Variables

  • DATABASE_IP
    • String Value, usually an FQDN or IP Address
  • DATABASE_PORT
    • String Value, port for Postgres, usually 5432
  • DATABASE_USER
    • String Value, username to use for auth with Postgres
  • DATABASE_PASS
    • String Value, password to use for auth with Postgres
  • DATABASE_NAME
    • String Value, name of database within Postgres
  • DEBUG
    • True = Enable Debug Features
    • False = Disable Debug Features
  • MEDIA_URL
    • String Value, URL to serve media on, usually https:///media
  • MIDAS_URL
    • String Value, URL to access Midas
  • HECATE_URL
    • String Value, URL to access Hecate
  • LETHE_URL
    • String Value, URL to access Lethe
  • METIS_URL
    • String Value, URL to access Metis
  • ENVIRONMENT_NAME
    • String Value, text of django admin environment message
  • ENVIRONMENT_COLOR
    • String Value, hex value of django admin environment message background colour
  • VAULT_URL
    • String Value, URL access to Azure keyvault

Running the Hermes Locally in Pycharm

In Pycharm set up the following run configs ie select Edit Configurations :

Note: In all settings add environment variables:

Environmental Variables: PYTHONUNBUFFERED=1;DJANGO_SETTINGS_MODULE=hermes.settings
Python Interpreter:  Python in hermes virtual env
Working Directory: top directory of hermes app eg .../pycharm_projects/hermes

and refer to the correct python interpreter ie in the virtualenv.

Under Django Server create config:

hermes api 1.x/admin
    host: 127:0:0:1  port: 8000

Under Python create configs:

celery
    Module Name: celery
    Parameters: -A hermes worker --loglevel=INFO --concurrency=1 -Q ubiquity-async-midas,record-history,retry-tasks


celery beat:
    Module Name: celery
    Parameters: -A hermes beat --loglevel=INFO

api2:
    script path: /Users/mmarsh/PycharmProjects/hermes/api_messaging/run.py

To start the select each config above on the drop down and click on either the run or debug icon. You should then have under the run or debug window all 4 services running.

Note celery will consume 3 task queues ubiquity-async-midas, record-history, retry-tasks If you have installed manage version of rabbitMQ the queues can be seen on

http://127.0.0.1:15672/#/queues

An additional non-celery related Queue "from_angelia" can be monitored. This Queue as the name implies contains messages from Angelia to the hermes back end "api2" application