commit 0fbf90871a5a811451510df5a70d4b2ab9015f53
parent 1edb0b058ed5639af28486936072be20ae357bf6
Author: Sebastian <sebasjm@gmail.com>
Date: Mon, 19 May 2025 09:13:23 -0300
test reg currency with podman
Diffstat:
7 files changed, 94 insertions(+), 2 deletions(-)
diff --git a/regional-currency/.gitignore b/regional-currency/.gitignore
@@ -1,2 +1,3 @@
config/
-setup.log
-\ No newline at end of file
+setup.log
+db.json
diff --git a/regional-currency/container/Dockerfile b/regional-currency/container/Dockerfile
@@ -0,0 +1,24 @@
+FROM debian
+
+ENV container podman
+ENV DEBIAN_FRONTEND noninteractive
+
+# Enable systemd.
+RUN apt-get update ; \
+ apt-get install -y nginx postgresql postgresql-client inetutils-ping procps vim less systemd systemd-sysv; \
+ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ; \
+ rm -rf /lib/systemd/system/multi-user.target.wants/* ; \
+ rm -rf /etc/systemd/system/*.wants/* ; \
+ rm -rf /lib/systemd/system/local-fs.target.wants/* ; \
+ rm -rf /lib/systemd/system/sockets.target.wants/*udev* ; \
+ rm -rf /lib/systemd/system/sockets.target.wants/*initctl* ; \
+ rm -rf /lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup* ; \
+ rm -rf /lib/systemd/system/systemd-update-utmp*
+
+RUN systemctl enable postgresql.service
+RUN systemctl enable nginx.service
+
+EXPOSE 80/tcp
+
+CMD ["/lib/systemd/systemd"]
+
diff --git a/regional-currency/container/README b/regional-currency/container/README
@@ -0,0 +1,23 @@
+Run with podman
+---------------
+
+This folder contains scripts to be able to test the regional setup with podman
+
+Start by building the image with `build.sh` script, it will create an debian image named `taler` with the minimal software necessary to run all-in-one machine. The image is expected to listen on port 80, so you may allow that port to be able to be open with a unpriviledge user. You can use the following command:
+
+# sysctl net.ipv4.ip_unprivileged_port_start=80
+
+Once the images is built, run `start.sh` to create the cointainer. It will start systemd with all the service. You can test it by running:
+
+# curl exchange.taler.localhost
+
+from cli and you will get the response of the nginx running inside the container.
+
+From now on you can kill the container, stop it and start it again. Running the `start.sh` will replace all the previous information.
+
+Starting the container won't setup the regional currency environment, for that you have to get inside the virtual machine using `enter.sh` when the container is running and run the `run.sh` script which will make sure no previous values are carried from old setup and run the `main.sh` script. Since the regional-currency folder will be located in the `/root` directory inside the virtual machine the run script can be run using the following command:
+
+# /root/container/run.sh
+
+After the setup is completed, the script `withdraw.sh` can help to test a withdrawal and the `diagnose.sh` to find out if there a problem.
+
diff --git a/regional-currency/container/build.sh b/regional-currency/container/build.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+# This file is in the public domain.
+
+podman build -f container/Dockerfile -t taler
diff --git a/regional-currency/container/enter.sh b/regional-currency/container/enter.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+# This file is in the public domain.
+
+podman exec -it -w /root taler /bin/bash
+
diff --git a/regional-currency/container/run.sh b/regional-currency/container/run.sh
@@ -0,0 +1,29 @@
+# Workaround to help the script always work, specially
+
+# If the database doesn't have the exchange account the
+# script doesn't create a payto when this configuration
+# is present
+sed -i '/EXCHANGE_PAYTO=/d' config/user.conf
+
+# Prevent conflict of the pub key with new run
+sed -i '/MASTER_PUBLIC_KEY=/d' config/user.conf
+
+# Always generate a new token and update the configuration
+sed -i '/BANK_EXCHANGE_TOKEN=/d' config/internal.conf
+
+./main.sh
+
+source config/user.conf
+
+# Missing configuration on ebics
+taler-exchange-config -c /etc/libeufin/libeufin-nexus.conf -s nexus-ebics -o currency -V $CURRENCY
+
+# Allow the bank to authorize request with basic authentication
+# required by the merchant to be able to use the "new bank account" setup with
+# using the taler-revenue URL
+taler-exchange-config -c /etc/libeufin/libeufin-bank.conf -s libeufin-bank -o PWD_AUTH_COMPAT -V yes
+
+# Add some money into the accounts to easier testing
+taler-exchange-config -c /etc/libeufin/libeufin-bank.conf -s libeufin-bank -o DEFAULT_DEBT_LIMIT -V $CURRENCY:200000
+taler-exchange-config -c /etc/libeufin/libeufin-bank.conf -s libeufin-bank -o REGISTRATION_BONUS -V $CURRENCY:10000
+
diff --git a/regional-currency/container/start.sh b/regional-currency/container/start.sh
@@ -0,0 +1,7 @@
+#/bin/bash
+# This file is in the public domain.
+
+THIS_FILE=$(realpath "$0")
+DIR=$(dirname "$THIS_FILE")
+
+podman run --name taler --replace -p 80:80 -v $DIR/..:/root:O -ti taler