taler-deployment

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

commit f5229c862edd53d60e20aafd0f8fffa6b68c4c98
parent 34ec79cb93d2b3ce17aa2be3b258be1a643b0e1b
Author: Javier Sepulveda <javier.sepulveda@uv.es>
Date:   Fri,  3 Mar 2023 12:25:36 +0100

Merge MS' and Christian's work - Tested Okay,fails in DATABASE_CONNECTION variable

Diffstat:
Anetzbon/functions.sh | 22++++++++++++++++++++++
Mnetzbon/install_debian_packages.sh | 44+++++++++++++++++++++++++++++++++++---------
Mnetzbon/main.sh | 64+++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
Dnetzbon/netzbon.sh | 72------------------------------------------------------------------------
4 files changed, 110 insertions(+), 92 deletions(-)

diff --git a/netzbon/functions.sh b/netzbon/functions.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Message + +function say() +{ + echo "TALER: " "$@" +} + + +# Check user + + +function check_user() +{ + + if [ $(whoami) != "root" ]; then + say "Please run this script as root" + exit 1 + fi + +} diff --git a/netzbon/install_debian_packages.sh b/netzbon/install_debian_packages.sh @@ -1,16 +1,42 @@ #!/bin/bash # This file is in the public domain. +# Program versions +PG_VERSION=15 + +## Update + +apt update + +## General requirements + +apt install uuid-runtime \ + curl \ + wget \ + nginx \ + postgresql-${PG_VERSION} \ + postgresql-client-${PG_VERSION} \ + certbot -y + +## Add GNU Taler deb.taler.net to /etc/apt/sources.list + say "Adding GNU Taler Debian repository" -cat > /etc/apt/sources.list.d/taler.list <<EOF -deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/debian stable main -EOF -wget -P /etc/apt/keyrings/ \ - https://taler.net/taler-systems.gpg -say "Installing packages" +echo "deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/debian stable main" > /etc/apt/sources.list.d/taler.list + +wget -P /etc/apt/keyrings https://taler.net/taler-systems.gpg + +## Specific GNU Taler pakacges + +# FIXME +# We can avoid this instruction, if "taler-mechant" refers to +# database "postgres" instead of "pgsql" +su -lc "createdb pgsql" postgres + apt update -PG_VERSION=15 -apt install -y uuid-runtime nginx postgresql-${PG_VERSION} postgresql-client-${PG_VERSION} certbot -apt install -y taler-exchange-httpd taler-merchant-httpd libeufin +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 @@ -1,29 +1,71 @@ #!/bin/bash # This file is in the public domain. +# main.sh is the main script that asks the questions and +# puts the answers in environment variables in "deployment.conf" file +# Nginx configuration - Reads values directly from "deployment.conf" file. + set -eu -function say() -{ - echo "TALER: " "$@" -} +source functions.sh -echo "TALER: Welcome to the GNU Taler Debian setup!" +# Check if the user is root, otherwise EXIT. + +check_user -if (whoami != root) -then - say "Please run this script as root" - exit 1 -fi +# Installation of Debian packages required . install_debian_packages.sh +# 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` -#read -p "Enter the database connection " DATABASE_CONNECTION +read -s -p "Enter the password for the Webui backend: " WEB_INTERFACE_PASSWORD + +# Database default values + +DB_NAME="pgsql" +ROLE_NAME="postgres" +DATABASE_CONNECTION="jdbc:postgresql://localhost:5432/$DB_NAME?user=$ROLE_NAME" + +# END USER INTERACTION + +# START INSTALLATION . config_launch_libeufin.sh + +# ENABLE LIBEUFIN + +. config_launch_libeufin.sh + +systemctl enable --now libeufin-sandbox +systemctl enable --now libeufin-nexus + +# NGINX configuration + +read -p "Domain name: " DOMAIN_NAME + +SITES_AVAILABLE_DIR=/etc/nginx/sites-available +SITES_ENABLED_DIR=/etc/nginx/sites-enabled + +sed -i 's/#server_name example.com/server_name exchange.${DOMAIN_NAME}/g' ${SITES_AVAILABLE_DIR}/taler-exchange.conf +sed -i 's/server_name localhost/server_name merchant.${DOMAIN_NAME}/g' ${SITES_AVAILABLE_DIR}/taler-merchant.conf + +ln -s ${SITES_AVAILABLE_DIR}/taler-merchant ${SITES_ENABLED_DIR}/taler-merchant.conf +ln -s ${SITES_AVAILABLE_DIR}/taler-exchange ${SITES_ENABLED_DIR}/taler-exchange.conf + +systemctl reload nginx + +echo "Congratulations, you have successfully installed GNU Taler" +echo "Please check your browser now at http://localhost:80" + +# END INSTALLATION diff --git a/netzbon/netzbon.sh b/netzbon/netzbon.sh @@ -1,72 +0,0 @@ -#!/bin/bash - -apt update -apt install wget -y - -# Add taler repo -echo "deb [signed-by=/etc/apt/keyrings/taler-systems.gpg] https://deb.taler.net/apt/debian stable main" > /etc/apt/sources.list.d/taler.list - -wget -P /etc/apt/keyrings/ https://taler.net/taler-systems.gpg - -# Install dependencies - -apt install taler postgresql nginx -y - -# Create, fill and load config file - -# touch deployment.conf - -# echo "CUSTOM_PASSWORD=....." > deployment.conf -# echo "NEXT_VARIABLE=..." >> deployment.conf - -# source deployment.conf - -# DATABASE - -# DB Merchant, configuration - -# We can avoid this instruction, if "taler-mechant" refers to -# database "postgres" instead of "pgsql" - -su -lc "createdb pgsql" postgres - - -# DB Exchange, configuration - -# echo "CREATE USER taler" | psql -U postgres -# echo "CREATE DATABASE taler_db" | psql -U taler -# echo "ALTER ROLE taler WITH PASSWORD ${CUSTOM_PASSWORD}" | psql -U taler - -# echo "ALTER SYSTEM SET logging_collector TO 'true';" | psql -U postgres -# echo "ALTER SYSTEM SET log_directory TO '/logs';" | psql -U postgres -# echo "ALTER SYSTEM SET log_filename TO 'postgres-%Y-%m-%d.log';" | psql -U postgres - -# pg_ctl restart - -# END DATABASE configuration - -# EXCHANGE - -apt install taler-exchange -y - -# MERCHANT - -apt install taler-merchant -y - -# LIBEUFIN - -apt install libeufin -y - -systemctl enable --now libeufin-sandbox -systemctl enable --now libeufin-nexus - - -# NGINX configuration - -ln -s /etc/nginx/sites-available/taler-merchant /etc/nginx/sites-enabled/taler-merchant.conf -ln -s /etc/nginx/sites-available/taler-exchange /etc/nginx/sites-enabled/taler-exchange.conf - -systemctl reload nginx - -echo "Congratulations, you have successfully installed GNU Taler" -echo "Please check your browser now at http://localhost:80"