taler-deployment

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

main.sh (2656B)


      1 #!/bin/bash
      2 # This file is in the public domain.
      3 
      4 # main.sh is the main script that asks the questions and
      5 # puts the answers into environment variables located at  "config/taler-internal.conf or config/taler.conf" files
      6 # Nginx configuration - Reads values directly from these "config files".
      7 
      8 set -eu
      9 
     10 # include functions source file
     11 
     12 source functions.sh
     13 
     14 # Clear logs
     15 
     16 > setup.log
     17 
     18 # include variables from configuration
     19 mkdir -p config/
     20 touch config/user.conf config/internal.conf
     21 # Values we generated
     22 source config/internal.conf
     23 
     24 # Ask questions to user
     25 # START USER INTERACTION
     26 say "Welcome to the GNU Taler regional currency setup!"
     27 say ""
     28 say "All configuration values asked during the setup script"
     29 say "can be changed in config/user.conf."
     30 say "Logs are written in setup.log."
     31 say ""
     32 
     33 # END USER INTERACTION
     34 
     35 # Check if the user is root, otherwise EXIT.
     36 check_user
     37 
     38 # Installation of deb packages required
     39 say ""
     40 say "Installing packages (step 1 of 6)"
     41 . install_packages.sh
     42 
     43 say ""
     44 say "Interactive configuration (step 2 of 6)"
     45 load_config
     46 
     47 # Remove when libeufin currencies.conf is in sync with exchange
     48 cat >>/usr/share/libeufin/config.d/netzbon.conf <<EOF
     49 [CURRENCY-NETZBON]
     50 enabled=yes
     51 name=NetzBon
     52 code=NETZBON
     53 fractional_input_digits=2
     54 fractional_normal_digits=2
     55 fractional_trailing_zero_digits=2
     56 alt_unit_names={"0":"NETZBON"}
     57 EOF
     58 
     59 if test -z "${BANK_EXCHANGE_PASSWORD:-}"; then
     60   BANK_EXCHANGE_PASSWORD=$(uuidgen)
     61   echo "BANK_EXCHANGE_PASSWORD=\"${BANK_EXCHANGE_PASSWORD}\"" >>config/internal.conf
     62 fi
     63 
     64 if test -z "${BANK_PORT:-}"; then
     65   echo "BANK_PORT=8080" >>config/user.conf
     66   export BANK_PORT=8080
     67 fi
     68 
     69 say ""
     70 say "Configuring nginx (step 3 of 6)"
     71 ./config_nginx.sh
     72 
     73 say ""
     74 say "Setting up libeufin (step 4 of 6)"
     75 ./setup-libeufin.sh
     76 
     77 say ""
     78 say "Setting up exchange (step 5 of 6)"
     79 ./setup-exchange.sh
     80 
     81 say ""
     82 say "Setting up merchant (step 6 of 6)"
     83 ./setup-merchant.sh
     84 
     85 # Final message to the user
     86 say ""
     87 say "Congratulations, you have successfully installed GNU Taler"
     88 say "Your bank is at ${PROTO}://bank.${DOMAIN_NAME}/"
     89 if test ${BANK_ADMIN_PASSWORD_GENERATED} == y; then
     90   say "You can connect to the bank web UI as 'admin' using '${BANK_ADMIN_PASSWORD}'"
     91 else
     92   say "You can connect to the bank web UI as 'admin' using the password you entered earlier"
     93 fi
     94 say "A merchant is at ${PROTO}://backend.${DOMAIN_NAME}/"
     95 say "You should set credentials for the merchant soon."
     96 say "The exchange withdraw URI is taler://withdraw-exchange/exchange.${DOMAIN_NAME}/"
     97 
     98 if test ${DO_CONVERSION} == y; then
     99   say "For currency conversion to work, you must manually complete"
    100   say "the EBICS configuration."
    101 fi
    102 
    103 exit 0
    104 # END INSTALLATION