taler-deployment

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

commit 656e65e8bd8a0ea606299516bcdd6fb641181592
parent 23c7b571077b5f8772deea7287567a40a8d21be5
Author: ms <ms@taler.net>
Date:   Fri, 24 Sep 2021 14:05:32 +0200

remove unused

Diffstat:
Dbin/WIP/taler-config-local | 244-------------------------------------------------------------------------------
1 file changed, 0 insertions(+), 244 deletions(-)

diff --git a/bin/WIP/taler-config-local b/bin/WIP/taler-config-local @@ -1,244 +0,0 @@ -#!/usr/bin/env python3 -import click -import sys -from collections import OrderedDict -import json -import os -import urllib.parse -import stat -from taler_urls import get_urls, get_port - - -class ConfigFile: - def __init__(self, filename): - self.sections = OrderedDict() - self.filename = filename - - def destroy(self): - del self.sections - self.sections = OrderedDict() - - def cfg_put(self, section_name, key, value): - s = self.sections[section_name] = self.sections.get(section_name, OrderedDict()) - s[key] = value - - def cfg_write(self, outdir): - - if outdir: - fstream = open(os.path.join(outdir, self.filename), "w") - else: - fstream = open(sys.stdout) - - for section_name, section in self.sections.items(): - fstream.write("[" + section_name + "]" + "\n") - for key, value in section.items(): - fstream.write(key + " = " + value + "\n") - fstream.write("\n") - fstream.close() - -def coin( - obj, - currency, - name, - value, - d_withdraw="3 years", - d_spend="5 years", - d_legal="10 years", - f_withdraw="0.01", - f_deposit="0.01", - f_refresh="0.01", - f_refund="0.01", - rsa_keysize="2048", -): - sec = "coin_" + currency + "_" + name - obj.cfg_put(sec, "value", currency + ":" + value) - obj.cfg_put(sec, "duration_withdraw", d_withdraw) - obj.cfg_put(sec, "duration_spend", d_spend) - obj.cfg_put(sec, "duration_legal", d_legal) - obj.cfg_put(sec, "fee_withdraw", currency + ":" + f_withdraw) - obj.cfg_put(sec, "fee_refresh", currency + ":" + f_refresh) - obj.cfg_put(sec, "fee_refund", currency + ":" + f_refund) - obj.cfg_put(sec, "fee_deposit", currency + ":" + f_deposit) - obj.cfg_put(sec, "rsa_keysize", rsa_keysize) - - -def config( - obj, - rev_proxy_url, - wire_method, - currency, - exchange_wire_address, - merchant_wire_address, - exchange_wire_gateway_username, - exchange_wire_gateway_password, -): - obj.cfg_put("paths", "TALER_DATA_HOME", "${HOME}/.taler-data") - obj.cfg_put("paths", "TALER_RUNTIME_DIR", "${HOME}/.taler-runtime") - obj.cfg_put("taler", "CURRENCY", obj.currency) - obj.cfg_put("taler", "CURRENCY_ROUND_UNIT", f"{currency}:0.01") - obj.cfg_put("bank", "serve", "uwsgi") - obj.cfg_put("bank", "uwsgi_serve", "unix") - obj.cfg_put("bank", "uwsgi_unixpath", "/tmp/bank.sock") - obj.cfg_put("bank", "uwsgi_unixpath_mode", "660") - obj.cfg_put("bank", "database", "taler") - obj.cfg_put("bank", "max_debt", "%s:500.0" % obj.currency) - obj.cfg_put("bank", "max_debt_bank", "%s:1000000000.0" % obj.currency) - obj.cfg_put("bank", "allow_registrations", "YES") - obj.cfg_put("bank", "base_url", rev_proxy_url + "/bank/") - obj.cfg_put("bank", "database", "postgres:///taler") - obj.cfg_put("bank", "suggested_exchange", rev_proxy_url + "/exchange/") - - obj.cfg_put("donations", "serve", "uwsgi") - obj.cfg_put("donations", "uwsgi_serve", "unix") - obj.cfg_put("donations", "uwsgi_unixpath", "/tmp/donations.sock") - obj.cfg_put("donations", "uwsgi_unixpath_mode", "660") - - obj.cfg_put("landing", "serve", "uwsgi") - obj.cfg_put("landing", "uwsgi_serve", "unix") - obj.cfg_put("landing", "uwsgi_unixpath", "/tmp/landing.sock") - obj.cfg_put("landing", "uwsgi_unixpath_mode", "660") - - obj.cfg_put("blog", "serve", "uwsgi") - obj.cfg_put("blog", "uwsgi_serve", "unix") - obj.cfg_put("blog", "uwsgi_unixpath", "/tmp/blog.sock") - obj.cfg_put("blog", "uwsgi_unixpath_mode", "660") - - obj.cfg_put("survey", "serve", "uwsgi") - obj.cfg_put("survey", "uwsgi_serve", "unix") - obj.cfg_put("survey", "uwsgi_unixpath", "/tmp/survey.sock") - obj.cfg_put("survey", "uwsgi_unixpath_mode", "660") - obj.cfg_put("survey", "bank_password", "x") - - obj.cfg_put("merchant", "serve", "unix") - obj.cfg_put("merchant", "unixpath", "/tmp/merchant-backend.sock") - obj.cfg_put("merchant", "wire_transfer_delay", "0 s") - obj.cfg_put("merchant", "default_max_wire_fee", obj.currency + ":" + "0.01") - obj.cfg_put("merchant", "default_max_deposit_fee", obj.currency + ":" + "0.05") - obj.cfg_put("merchantdb-postgres", "config", "postgres:///taler") - - obj.cfg_put("frontends", "backend", rev_proxy_url + "/merchant-backend/") - obj.cfg_put( - "merchant-exchange-{}".format(currency), - "exchange_base_url", rev_proxy_url + "/exchange/", - ) - - obj.cfg_put("auditor", "serve", "unix") - # FIXME: both below used? - obj.cfg_put("auditor", "base_url", rev_proxy_url + "/auditor") - obj.cfg_put("auditor", "auditor_url", rev_proxy_url + "/auditor") - obj.cfg_put("auditor", "unixpath", "/tmp/auditor.sock") - obj.cfg_put("auditor", "tiny_amount", currency + ":0.01") - - obj.cfg_put("taler-exchange-secmod-eddsa", "unixpath", "/tmp/exchange-secmod-eddsa.sock") - obj.cfg_put("taler-exchange-secmod-rsa", "unixpath", "/tmp/exchange-secmod-rsa.sock") - obj.cfg_put("taler-exchange-secmod-rsa", "sm_priv_key", - "/tmp/taler-data/taler-exchange-secmod-rsa/secmod-private-key" - ) - obj.cfg_put("exchange", "base_url", rev_proxy_url + "/exchange/") - - obj.cfg_put("exchange", "serve", "unix") - obj.cfg_put("exchange", "unixpath", "/tmp/exchange.sock") - - obj.cfg_put("exchange", "terms_etag", "0") - obj.cfg_put("exchange", "terms_dir", "$HOME/local/share/taler-exchange/tos") - obj.cfg_put("exchange", "privacy_etag", "0") - obj.cfg_put("exchange", "privacy_dir", "$HOME/local/share/taler-exchange/pp") - - - obj.cfg_put("exchangedb-postgres", "db_conn_str", "postgres:///taler") - obj.cfg_put("exchangedb-postgres", "config", "postgres:///taler") - obj.cfg_put("auditordb-postgres", "db_conn_str", "postgres:///taler") - obj.cfg_put("auditordb-postgres", "config", "postgres:///taler") - - obj.cfg_put( - "exchange-account-1", - "payto_uri", - f"payto://{wire_method}/{rev_proxy_url + '/bank'}/{exchange_wire_address}" - ) - obj.cfg_put("exchange-account-1", "enable_debit", "yes") - obj.cfg_put("exchange-account-1", "enable_credit", "yes") - obj.cfg_put("merchant-account-merchant", "payto_uri", - f"payto://{wire_method}/{rev_proxy_url + '/bank'}/{merchant_wire_address}" - ) - obj.cfg_put("merchant-account-merchant", - "wire_response", - "${TALER_DATA_HOME}/merchant/wire/merchant.json", - ) - obj.cfg_put("merchant-account-merchant", "wire_file_mode", "770") - - # The following block should be obsoleted by the new API to configure instances. - merchant_instance_names = ("default", "Tor", "GNUnet", "Taler", "FSF", "Tutorial") - for mi in merchant_instance_names: - obj.cfg_put("merchant-account-merchant", f"HONOR_{mi}", "YES") - obj.cfg_put("merchant-account-merchant", f"ACTIVE_{mi}", "YES") - - coin(obj, currency, "ct_10", "0.10") - coin(obj, currency, "1", "1") - coin(obj, currency, "2", "2") - coin(obj, currency, "5", "5") - coin(obj, currency, "10", "10") - coin(obj, currency, "1000", "1000") - -@click.command() -@click.option("--currency", required=True) -@click.option("--outdir", required=True) -@click.option("--exchange-pub", required=True) -@click.option("--exchange-wire-address", required=True) -@click.option("--merchant-wire-address", required=True) -@click.option("--rev-proxy-url", required=True) -# Expected to contain already the 'secret-token:' scheme. -@click.option("--frontends-apitoken", required=True) -def main( - currency, - outdir, - exchange_wire_address, - merchant_wire_address, - rev_proxy_url, - frontends_apitoken -): - - config_files = [] - - mc = ConfigFile("taler.conf") - mc.cfg_put("frontends", "backend_apikey", f"{frontends_apitoken}") - config(mc) # does 99% - config_files.append(mc) - - sc = ConfigFile("sync.conf") - sc.cfg_put("taler", "currency", currency) - sc.cfg_put("sync", "serve", "unix") - sc.cfg_put("sync", "unixpath", "$HOME/sockets/sync.http") - sc.cfg_put("sync", "apikey", f"Bearer {frontends_apitoken}") - sc.cfg_put("sync", "annual_fee", f"{currency}:0.1") - sc.cfg_put("sync", "fulfillment_url", "taler://fulfillment-success/") - sc.cfg_put("sync", "payment_backend_url", rev_proxy_url + "merchant-backend/instances/Taler/") - sc.cfg_put("syncdb-postgres", "config", f"postgres:///taler") - config_files.append(sc) - - ac = ConfigFile("anastasis.conf") - ac.cfg_put("taler", "currency", currency) - ac.cfg_put("anastasis", "serve", "unix") - ac.cfg_put("anastasis", "business_name", f"GNU Taler Demo Anastasis Provider") - ac.cfg_put("anastasis", "unixpath", "/tmp/anastasis.sock") - ac.cfg_put("anastasis", "annual_fee", f"{currency}:0") - ac.cfg_put("anastasis", "question_cost", f"{currency}:0") - ac.cfg_put("anastasis", "insurance", f"{currency}:0") - ac.cfg_put("anastasis", "truth_upload_fee", f"{currency}:0") - ac.cfg_put("anastasis", "fulfillment_url", "taler://fulfillment-success/") - ac.cfg_put("anastasis", "server_salt", "kreb3ia9dmj43gfa") - ac.cfg_put("stasis-postgres", "config", f"postgres:///taler") - ac.cfg_put("anastasis-merchant-backend", - "payment_backend_url", - rev_proxy_url "merchant-backend/instances/anastasis/" - ) - ac.cfg_put("anastasis-merchant-backend", "api_key", f"Bearer {frontends_apitoken}") - ac.cfg_put("authorization-question", "cost", f"{currency}:0") - ac.cfg_put("authorization-question", "enabled", "yes") - config_files.append(ac) - - assert 0 < len(config_files) - for obj in config_files: - obj.cfg_write(outdir) - -if __name__ == "__main__": - main()