]>
Commit | Line | Data |
---|---|---|
95b363dd | 1 | # Administration Association |
7412dcff | 2 | |
f26cb7ec JG |
3 | This app is written by members of the Chaos Computer Club to help its administration, the office, to manage the |
4 | club's memberships. It is not meant to be awesome, just better than DBaseII, which it does pretty well. | |
850a7b24 | 5 | |
f26cb7ec JG |
6 | The main focuses in development are: |
7 | * Replace the DBaseII solution used since at least 1995 | |
8 | * Enable working in parallel | |
9 | * Be easily modifiable and extensible | |
10 | * Sending *encrypted* mails to members about any changes in their status | |
11 | * Reading and processing bank statements in CSV format | |
12 | ||
13 | You are welcome to fork, send pull request and much more, but the goal of this piece of software will remain running the | |
14 | Chaos Computer Club's memberships. | |
15 | ||
95b363dd | 16 | ## Project Webpage |
04380f4a JG |
17 | |
18 | Find the source and downloads at https://gitlab.com/pythonfoo/AA | |
19 | ||
dc0b8dfe | 20 | ## Setup |
04380f4a | 21 | |
dc0b8dfe | 22 | First create a file ```ROOT/ROOT/settings_production.py``` by using ```ROOT/ROOT/settings.py``` as a template. |
1694d1c6 | 23 | |
faca2912 JG |
24 | ### PostgreSQL |
25 | ||
26 | Recommended for production setups because it's much faster than SQLite and does support more than one simultaneous access, which helps parallelization a lot. | |
27 | ||
28 | Install all the following dependencies: | |
29 | ||
30 | ``` | |
31 | sudo apt-get update | |
da86e71e | 32 | sudo apt-get install python-pip python-dev libpq-dev postgresql postgresql-contrib |
faca2912 JG |
33 | ``` |
34 | ||
35 | Copy the PostgreSQL settings from settings.py to settings_production.py and uncomment them: | |
36 | ||
37 | ``` | |
38 | DATABASES = { | |
39 | 'default': { | |
40 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', | |
41 | 'NAME': 'AA', | |
42 | } | |
43 | } | |
44 | ``` | |
45 | ||
46 | Create a user and database: | |
47 | ``` | |
48 | sudo -u postgres -i | |
49 | $ createuser <yourusername> | |
95992c0d | 50 | $ createdb AA -O <yourusername> |
faca2912 JG |
51 | ``` |
52 | ||
3a3a365a JG |
53 | Add the Levenshtein search extension (fuzzystrmatch) for matching money transfer tokens. Adding this to the template for |
54 | new databases allows to run tests, which create a new database every run. This must be added with superuser permissions | |
55 | and per database. (see https://stackoverflow.com/a/54353033) | |
56 | While at it also install Trigram Similarity (pg_trgm) which is used to quickly find tokens in the manage transactions | |
57 | search. | |
b5748c51 | 58 | ``` |
630a09e7 | 59 | $ psql -d template1 -c 'CREATE EXTENSION fuzzystrmatch;' |
3a3a365a | 60 | $ psql -d template1 -c 'CREATE EXTENSION pg_trgm;' |
b5748c51 JG |
61 | ``` |
62 | ||
faca2912 JG |
63 | In order to run the tests grant the user the privilege to create databases by continuing as the postgresql user from above: |
64 | ``` | |
65 | $ psql | |
66 | ALTER ROLE <yourusername> CREATEDB; | |
67 | ``` | |
68 | ||
69 | ||
ac442e89 JG |
70 | ### GnuPG |
71 | ||
e05edbf9 | 72 | You need the GPGME Python bindings matching your gnupg version installed on your system. On Debian and Ubuntu this can be done with ```apt install python3-gpg```. For further information on installing the python bindings see https://wiki.python.org/moin/GnuPrivacyGuard#Accessing_GnuPG_via_gpgme |
ac442e89 | 73 | |
da86e71e | 74 | If your gnupg is older than 2.1.12 you need to add the following option in your ```ROOT/<GPG_HOME_FOLDER>/.gnupg/gpg-agent.conf```: |
ac442e89 JG |
75 | |
76 | ``` | |
77 | allow-loopback-pinentry | |
78 | ``` | |
79 | ||
e05edbf9 JG |
80 | This parameter is necessary for making the password entry for encrypted keys work. |
81 | ||
da86e71e JG |
82 | If your gnupg is older than 2.2.8 you should add the following option in your ```ROOT/<GPG_HOME_FOLDER>/.gnupg/gpg.conf```: |
83 | ||
84 | ``` | |
85 | force-mdc | |
86 | ``` | |
87 | ||
88 | This ensures that you will only send integrity protected e-mails, no matter which key algorithm you have to use for encryption. | |
89 | ||
90 | ||
91 | Import your signature key and your managing director key into this keyring as you defined in the setting variables ```GPG_HOST_USER``` and ```GPG_MANAGING_DIRECTOR``` | |
92 | ||
dc0b8dfe | 93 | Make sure the folder ```ROOT/<GPG_HOME_FOLDER>``` exists, where GPG_HOME_FOLDER is the name you defined in the ```ROOT/ROOT/settings_production.py```, since it is not created automatically. In this folder add a file ```gpg.conf``` stating the keyserver to use: |
ac442e89 JG |
94 | |
95 | ``` | |
96 | keyserver hkp://keys.gnupg.net | |
97 | ``` | |
98 | ||
dc0b8dfe JG |
99 | ### Cron |
100 | ||
101 | In order for periodic tasks to function a crontab entry is needed like the following: | |
102 | ``` | |
103 | * * * * * /path/to/installation/env/bin/python3 /path/to/installation/ROOT/manage.py scheduler | |
104 | ``` | |
105 | This will run every minute and initiate all periodic tasks. | |
106 | ||
107 | ## Run | |
108 | ||
109 | Calling ```install_and_start_django_server.sh``` will create a virtual environment, install all necessary Python | |
110 | dependencies, create a Django user, migrate all database migrations and start a webserver on 127.0.0.1:8000. | |
111 | ||
112 | On subsequent starts only ```start_server.sh``` is needed to bring up the webserver. | |
113 | ||
95b363dd JG |
114 | ## Testing Emails |
115 | ||
116 | For testing emails set up a local mailserver which accepts all incoming emails and displays them. | |
117 | ||
118 | A simple built-in version in Python is the following server, which prints the received emails to the console: | |
119 | ```bash | |
120 | $ python -m smtpd -n -c DebuggingServer localhost:1025 | |
121 | ``` | |
122 | ||
123 | maildump offers a webinterface on port 1080, but is only available for Python 2. | |
124 | ||
125 | ```bash | |
126 | $ maildump -f | |
127 | ``` | |
128 | ||
129 | Both servers listen on port 1025 for incoming emails. | |
130 | ||
131 | ## Credit | |
f26cb7ec JG |
132 | |
133 | Thanks to the people from the Pythonfoo at Chaosdorf for building this software. Without you the office would still | |
ac442e89 | 134 | struggle with outdated DOS database technology. |