]> WPIA git - motion.git/blob - README.md
Merge branch 'motion_close' into 'master'
[motion.git] / README.md
1 # Installation
2 Requires Python 3 and a running PostgreSQL installation.
3
4 For a productive environment use a nginx webserver.
5
6 To install:
7 ```
8 virtualenv -p python3 .
9 . bin/activate
10 pip install -r requirements.txt
11 ```
12 Then edit config.py.example into config.py with your database connection
13
14 ## Development and debug
15
16 To debug-run linux:
17 ```
18 LANG=C.UTF-8 FLASK_DEBUG=1 FLASK_APP=motion.py flask run
19 ```
20
21 To debug-run windows:
22 ```
23 set LANG=C.UTF-8
24 set FLASK_DEBUG=1
25 set FLASK_APP=motion.py
26 flask run
27 ```
28
29 For unit testing use config values from config.py.example:
30 ```
31 python -m unittest tests/test_motion.py
32 ```
33
34 The database schema is automatically installed when the table "schema_version" does not exist and the application is started.
35
36 The following user rights can be granted:
37 - create: user is able to create a new motion
38 - vote: user is able to vote running motions
39 - cancel: user is able to cancel a running motion
40 - finish: user is able to close a running motion
41 - audit: user is able to see given votes of a finished motion
42
43 To grant right use the following (here with vote right as example):
44 - on all groups add "vote:*"
45 - on one given group add "vote:group1"
46 - on two given groups add "vote:group1 vote:group2"
47
48 # Usage
49
50 Within the motion content markdown can be used for formatting e.g. 
51 * To add a line break add two lines
52 * to enter a link use `[text](https//domain.tld/link)`
53
54 ## Settings for nginx
55
56 To control the access this map is used:
57
58 ```
59 map "$host:$ssl_client_serial:$ssl_client_i_dn" $motion_user_role {
60 "host.domain.tld:serialnumber:/issuername" 'username/create:* vote:* cancel:* audit:*';
61 ...
62 default "<invalid>/";
63 }
64 ```
65
66 example taken from motions.board.wpia.club:
67 ```
68 map "$host:$ssl_client_serial:$ssl_client_i_dn" $motion_user_role {
69 "motions.board.wpia.club:0a0000000a1234567890abcdef1234567890abcde:/CN=Orga 2019-2/O=TC InterimCA/OU=TC InterimCAs/C=AT" 'president/create:* vote:* cancel:* audit:*';
70 ...
71 default "<invalid>/";
72 }
73 ```
74
75
76 ## configuration
77 ```
78 listen 0.0.0.0:443 ssl;
79 listen [::]:443 ssl;
80 server_name host.domain.tld;
81 gzip on;
82 ssl_certificate /etc/ssl/private/host.domain.tld.crt;
83 ssl_certificate_key /etc/ssl/private/host.domain.tld.key;
84
85 ssl_client_certificate /etc/ssl/host.domain.tld.pem;
86 ssl_verify_client on;
87 ssl_verify_depth 4;
88 access_log /tmp/host.domain.tld.log motion-cert;
89
90 location / {
91 fastcgi_param QUERY_STRING $query_string;
92 fastcgi_param REQUEST_METHOD $request_method;
93 fastcgi_param CONTENT_TYPE $content_type;
94 fastcgi_param CONTENT_LENGTH $content_length;
95 fastcgi_param REQUEST_URI $request_uri;
96 fastcgi_param PATH_INFO $document_uri;
97 fastcgi_param REMOTE_ADDR $remote_addr;
98 fastcgi_param REMOTE_PORT $remote_port;
99 fastcgi_param SERVER_NAME $host;
100 fastcgi_param SERVER_PORT '443';
101 fastcgi_param SERVER_PROTOCOL 'https';
102 fastcgi_param USER_ROLES $motion_user_role;
103 fastcgi_pass unix:/motion-socket/motion.fcgi;
104 }
105 ```