11. Magnet Bank Adapter Setup Manual#

taler-magnet-bank is a Magnet Bank Taler adapter.

In this manual, we explain how to setup an adapter.

11.1. Installing Adapter#

11.1.1. Building from source#

Magnet Bank Adapter belongs to the Taler Rust project, and can be downloaded via Git:

$ git clone git://git.taler.net/taler-rust
$ cd taler-rust

You will need the latest version of the rust stable toolchain:

$ sudo apt install rustup
$ rustup toolchain install stable

And a working C toolchain:

$ sudo apt install build-essential

Then from top-level run:

$ ./bootstrap

11.1.1.1. Install deb package#

To install the adapter as a Debian/Ubuntu package with an automated secure setup and systemd services:

$ cargo install cargo-deb
$ make deb
$ sudo dpkg -i target/debian/taler-magnet-bank*.deb

If the previous steps succeeded, the taler-magnet-bank command should be found in the $PATH.

11.1.1.2. Install binaries#

To install the adapter binaries and default configuration localy run:

$ ./configure --prefix=$PREFIX
$ make install

If the previous steps succeeded, the taler-magnet-bank command should be found in the $PATH.

11.2. Adapter Setup#

11.2.1. Using package script#

11.2.1.1. Database setup#

The configuration file must include a connection string that tells the adapter how it should connect to the database. The default is:

/etc/taler-magnet-bank/secrets/magnet-bank-db.secret.conf#
[magnet-bankdb-postgres]
config = postgres:///taler-magnet-bank

If the database is run on a different host, please follow the instructions from the PostgreSQL manual for configuring remote access.

Assuming the configuration is correct, the following command initializes (or upgrades) the database schema using: You can then use a script to automate a secure database setup:

$ sudo taler-magnet-bank-dbconfig

11.2.1.2. Worker setup#

You will need a Magnet Bank account to sync. Update the configuration files:

/etc/taler-magnet-bank/taler-magnet-bank.conf#
[magnet-bank]
IBAN = HU59131000073585363679133532
NAME = John Smith S.A.

/etc/taler-magnet-bank/secrets/magnet-bank-worker.secret.conf#
[magnet-bank-worker]
CONSUMER_KEY = $CONSUMER_KEY
CONSUMER_SECRET = $CONSUMER_SECRET

And finaly run the setup process:

$ sudo -u taler-magnet-bank-worker taler-magnet-bank -c /etc/taler-magnet-bank/taler-magnet-bank.conf setup

11.2.1.3. Server setup#

Update the configuration files:

/etc/taler-magnet-bank/conf.d/magnet-bank-httpd.conf#
[magnet-bank-httpd-wire-gateway-api]
ENABLED = YES

/etc/taler-magnet-bank/secrets/magnet-bank-httpd.secret.conf#
[magnet-bank-httpd-wire-gateway-api
AUTH_METHOD = bearer
TOKEN = $SECRET_TOKEN

Check the server is correctly configured:

$ sudo -u taler-magnet-bank-httpd taler-magnet-bank -c /etc/taler-magnet-bank/taler-magnet-bank.conf serve --check

11.2.2. Simple setup#

11.2.2.1. Database setup#

The configuration file must include a connection string that tells the adapter how it should connect to the database. The default is:

$CONFIG_FILE#
[magnet-bankdb-postgres]
config = postgres:///taler-magnet-bank

You must make sure that this database exists and is accessible to the user running the adapter before continuing. If the database is run on a different host, please follow the instructions from the PostgreSQL manual for configuring remote access.

Assuming that the configuration file exists at $CONFIG_FILE, the following command initializes (or upgrades) the database schema:

$ taler-magnet-bank -c "$CONFIG_FILE" dbinit

Update the configuration files:

$CONFIG_FILE#
[magnet-bank]
IBAN = HU59131000073585363679133532
NAME = John Smith S.A.

[magnet-bank-worker]
CONSUMER_KEY = $CONSUMER_KEY
CONSUMER_SECRET = $CONSUMER_SECRET

And finaly run the setup process:

$ taler-magnet-bank -c "$CONFIG_FILE" setup

11.2.2.2. Server setup#

Update the configuration files:

$CONF_FILE#
[magnet-bank-httpd-wire-gateway-api]
ENABLED = YES
AUTH_METHOD = bearer
TOKEN = $SECRET_TOKEN

Check the server is correctly configured:

$ taler-magnet-bank -c "$CONF_FILE" serve --check

11.3. Deployment#

$ sudo systemctl start taler-magnet-bank.target