taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

commit c65e71d23dea126a4cf24368dc7774f53cace563
parent 03e99d4fd5365919b1d82916188145693f09e1cf
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  4 Mar 2023 10:36:46 +0100

clean up

Diffstat:
Mnetzbon/functions.sh | 14++++++++------
Mnetzbon/install_debian_packages.sh | 8+++-----
Mnetzbon/main.sh | 82+++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
3 files changed, 64 insertions(+), 40 deletions(-)

diff --git a/netzbon/functions.sh b/netzbon/functions.sh @@ -20,20 +20,22 @@ function check_user() } # Create users "exchange" and "merchant" - +# Deprecated: should be done by Debian! function create_users() { + say "Creating users" for n in exchange merchant do - # In case users already exists, remove it - deluser $n || true - rm -rf /home/$n - adduser --disabled-password $n + # Only setup use if it does not yet exist + if test ! -d /home/$n + then + adduser --disabled-password $n + fi done } # Assign group and permissions to users - +# Deprecated: should be done by Debian! function assign_user_permissions() { for n in exchange merchant diff --git a/netzbon/install_debian_packages.sh b/netzbon/install_debian_packages.sh @@ -26,17 +26,15 @@ echo "deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/ wget -P /etc/apt/keyrings https://taler.net/taler-systems.gpg -## Specific GNU Taler pakacges +## Specific GNU Taler packages # FIXME # We can avoid this instruction, if "taler-mechant" refers to # database "postgres" instead of "pgsql" -su -lc "createdb pgsql" postgres +# CG: FIXME: this step makes no sense, commenting out for now. +# su -lc "createdb pgsql" postgres apt update apt install taler-exchange -y apt install taler-merchant -y - -# apt install -y taler-exchange-httpd -# apt insttall -y taler-merchant-httpd apt install libeufin -y diff --git a/netzbon/main.sh b/netzbon/main.sh @@ -11,43 +11,67 @@ set -eu source functions.sh -# include variables config/taler.conf -source config/taler.conf - -# Check if the user is root, otherwise EXIT. - -check_user - -# Installation of Debian packages required - -. install_debian_packages.sh +# include variables from configuration +mkdir -p config/ +touch config/user.conf config/internal.conf +# Values supplied by user +source config/user.conf +# Values we generated +source config/internal.conf +# Ask questions to user # START USER INTERACTION - echo "TALER: Welcome to the GNU Taler Debian setup!" -# Ask questions to user - -read -p "Enter the admin password for the bank " SANDBOX_ADMIN_PASSWORD -read -p "Enter the name of the currency (e.g. 'EUR') " CURRENCY - -NEXUS_EXCHANGE_PASSWORD=`uuidgen` -SANDBOX_EXCHANGE_PASSWORD=`uuidgen` +if test -z "${CURRENCY:-}" +then + read -p "Enter the name of the currency (e.g. 'EUR') " CURRENCY + echo "CURRENCY=${CURRENCY}" >> config/taler.conf +fi +if test -z "${SANDBOX_ADMIN_PASSWORD:-}" +then + read -p "Enter the admin password for the bank " SANDBOX_ADMIN_PASSWORD + echo "SANDBOX_ADMIN_PASSWORD=${SANDBOX_ADMIN_PASSWORD}" >> config/taler.conf +fi +if test -z "${DOMAIN_NAME:-}" +then + read -s -p "Enter the domain name: " DOMAIN_NAME + echo "DOMAIN_NAME=${DOMAIN_NAME}" >> config/taler.conf +fi +# END USER INTERACTION -read -s -p "Enter the password for the Webui backend: " WEB_INTERFACE_PASSWORD +# Check DNS settings +ping -c1 exchange.${DOMAIN_NAME} &> /dev/null +if test 0 != $? +then + say "Could not ping exchange.${DOMAIN_NAME}." + say "Please make sure your DNS/network are working." + exit 1 +fi + +if test -z "${NEXUS_EXCHANGE_PASSWORD:-}" +then + NEXUS_EXCHANGE_PASSWORD=`uuidgen` + echo "NEXUS_EXCHANGE_PASSWORD=${NEXUS_EXCHANGE_PASSWORD}" >> config/internal.conf +fi +if test -z "${SANDBOX_EXCHANGE_PASSWORD:-}" +then + SANDBOX_EXCHANGE_PASSWORD=`uuidgen` + echo "SANDBOX_EXCHANGE_PASSWORD=${SANDBOX_EXCHANGE_PASSWORD}" >> config/internal.conf +fi -# END USER INTERACTION +# Check if the user is root, otherwise EXIT. +check_user -# Put variables into taler-internal.conf -echo "SANDBOX_ADMIN_PASSWORD=${SANDBOX_ADMIN_PASSWORD}" > config/taler-internal.conf -echo "CURRENCY=${CURRENCY}" >> config/taler-internal.conf -echo "WEB_INTERFACE_PASSWORD=${WEB_INTERFACE_PASSWORD}" >> config/taler-internal.conf -echo "NEXUS_EXCHANGE_PASSWORD}=${NEXUS_EXCHANGE_PASSWORD}" >> config/taler-internal.conf -echo "SANDBOX_EXCHANGE_PASSWORD=${SANDBOX_EXCHANGE_PASSWORD}" >> config/taler-internal.conf +# Installation of Debian packages required +. install_debian_packages.sh # ENABLE MERCHANT & EXCHANGE -create_users -assign_user_permissions +# FIXME: these should have been done by the Debian +# packages! +# create_users +# assign_user_permissions + . setup-exchange.sh . setup-merchant.sh @@ -58,7 +82,7 @@ assign_user_permissions . config_launch_libeufin.sh -systemctl enable --now libeufin-sandbox +systemctl enable --now libeufin-sandbox systemctl enable --now libeufin-nexus # NGINX configuration