commit d2cf8b5af2308cbb36cbf2f90fc8bae941112cfb
parent 688e1e1a527206cdba5a38f493782adeed0eca4e
Author: Javier Sepulveda <javier.sepulveda@uv.es>
Date: Wed, 20 Sep 2023 10:48:14 +0200
Enable rewards checking balance script using HOST Systemd timer
Diffstat:
4 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/sandcastle/README b/sandcastle/README
@@ -72,21 +72,29 @@ $ docker compose up $image-name
'bank', 'exchange', 'merchant', 'talerdb' are valid values
for $image-name.
-Enabling tipping
+Enabling rewards
================
-The following command manually creates a tipping reserve:
+The following command (executed from the container CLI) manually creates a rewards reserve:
$ taler-harness deployment tip-topup --merchant-url https://backend.demo.taler.net/instances/survey/ --merchant-apikey=$MERCHANT_APIKEY --bank-access-url https://bank.demo.taler.net/demobanks/default/access-api/ --wire-method=iban --amount=KUDOS:5000 --bank-account=survey-at-sandbox --bank-password=$SURVEY_SECRET --exchange-url https://exchange.demo.taler.net/
-The status of tipping reserves can be checked via:
+The status of the rewards reserves can be checked via:
$ taler-harness deployment tip-status --merchant-url https://backend.demo.taler.net/instances/survey/ --merchant-apikey=$MERCHANT_APIKEY
-To purge all non-funded tipping reserves, run:
+To purge all non-funded rewards reserves, run:
$ taler-harness deployment tip-cleanup --merchant-url https://backend.demo.taler.net/instances/survey/ --merchant-apikey=$MERCHANT_APIKEY
+[*] - To enable the "rewards balance checking" script. Please execute after doing the "docker compose up" the next command from,
+the "deployment/sandcastle" directory.
+
+./utils/enable-services.sh
+
+This will put to run a systemd service, which will check the rewards balance once per week (this can be change editing
+the systemd/fund-rewards.timer).
+
How to run
==========
diff --git a/sandcastle/systemd/fund-rewards.service b/sandcastle/systemd/fund-rewards.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=fund rewards
+
+[Service]
+Type=oneshot
+WorkingDirectory=%h/deployment/sandcastle
+ExecStart=/usr/bin/docker compose exec exchange bash -c "/fund-rewards.sh"
+
+[Install]
+WantedBy=default.target
diff --git a/sandcastle/systemd/fund-rewards.timer b/sandcastle/systemd/fund-rewards.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=Run fund rewards script
+Requires=fund-rewards.service
+
+[Timer]
+Unit=fund-rewards.service
+OnCalendar=weekly
+Persistent=true
+
+[Install]
+WantedBy=timers.target
diff --git a/sandcastle/utils/enable-services.sh b/sandcastle/utils/enable-services.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+
+# Copy the fund-rewards.service and fund-rewards.timer files, to the host systemd folder
+
+cp systemd/fund-rewards.* ~/.config/systemd/user
+
+systemctl --user enable --now fund-rewards.timer