]> WPIA git - motion.git/blob - README.md
upd: add some info for system requirements
[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 # Usage
37
38 Within the motion content markdown can be used for formatting e.g. 
39 * To add a line break add two lines
40 * to enter a link use `[text](https//domain.tld/link)`
41
42 ## Settings for nginx
43
44 To control the access this map is used:
45
46 ```
47 map "$host:$ssl_client_serial:$ssl_client_i_dn" $motion_user_role {
48 "host.domain.tld:serialnumber:/issuername" 'username/create:* vote:* cancel:* audit:*';
49 ...
50 default "<invalid>/";
51 }
52 ```
53
54 example taken from motions.board.wpia.club:
55 ```
56 map "$host:$ssl_client_serial:$ssl_client_i_dn" $motion_user_role {
57 "motions.board.wpia.club:0a0000000a1234567890abcdef1234567890abcde:/CN=Orga 2019-2/O=TC InterimCA/OU=TC InterimCAs/C=AT" 'president/create:* vote:* cancel:* audit:*';
58 ...
59 default "<invalid>/";
60 }
61 ```
62
63
64 ## configuration
65 ```
66 listen 0.0.0.0:443 ssl;
67 listen [::]:443 ssl;
68 server_name host.domain.tld;
69 gzip on;
70 ssl_certificate /etc/ssl/private/host.domain.tld.crt;
71 ssl_certificate_key /etc/ssl/private/host.domain.tld.key;
72
73 ssl_client_certificate /etc/ssl/host.domain.tld.pem;
74 ssl_verify_client on;
75 ssl_verify_depth 4;
76 access_log /tmp/host.domain.tld.log motion-cert;
77
78 location / {
79 fastcgi_param QUERY_STRING $query_string;
80 fastcgi_param REQUEST_METHOD $request_method;
81 fastcgi_param CONTENT_TYPE $content_type;
82 fastcgi_param CONTENT_LENGTH $content_length;
83 fastcgi_param REQUEST_URI $request_uri;
84 fastcgi_param PATH_INFO $document_uri;
85 fastcgi_param REMOTE_ADDR $remote_addr;
86 fastcgi_param REMOTE_PORT $remote_port;
87 fastcgi_param SERVER_NAME $host;
88 fastcgi_param SERVER_PORT '443';
89 fastcgi_param SERVER_PROTOCOL 'https';
90 fastcgi_param USER_ROLES $motion_user_role;
91 fastcgi_pass unix:/motion-socket/motion.fcgi;
92 }
93 ```