nixpkgs/nixos/tests/taler/common/nodes.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

209 lines
5.9 KiB
Nix
Raw Normal View History

tests/taler: init basic test Test build and services start, but libeufin-bank fails when trying to access the database to change the admin's password. We need to execute the command as the libeufin-bank user. tests/taler: add master private key tests/taler: rewrite `register_bank_account` to Nix tests/taler: rename libeufin node to bank tests/taler: use xtaler wire_type instead of iban tests/taler: remove redundant data from conf files tests/taler: enable exchange account tests/taler: remove unused talerConfig tests/taler: add client node and attempt a withdrawal tests/taler: systemd_run optional user and group args tests/taler: refactor and make a withdrawal tests/taler: refactor tasks into subtests tests/taler: properly read and test balance tests/taler: refactor commands and add comments nixos/taler: rename private key tests/taler: enable nexus service in bank node tests/taler: nexus fake incoming payment test tests/taler: use correct path for nexus client keys tests/taler: add merchant node tests/taler: merchant register instance tests/taler: init pay for order merchant tests/taler: fix payto uri tests/taler: withdraw smaller amount This makes the test faster tests/taler: verify balance tests/nixos: debugging merchant payment, cleanup tests/taler: fix libeufin command, use curl to register accounts tests/taler: add basic online test tests/taler: move nodes into separate directory tests/taler: fix insufficient balance error Turns out that the exchange wire fees need to be set up (even if they're 0) in order for the CLI wallet to deposit coins into the merchant's bank account. tests/taler: improve node importing, port forwarding tests/taler: import scripts from a separate file tests/taler: move tests into a sub-directory tests/taler: manually start services, cleanup This results in less overhead and conflict since components will not try to prematurely connect to the ones that haven't finished their set up. tests/taler: remove online test This was used to debug the insufficient balance problem, but it's not really that useful by itself. tests/taler: add nexus keys tests/taler: use bank initalAccounts option taler/tests: use initialAccount tests/taler: make nexus work tests/taler: don't run nexus test if there is no internet tests/taler: use openFirewall, remove manual package install fix(test): evaluation errors fix(test): create nexus role by enabling createLocalDatabase
2024-07-23 18:20:41 +01:00
{ lib, ... }:
let
# Forward SSH and WebUI ports to host machine
#
# Connect with: ssh root@localhost -p <hostPort>
# Access WebUI from: http://localhost:<hostPort>
#
# NOTE: This is only accessible from an interactive test, for example:
# $ eval $(nix-build -A nixosTests.taler.basic.driver)/bin/nixos-test-driver
mkNode =
{
sshPort ? 0,
webuiPort ? 0,
nodeSettings ? { },
}:
lib.recursiveUpdate {
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "yes";
PermitEmptyPasswords = "yes";
};
};
security.pam.services.sshd.allowNullPassword = true;
virtualisation.forwardPorts =
(lib.optionals (sshPort != 0) [
{
from = "host";
host.port = sshPort;
guest.port = 22;
}
])
++ (lib.optionals (webuiPort != 0) [
{
from = "host";
host.port = webuiPort;
guest.port = webuiPort;
}
]);
} nodeSettings;
in
rec {
CURRENCY = "KUDOS";
FIAT_CURRENCY = "CHF";
nodes = {
exchange =
{ config, lib, ... }:
mkNode {
sshPort = 1111;
webuiPort = 8081;
nodeSettings = {
services.taler = {
settings = {
taler.CURRENCY = CURRENCY;
};
includes = [
../conf/taler-accounts.conf
# The exchange requires a token from the bank, so its credentials
# need to be set at runtime
"/etc/taler/secrets/exchange-account.secret.conf"
];
tests/taler: init basic test Test build and services start, but libeufin-bank fails when trying to access the database to change the admin's password. We need to execute the command as the libeufin-bank user. tests/taler: add master private key tests/taler: rewrite `register_bank_account` to Nix tests/taler: rename libeufin node to bank tests/taler: use xtaler wire_type instead of iban tests/taler: remove redundant data from conf files tests/taler: enable exchange account tests/taler: remove unused talerConfig tests/taler: add client node and attempt a withdrawal tests/taler: systemd_run optional user and group args tests/taler: refactor and make a withdrawal tests/taler: refactor tasks into subtests tests/taler: properly read and test balance tests/taler: refactor commands and add comments nixos/taler: rename private key tests/taler: enable nexus service in bank node tests/taler: nexus fake incoming payment test tests/taler: use correct path for nexus client keys tests/taler: add merchant node tests/taler: merchant register instance tests/taler: init pay for order merchant tests/taler: fix payto uri tests/taler: withdraw smaller amount This makes the test faster tests/taler: verify balance tests/nixos: debugging merchant payment, cleanup tests/taler: fix libeufin command, use curl to register accounts tests/taler: add basic online test tests/taler: move nodes into separate directory tests/taler: fix insufficient balance error Turns out that the exchange wire fees need to be set up (even if they're 0) in order for the CLI wallet to deposit coins into the merchant's bank account. tests/taler: improve node importing, port forwarding tests/taler: import scripts from a separate file tests/taler: move tests into a sub-directory tests/taler: manually start services, cleanup This results in less overhead and conflict since components will not try to prematurely connect to the ones that haven't finished their set up. tests/taler: remove online test This was used to debug the insufficient balance problem, but it's not really that useful by itself. tests/taler: add nexus keys tests/taler: use bank initalAccounts option taler/tests: use initialAccount tests/taler: make nexus work tests/taler: don't run nexus test if there is no internet tests/taler: use openFirewall, remove manual package install fix(test): evaluation errors fix(test): create nexus role by enabling createLocalDatabase
2024-07-23 18:20:41 +01:00
exchange = {
enable = true;
debug = true;
openFirewall = true;
# https://docs.taler.net/taler-exchange-manual.html#coins-denomination-keys
# NOTE: use `taler-harness`, not `taler-wallet-cli`
tests/taler: init basic test Test build and services start, but libeufin-bank fails when trying to access the database to change the admin's password. We need to execute the command as the libeufin-bank user. tests/taler: add master private key tests/taler: rewrite `register_bank_account` to Nix tests/taler: rename libeufin node to bank tests/taler: use xtaler wire_type instead of iban tests/taler: remove redundant data from conf files tests/taler: enable exchange account tests/taler: remove unused talerConfig tests/taler: add client node and attempt a withdrawal tests/taler: systemd_run optional user and group args tests/taler: refactor and make a withdrawal tests/taler: refactor tasks into subtests tests/taler: properly read and test balance tests/taler: refactor commands and add comments nixos/taler: rename private key tests/taler: enable nexus service in bank node tests/taler: nexus fake incoming payment test tests/taler: use correct path for nexus client keys tests/taler: add merchant node tests/taler: merchant register instance tests/taler: init pay for order merchant tests/taler: fix payto uri tests/taler: withdraw smaller amount This makes the test faster tests/taler: verify balance tests/nixos: debugging merchant payment, cleanup tests/taler: fix libeufin command, use curl to register accounts tests/taler: add basic online test tests/taler: move nodes into separate directory tests/taler: fix insufficient balance error Turns out that the exchange wire fees need to be set up (even if they're 0) in order for the CLI wallet to deposit coins into the merchant's bank account. tests/taler: improve node importing, port forwarding tests/taler: import scripts from a separate file tests/taler: move tests into a sub-directory tests/taler: manually start services, cleanup This results in less overhead and conflict since components will not try to prematurely connect to the ones that haven't finished their set up. tests/taler: remove online test This was used to debug the insufficient balance problem, but it's not really that useful by itself. tests/taler: add nexus keys tests/taler: use bank initalAccounts option taler/tests: use initialAccount tests/taler: make nexus work tests/taler: don't run nexus test if there is no internet tests/taler: use openFirewall, remove manual package install fix(test): evaluation errors fix(test): create nexus role by enabling createLocalDatabase
2024-07-23 18:20:41 +01:00
denominationConfig = lib.readFile ../conf/taler-denominations.conf;
settings = {
exchange = {
inherit CURRENCY;
tests/taler: init basic test Test build and services start, but libeufin-bank fails when trying to access the database to change the admin's password. We need to execute the command as the libeufin-bank user. tests/taler: add master private key tests/taler: rewrite `register_bank_account` to Nix tests/taler: rename libeufin node to bank tests/taler: use xtaler wire_type instead of iban tests/taler: remove redundant data from conf files tests/taler: enable exchange account tests/taler: remove unused talerConfig tests/taler: add client node and attempt a withdrawal tests/taler: systemd_run optional user and group args tests/taler: refactor and make a withdrawal tests/taler: refactor tasks into subtests tests/taler: properly read and test balance tests/taler: refactor commands and add comments nixos/taler: rename private key tests/taler: enable nexus service in bank node tests/taler: nexus fake incoming payment test tests/taler: use correct path for nexus client keys tests/taler: add merchant node tests/taler: merchant register instance tests/taler: init pay for order merchant tests/taler: fix payto uri tests/taler: withdraw smaller amount This makes the test faster tests/taler: verify balance tests/nixos: debugging merchant payment, cleanup tests/taler: fix libeufin command, use curl to register accounts tests/taler: add basic online test tests/taler: move nodes into separate directory tests/taler: fix insufficient balance error Turns out that the exchange wire fees need to be set up (even if they're 0) in order for the CLI wallet to deposit coins into the merchant's bank account. tests/taler: improve node importing, port forwarding tests/taler: import scripts from a separate file tests/taler: move tests into a sub-directory tests/taler: manually start services, cleanup This results in less overhead and conflict since components will not try to prematurely connect to the ones that haven't finished their set up. tests/taler: remove online test This was used to debug the insufficient balance problem, but it's not really that useful by itself. tests/taler: add nexus keys tests/taler: use bank initalAccounts option taler/tests: use initialAccount tests/taler: make nexus work tests/taler: don't run nexus test if there is no internet tests/taler: use openFirewall, remove manual package install fix(test): evaluation errors fix(test): create nexus role by enabling createLocalDatabase
2024-07-23 18:20:41 +01:00
MASTER_PUBLIC_KEY = "2TQSTPFZBC2MC4E52NHPA050YXYG02VC3AB50QESM6JX1QJEYVQ0";
BASE_URL = "http://exchange:8081/";
};
exchange-offline = {
MASTER_PRIV_FILE = "${../conf/private.key}";
};
};
};
};
};
};
bank =
{ config, ... }:
mkNode {
sshPort = 2222;
webuiPort = 8082;
nodeSettings = {
services.libeufin.bank = {
enable = true;
debug = true;
openFirewall = true;
createLocalDatabase = true;
initialAccounts = [
{
username = "exchange";
password = "exchange";
name = "Exchange";
}
];
settings = {
libeufin-bank = {
WIRE_TYPE = "x-taler-bank";
# WIRE_TYPE = "iban";
X_TALER_BANK_PAYTO_HOSTNAME = "bank:8082";
# IBAN_PAYTO_BIC = "SANDBOXX";
BASE_URL = "http://bank:8082/";
tests/taler: init basic test Test build and services start, but libeufin-bank fails when trying to access the database to change the admin's password. We need to execute the command as the libeufin-bank user. tests/taler: add master private key tests/taler: rewrite `register_bank_account` to Nix tests/taler: rename libeufin node to bank tests/taler: use xtaler wire_type instead of iban tests/taler: remove redundant data from conf files tests/taler: enable exchange account tests/taler: remove unused talerConfig tests/taler: add client node and attempt a withdrawal tests/taler: systemd_run optional user and group args tests/taler: refactor and make a withdrawal tests/taler: refactor tasks into subtests tests/taler: properly read and test balance tests/taler: refactor commands and add comments nixos/taler: rename private key tests/taler: enable nexus service in bank node tests/taler: nexus fake incoming payment test tests/taler: use correct path for nexus client keys tests/taler: add merchant node tests/taler: merchant register instance tests/taler: init pay for order merchant tests/taler: fix payto uri tests/taler: withdraw smaller amount This makes the test faster tests/taler: verify balance tests/nixos: debugging merchant payment, cleanup tests/taler: fix libeufin command, use curl to register accounts tests/taler: add basic online test tests/taler: move nodes into separate directory tests/taler: fix insufficient balance error Turns out that the exchange wire fees need to be set up (even if they're 0) in order for the CLI wallet to deposit coins into the merchant's bank account. tests/taler: improve node importing, port forwarding tests/taler: import scripts from a separate file tests/taler: move tests into a sub-directory tests/taler: manually start services, cleanup This results in less overhead and conflict since components will not try to prematurely connect to the ones that haven't finished their set up. tests/taler: remove online test This was used to debug the insufficient balance problem, but it's not really that useful by itself. tests/taler: add nexus keys tests/taler: use bank initalAccounts option taler/tests: use initialAccount tests/taler: make nexus work tests/taler: don't run nexus test if there is no internet tests/taler: use openFirewall, remove manual package install fix(test): evaluation errors fix(test): create nexus role by enabling createLocalDatabase
2024-07-23 18:20:41 +01:00
# Allow creating new accounts
ALLOW_REGISTRATION = "yes";
# A registration bonus makes withdrawals easier since the
# bank account balance is not empty
REGISTRATION_BONUS_ENABLED = "yes";
REGISTRATION_BONUS = "${CURRENCY}:100";
DEFAULT_DEBT_LIMIT = "${CURRENCY}:500";
# NOTE: The exchange's bank account must be initialised before
# the main bank service starts, else it doesn't work.
# The `services.libeufin.bank.initialAccounts` option can be used to do this.
ALLOW_CONVERSION = "yes";
ALLOW_EDIT_CASHOUT_PAYTO_URI = "yes";
SUGGESTED_WITHDRAWAL_EXCHANGE = "http://exchange:8081/";
inherit CURRENCY FIAT_CURRENCY;
};
};
};
services.libeufin.nexus = {
enable = true;
debug = true;
openFirewall = true;
createLocalDatabase = true;
settings = {
# https://docs.taler.net/libeufin/setup-ebics-at-postfinance.html
nexus-ebics = {
# == Mandatory ==
CURRENCY = FIAT_CURRENCY;
# Bank
HOST_BASE_URL = "https://isotest.postfinance.ch/ebicsweb/ebicsweb";
BANK_DIALECT = "postfinance";
# EBICS IDs
HOST_ID = "PFEBICS";
USER_ID = "PFC00639";
PARTNER_ID = "PFC00639";
# Account information
IBAN = "CH4740123RW4167362694";
BIC = "BIC";
NAME = "nixosTest nixosTest";
# == Optional ==
CLIENT_PRIVATE_KEYS_FILE = "${../conf/client-ebics-keys.json}";
BANK_PUBLIC_KEYS_FILE = "${../conf/bank-ebics-keys.json}";
};
};
};
};
};
merchant =
{ config, ... }:
mkNode {
sshPort = 3333;
webuiPort = 8083;
nodeSettings = {
services.taler = {
settings = {
taler.CURRENCY = CURRENCY;
};
merchant = {
enable = true;
debug = true;
openFirewall = true;
settings.merchant-exchange-test = {
EXCHANGE_BASE_URL = "http://exchange:8081/";
MASTER_KEY = "2TQSTPFZBC2MC4E52NHPA050YXYG02VC3AB50QESM6JX1QJEYVQ0";
inherit CURRENCY;
};
};
};
};
};
client =
{ pkgs, ... }:
mkNode {
sshPort = 4444;
nodeSettings = {
environment.systemPackages = [ pkgs.taler-wallet-core ];
};
};
};
}