From eaaf7b38c4c1d19ab7842fc8550efcc35dd75905 Mon Sep 17 00:00:00 2001 From: Nikolai R Kristiansen Date: Fri, 30 May 2025 11:36:16 +0200 Subject: [PATCH] chore: Update README and fabfile --- README.md | 24 ++++++++++++++++-------- fabfile.py | 7 +++---- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 157f762..5b60186 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ +# kassa + Kassa helps you register purchased membership cards and memberships. It's a tool for volunteers and bar employees at The Norwegian Student Society. ## TODO + * replace nunjucks with something that is maintained * autoprefixer * bootstrap 4.x @@ -8,21 +11,23 @@ Kassa helps you register purchased membership cards and memberships. It's a tool * Galtinn/LDAP auth ## Installation + ```shell script apt install libldap2-dev libsasl2-dev # pyldap deps -python3 -m venv venv -. venv/bin/activate -pip install -U pip wheel -pip install -r requirements.txt -python manage.py migrate +uv run manage.py migrate +uv run manage.py runserver ``` ### Development tasks + ```shell script npm run build:templates # regenerate nunjucks templates ``` + ## Configuration + Create a user in Galtinn with the following permissions: + * galtinn | User | Can view User * galtinn | Member card | Can change Member card * galtinn | Member card | Can view Member card @@ -31,17 +36,20 @@ Create a user in Galtinn with the following permissions: * galtinn | Order | Can view Order Fetch GALTINN_API_KEY: -```shell script - curl -H "Content-Type: application/json" -X POST -d '{"username":"apiuser","password":"test"}' GALTINN_API_URL/auth/obtain-token/ + +```shell +curl -H "Content-Type: application/json" -X POST -d '{"username":"apiuser","password":"test"}' GALTINN_API_URL/auth/obtain-token/ ``` If developing you can disable calls to Tekstmelding in local_settings.py: + ```python TEKSTMELDING_ENABLED = False ``` ## LDAP -```shell script + +```shell sudo docker run -e LDAP_DOMAIN=neuf.no -e LDAP_ORGANISATION="Neuf" -e LDAP_ADMIN_PASSWORD="toor" -p 389:389 -d nikolaik/openldap ldapadd -D "cn=admin,dc=neuf,dc=no" -w "toor" -f test/testdata.ldif # Testdata # Verify import diff --git a/fabfile.py b/fabfile.py index fed77c9..c78ab27 100644 --- a/fabfile.py +++ b/fabfile.py @@ -14,13 +14,12 @@ def deploy(c): with c.cd(project_path), c.prefix(f"source {project_path}/venv/bin/activate"): c.run("git pull") # Get source - c.run("pip install -U pip") - c.run("pip install -r requirements.txt") # install deps in virtualenv + c.run("uv sync") # install deps in virtualenv with c.cd("static"): # install and compile frontend deps c.run("npm i") c.run("npm run build") - c.run("python manage.py collectstatic --noinput -i node_modules") # Collect static - c.run("python manage.py migrate") # Run DB migrations + c.run("uv run manage.py collectstatic --noinput -i node_modules") # Collect static + c.run("uv run manage.py migrate") # Run DB migrations # Reload gunicorn c.sudo("/usr/bin/supervisorctl pid kassa.neuf.no | xargs kill -HUP", shell=False)