From 7404d114debcf4a06d0873eebca60fa5fee7b9f5 Mon Sep 17 00:00:00 2001 From: Domenico DiNicola Date: Thu, 10 Oct 2024 16:52:32 +0200 Subject: [PATCH] docs --- docs/.gitignore | 2 + docs/components/.pages | 4 +- docs/components/aurora/.pages | 2 +- docs/components/aurora/index.md | 2 +- docs/components/aurora/setup/config.md | 7 +++ docs/components/aurora/setup/docker.md | 19 ++++++++ .../aurora/{setup.md => setup/virtualenv.md} | 48 +++---------------- docs/components/hde/setup/config.md | 0 docs/components/hde/setup/docker.md | 0 docs/components/hde/setup/virtualenv.md | 0 docs/components/pg/.pages | 2 +- docs/components/pg/index.md | 2 +- docs/components/pg/setup.md | 1 - docs/components/pg/setup/.pages | 4 ++ docs/components/pg/setup/docker.md | 1 + docs/components/pg/setup/index.md | 0 docs/components/pg/setup/virtualenv.md | 37 ++++++++++++++ docs/components/reporting/.pages | 1 + docs/components/reporting/index.md | 2 +- docs/components/reporting/setup/config.md | 0 docs/components/reporting/setup/docker.md | 0 docs/components/reporting/setup/virtualenv.md | 0 22 files changed, 85 insertions(+), 49 deletions(-) create mode 100644 docs/components/aurora/setup/config.md create mode 100644 docs/components/aurora/setup/docker.md rename docs/components/aurora/{setup.md => setup/virtualenv.md} (61%) create mode 100644 docs/components/hde/setup/config.md create mode 100644 docs/components/hde/setup/docker.md create mode 100644 docs/components/hde/setup/virtualenv.md delete mode 100644 docs/components/pg/setup.md create mode 100644 docs/components/pg/setup/.pages create mode 100644 docs/components/pg/setup/docker.md create mode 100644 docs/components/pg/setup/index.md create mode 100644 docs/components/pg/setup/virtualenv.md create mode 100644 docs/components/reporting/setup/config.md create mode 100644 docs/components/reporting/setup/docker.md create mode 100644 docs/components/reporting/setup/virtualenv.md diff --git a/docs/.gitignore b/docs/.gitignore index 65f559b..4f42ef4 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,3 +1,5 @@ !**/.pages !.includes _theme/.templates + +__pycache__ diff --git a/docs/components/.pages b/docs/components/.pages index 262ad8b..f26bb15 100644 --- a/docs/components/.pages +++ b/docs/components/.pages @@ -3,8 +3,8 @@ nav: - Aurora: aurora - Kobo: kobo - - Deduplication: hde - - Country Report: reporting - Payment Gateway: pg + - Country Report: reporting + - Deduplication: hde - RapidPro: rapidpro # - workspace.md diff --git a/docs/components/aurora/.pages b/docs/components/aurora/.pages index bde1d32..20253e7 100644 --- a/docs/components/aurora/.pages +++ b/docs/components/aurora/.pages @@ -1,3 +1,3 @@ nav: - index.md - - setup.md + - setup diff --git a/docs/components/aurora/index.md b/docs/components/aurora/index.md index 874949b..fae19b2 100644 --- a/docs/components/aurora/index.md +++ b/docs/components/aurora/index.md @@ -18,4 +18,4 @@ The strengths of Aurora are: ## Repository - +> Repo: diff --git a/docs/components/aurora/setup/config.md b/docs/components/aurora/setup/config.md new file mode 100644 index 0000000..64e4c7a --- /dev/null +++ b/docs/components/aurora/setup/config.md @@ -0,0 +1,7 @@ +# Setup HOPE integration + +- Add aurora_token in the user +- Add aurora_server in the Constance Config +- Fetch data from Aurora +- Associate Organizations to Business Areas +- Associate Projects to Programmes diff --git a/docs/components/aurora/setup/docker.md b/docs/components/aurora/setup/docker.md new file mode 100644 index 0000000..1b94a3d --- /dev/null +++ b/docs/components/aurora/setup/docker.md @@ -0,0 +1,19 @@ +# Build and use your docker + +After you have cloned the repo, be sure to have a Reddis and PostgreSQL server running on your machine + + export ADMIN_EMAIL=admin@example.com + export ADMIN_PASSWORD=password + export DATABASE_URL=postgres://postgres:@127.0.0.1:5432/aurora + export CACHE_URL=redis://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient + + cd docker + + make build run + + +## Use provided compose.yml + + docker compose up + +navigate to http://localhost:8000/admin/ and login using `admin@example.com/password` diff --git a/docs/components/aurora/setup.md b/docs/components/aurora/setup/virtualenv.md similarity index 61% rename from docs/components/aurora/setup.md rename to docs/components/aurora/setup/virtualenv.md index 6099146..45a259b 100644 --- a/docs/components/aurora/setup.md +++ b/docs/components/aurora/setup/virtualenv.md @@ -15,7 +15,7 @@ Prerequisites: ## Create virtualenvironment -2. Checkout code +1. Checkout code ``` git clone https://github.com/unicef/hope-aurora @@ -23,7 +23,7 @@ Prerequisites: ``` -1. In the shell: +2. In the shell: ``` pdm venv create @@ -31,12 +31,12 @@ Prerequisites: pdm venv activate ``` -1. Check your virtualenv is properly created +3. Check your virtualenv is properly created ```pdm info``` -1. Install the package +4. Install the package ``` pdm install @@ -44,10 +44,10 @@ Prerequisites: ``` -1. Add `export PYTHONPATH="$PYTHONPATH:./src"` +5. Add `export PYTHONPATH="$PYTHONPATH:./src"` -1. Check your environment: +6. Check your environment: `./manage.py env --check` and configure the missing variables. @@ -57,7 +57,7 @@ Prerequisites: ./manage.py env --develop --config --pattern='export {key}={value}' -1. Run upgrade command to properly initialize the application: +7. Run upgrade command to properly initialize the application: `./manage.py upgrade --admin-email ${ADMIN_EMAIL} --admin-password ${ADMIN_PASSWORD}` @@ -83,37 +83,3 @@ echo "unset PS1" >> .envrc The first time after you have created or modified the _.envrc_ file you will have to authorize it using: direnv allow - -# Run - -To start working with Aurora you can: - - -### Build and use your docker - -After you have cloned the repo, be sure to have a Reddis and PostgreSQL server running on your machine - - export ADMIN_EMAIL=admin@example.com - export ADMIN_PASSWORD=password - export DATABASE_URL=postgres://postgres:@127.0.0.1:5432/aurora - export CACHE_URL=redis://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient - - cd docker - - make build run - - -### Use provided compose.yml - - docker compose up - -navigate to http://localhost:8000/admin/ and login using `admin@example.com/password` - - -### Setup HOPE integration - -- Add aurora_token in the user -- Add aurora_server in the Constance Config -- Fetch data from Aurora -- Associate Organizations to Business Areas -- Associate Projects to Programmes diff --git a/docs/components/hde/setup/config.md b/docs/components/hde/setup/config.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/components/hde/setup/docker.md b/docs/components/hde/setup/docker.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/components/hde/setup/virtualenv.md b/docs/components/hde/setup/virtualenv.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/components/pg/.pages b/docs/components/pg/.pages index fdc9bf4..1dc08f2 100644 --- a/docs/components/pg/.pages +++ b/docs/components/pg/.pages @@ -1,4 +1,4 @@ nav: - index.md - - setup.md + - Setup: setup - Western Union: wu diff --git a/docs/components/pg/index.md b/docs/components/pg/index.md index 6240c4b..d388a68 100644 --- a/docs/components/pg/index.md +++ b/docs/components/pg/index.md @@ -7,7 +7,7 @@ Each FSP can have a different way to interact with the payment gateway with thou ## Repository -Repo: +> Repo: ## HOPE / PG Integration API diff --git a/docs/components/pg/setup.md b/docs/components/pg/setup.md deleted file mode 100644 index feae8cb..0000000 --- a/docs/components/pg/setup.md +++ /dev/null @@ -1 +0,0 @@ -# Setup diff --git a/docs/components/pg/setup/.pages b/docs/components/pg/setup/.pages new file mode 100644 index 0000000..229c1ba --- /dev/null +++ b/docs/components/pg/setup/.pages @@ -0,0 +1,4 @@ +nav: + - index.md + - virtualenv.md + - docker.md diff --git a/docs/components/pg/setup/docker.md b/docs/components/pg/setup/docker.md new file mode 100644 index 0000000..6871408 --- /dev/null +++ b/docs/components/pg/setup/docker.md @@ -0,0 +1 @@ +# Docker \ No newline at end of file diff --git a/docs/components/pg/setup/index.md b/docs/components/pg/setup/index.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/components/pg/setup/virtualenv.md b/docs/components/pg/setup/virtualenv.md new file mode 100644 index 0000000..50483ac --- /dev/null +++ b/docs/components/pg/setup/virtualenv.md @@ -0,0 +1,37 @@ +# Virtualenv + + +### System Requirements + +- python 3.12 +- [direnv](https://direnv.net/) - not mandatory but strongly recommended +- [pdm](https://pdm.fming.dev/2.9/) + + +**WARNING** +> Hope Payment Gateway implements **security first** policy. It means that configuration default values are "almost" production compliant. +> +> Es. `DEBUG=False` or `SECURE_SSL_REDIRECT=True`. +> +> Be sure to run `./manage.py env --check` and `./manage.py env -g all` to check and display your configuration + + + +### 1. Clone repo and install requirements + git clone https://github.com/unicef/hope-payment-gateway + pdm venv create 3.12 + pdm install + pdm venv activate in-project + pre-commit install + +### 2. configure your environment + +Uses `./manage.py env` to check required (and optional) variables to put + + ./manage.py env --check + + +### 3. Run upgrade to run migrations and initial setup + + ./manage.py upgrade + diff --git a/docs/components/reporting/.pages b/docs/components/reporting/.pages index f07fa19..8fe451c 100644 --- a/docs/components/reporting/.pages +++ b/docs/components/reporting/.pages @@ -1,4 +1,5 @@ nav: - index.md + - setup - glossary.md - tmp.md diff --git a/docs/components/reporting/index.md b/docs/components/reporting/index.md index d35f854..7a4c937 100644 --- a/docs/components/reporting/index.md +++ b/docs/components/reporting/index.md @@ -11,7 +11,7 @@ This components allows user to produce reports and keep them updated customizing ## Repository - +> Repo: ## Features diff --git a/docs/components/reporting/setup/config.md b/docs/components/reporting/setup/config.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/components/reporting/setup/docker.md b/docs/components/reporting/setup/docker.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/components/reporting/setup/virtualenv.md b/docs/components/reporting/setup/virtualenv.md new file mode 100644 index 0000000..e69de29