User Tools

Site Tools


infra:services:hula

This is an old revision of the document!


Hacker-hula

Adding a new member user

Hula is a Django application. New users are added through the Django admin.

The practical admin flow is:

  1. Open the Hula Django admin.
  2. Go to users and click add user.
  3. Set the username.
  4. Set a temporary password.
  5. Exchange the temporary password with the user out-of-band and tell them to change it after logging in.
  6. Set the e-mail address. This is important: Hacker-ID / IDP enrollment depends on the user having an e-mail address in Hula.
  7. Fill required fields. At the moment address is required even when we do not have a useful address; the current workaround is to put a.
  8. Save the user.

After the Hula user exists, the member can start Hacker-ID onboarding from:

RFID / door access card

If the new member should get door access through the door system Hula controls:

  1. Get an RFID card from the safe.
  2. Watch the door daemon logs while presenting the card to the door reader:

ssh bac-door1.hackeriet.no "sudo journalctl -u doord -f"

  1. The door system logs continuously while it looks for card information.
  2. Present the unregistered card to the door lock.
  3. Look for the unregistered card log line and copy the card number from that line.
  4. Put that card number into the Hula Django field named RFID access card number. (new):.
  5. Save the user/member record.

Maintenance

Updating the software

Go to the checkout as `hackerhula` via `root`

sudo su -
su - hackerietweb -s /bin/bash
cd /srv/webapp-hackerhula/new/hackerhula/
git pull

If you've made migrations, run this

poetry run ./manage.py migrate

If you've changed static files, run this

poetry run ./manage.py collectstatic

Back to root we go

^D

Restart the appserver

systemctl restart gunicorn-hula.service
and bob's your uncle

Payment status

As of 2025-12-28 there is a high likelyhood of mistakes or error in the data entering the payment status database. We currently have no good place to track these issues currently. TODO for styret

The current logical flow of data is

       +----------------------+        
       |                      |        
       |  Member bank account |        
       |                      |        
       +----------+-----------+        
                  |                    
                  v                    
      +------------------------+       
      |                        |       
      | Hackeriet bank account |       
      |        (Cultura)       
      |                        |       
      +-----------+------------+       
                  |                    
                  v                    
        +-------------------+          
        |                   |          
        | Accounting system |          
        |      (Fiken)      |          
        |                   |          
        +---------+---------+          
                  |                    
                  v                    
     +-------------------------+       
     |                         |       
     | API export to JSON file |       
     |                         |       
     +------------+------------+       
                  |                    
                  v                    
+-------------------------------------+
|                                     |
| Import to Hula DB via manual script |
|                                     |
+-------------------------------------+

If there is a mistake in any point in the chain, it can look like payment is missing. Maybe the member has changed bank account since customer ID in accounting system was correlated to hula? Maybe finance officer has not done quality work in the accounting system? Maybe a manual sync of payment status has not been performed for a while, so recent payments are not showing yet?

How to perform an API export to JSON file for sync of payment status

See also https://github.com/hackeriet/fiken-hula

The Fiken API token is stored in the password manager. `hackerpass fiken/api` To avoid storing the token in plaintext in `.env`, pipe it directly into the vault helper:

atluxity@hostname:~$ gh repo clone hackeriet/fiken-hula
atluxity@hostname:~$ cd fiken-hula/                                                                                                                                                   
atluxity@hostname:fiken-hula$ python3 -m venv env                                                                                                                                     
atluxity@hostname:fiken-hula$ source env/bin/activate                                                                                                                                 
(env) atluxity@hostname:fiken-hula$ pip install -r requirements.txt
(env) atluxity@hostname:fiken-hula$ hackerpass fiken/api | python env_vault.py encrypt --name FIKEN_API --value-stdin
Encryption password:
Confirm encryption password:
Updated .env with FIKEN_API_VAULT
(env) atluxity@hostname: fiken-hula$ python dump_all_sales.py > $(date +%Y-%m-%d)-all-sales.json

You now have a json file! Next step is possible. TAKE CARE, there is currently too much PII in the file. Do not leave it unattented.

How to Import to Hula DB via manual script

See also https://github.com/hackeriet/hackerhula/blob/master/hackerhula/member/management/commands/sync_fiken.py

atluxity@blade:~$ sudo su - hackerietweb -s /bin/bash
hackerietweb@blade:~$ cd /srv/webapp-hackerhula/new/hackerhula/
hackerietweb@blade:/srv/webapp-hackerhula/new/hackerhula$ poetry shell
(hackerhula-py3.11) hackerietweb@blade:/srv/webapp-hackerhula/new/hackerhula$ python3 manage.py sync_fiken /home/atluxity/2025-12-27-fiken-sales.json
(hackerhula-py3.11) hackerietweb@blade:/srv/webapp-hackerhula/new/hackerhula$ exit                                    
atluxity@blade:~$ rf 2025-12-27-fiken-sales.json

TAKE CARE, the json file has too much PII etc, do not leave it unattended.

Reporting on payments stored in Hula

To sanity check, or whatever, a small stats command was created to be run in the same way as the sync command above.

(hackerhula-py3.11) hackerietweb@blade:/srv/webapp-hackerhula/new/hackerhula$ python3 manage.py payments_stats -h
usage: manage.py payments_stats [-h] [--from DATE_FROM] [--to DATE_TO] [--last-months LAST_MONTHS] [--last-1-months] [--last-3-months] [--last-6-months] [--last-12-months]
                                [--format {text,json}] [--version] [-v {0,1,2,3}] [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color] [--force-color]
                                [--skip-checks]

Report payment statistics from the database

options:
  -h, --help            show this help message and exit
  --from DATE_FROM      Start date (YYYY-MM-DD)
  --to DATE_TO          End date (YYYY-MM-DD)
  --last-months LAST_MONTHS
                        Last N months (e.g. --last-months 3)
  --last-1-months       Preset for last 1 month
  --last-3-months       Preset for last 3 months
  --last-6-months       Preset for last 6 months
  --last-12-months      Preset for last 12 months
  --format {text,json}  Output format (default: text)
  --version             Show program's version number and exit.
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output, 2=verbose, 3=very verbose
  --settings SETTINGS   The Python path to a settings module, e.g. "myproject.settings.main". If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions.
  --no-color            Don't colorize the command output.
  --force-color         Force colorization of output.
  --skip-checks         Skip system checks.

/srv/hackeriet-wiki/dokuwiki/data/attic/infra/services/hula.1784649420.txt.gz · Last modified: by atluxity_idp.hackeriet.no