aboutsummaryrefslogtreecommitdiff
path: root/README
blob: 4ccf8b44717e42fab76a7f29b44834b7f5b40541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
This code implements a bank Web portal that tightly integrates with
the GNU Taler payment system.  The bank it primarily meant be used as
part of a demonstrator for the Taler system.

==================== Dependencies ==========================

-----------
For Debian:
-----------

First, you need to:

# apt-get install -t unstable git python3-django python3-psycopg2

Note that "make install" will re-download additional dependencies
needed for "make check".  For the above, at the time of writing, you
need Debian unstable, with older versions I get obscure errors.

================== HOW TO INSTALL THE BANK =================

From the repository's top directory, run

$ ./bootstrap

this operation will fetch additional libraries needed by the
bank (mostly JavaScript includes), and create the configure script.

The next step is to specify the install prefix, run

$ export PREFIX=$HOME/local # Adapt to your needs.
$ ./configure --prefix=$PREFIX

Then the usual GNU-compatible commands, that are

$ make install

and optionally

$ export PYTHONPATH=$PREFIX/lib/python3.5/site-packages/
$ make check # run the tests

================== HOW TO CONFIGURE THE BANK =================

The bank obeys to the INI syntax for configuration files. When launched, the bank
will by default look for a configuration file located at ~/.config/taler.conf.
To overide this behaviour, give the -c option when launching the bank.

In order to properly run, the bank needs the following parts to be configured

* Database name: connection string for the database to be used, currently Postgresql.
* Serving: whether we want the bank accessible via TCP or unix domain sockets.
* Fractional precision: precision of the fractional part of Taler objects.
* Fractional length: how many digits after the floating point we want to be shown
  in HTML pages.

Furthermore, the bank is "split" in two processes: the "normal" and the "admin" one.
The admin one implements the part of REST API used to transfer money from account
x to account y.  The normal one implements all the rest.
The reason is that the sysadmin may want to enforce special rules to make the admin
process reachable from the external world.

See the configuration file in the example below.

# Mandatory section name
[bank]

# We accept requests via unix domain sockets
UWSGI_SERVE = unix

# If we want serve the bank via TCP, just replace the statement
# above with the following one:
# UWSGI_SERVE = tcp
# And also give the port to listen to
# UWSGI_PORT = 8585

# The path below indicates where to create the unix domain socket
UWSGI_UNIXPATH = /deployment/sockets/bank.uwsgi

# The mode to assign to the unix domain socket when
# creating it (automatically done by the bank)
UWSGI_UNIXPATH_MODE = 660

# We want at most two fractional digits shown for amounts
# throughout the page pages
NDIGITS = 2

# The fractional part of Taler amount objects is 100000000.
# This value needs to be changed ONLY IF there is a change
# protocol-wise.  In other words, its value it's not up to the
# bank
FRACTION = 100000000

# The bank will try to connect to a database called 'talerlocal'
# running under Postgresql.  The sysadmin will have to make sure
# that the bank has all the rights to work on that database.
# NOTE, this value is optional, and the bank will fallback to sqlite3
# if not given.
DATABASE = postgres:///talerlocal

# The following sections are to configure the "admin" part of
# the bank

# Mandatory section name
[bank-admin]

# See above
UWSGI_SERVE = unix

# See above
UWSGI_UNIXPATH = /deployment/sockets/bank-admin.uwsgi

# See above
UWSGI_UNIXPATH_MODE = 660


================== HOW TO LAUNCH THE BANK =================

The bank can accept connections via the UWSGI protocol and HTTP.

To launch it for the UWSGI protocol, issue

$ taler-bank-manage serve-uwsgi
# The -a option launches the admin part of the bank
$ taler-bank-manage -a serve-uwsgi

To launch it for HTTP, issue

$ taler-bank-manage serve-http
# The -a option launches the admin part of the bank
$ taler-bank-manage -a serve-http

the port the bank will listen to, can be either specified on the
command line (option -p), or in the configuration file with the
HTTP_PORT option. Note, launching the bank with 'serve-http',
will make the UWSGI_SERVE option to be ignored.


================== HOW TO RUN YOUR TESTS =================

From the repository's top directory, just issue

$ make check

in order to have test cases run.  A previous 'make install' is
NOT required.

Test cases' code is hosted in talerbank/app/tests.py and
talerbank/app/tests_admin.py

================= HOW TO FORCE MIGRATIONS =================

https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html