gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-deployment] branch master updated: missing script


From: gnunet
Subject: [taler-deployment] branch master updated: missing script
Date: Wed, 22 Jan 2020 15:07:13 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new 52caf92  missing script
52caf92 is described below

commit 52caf92da5820e86d778a48bf793ac55db5e1f8f
Author: Florian Dold <address@hidden>
AuthorDate: Wed Jan 22 15:07:10 2020 +0100

    missing script
---
 bin/taler-config-generate | 322 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 322 insertions(+)

diff --git a/bin/taler-config-generate b/bin/taler-config-generate
new file mode 100755
index 0000000..9279593
--- /dev/null
+++ b/bin/taler-config-generate
@@ -0,0 +1,322 @@
+#!/usr/bin/env python3
+import click
+import sys
+from collections import OrderedDict
+import json
+import os
+import urllib.parse
+import stat
+
+class ConfigFile:
+    def __init__(self, envname, currency, exchange_pub, twisted, filename):
+        self.sections = OrderedDict()
+        self.envname = envname
+        self.filename = filename
+        self.currency = currency
+        self.twisted = twisted
+        self.exchange_pub = exchange_pub
+
+    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,
+         name,
+         value,
+         d_overlap="5 minutes",
+         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_"+obj.currency+"_"+name
+    obj.cfg_put(sec, "value", obj.currency+":"+value)
+    obj.cfg_put(sec, "duration_overlap", d_overlap)
+    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", obj.currency+":"+f_withdraw)
+    obj.cfg_put(sec, "fee_refresh", obj.currency+":"+f_refresh)
+    obj.cfg_put(sec, "fee_refund", obj.currency+":"+f_refund)
+    obj.cfg_put(sec, "fee_deposit", obj.currency+":"+f_deposit)
+    obj.cfg_put(sec, "rsa_keysize", rsa_keysize)
+
+def config(obj):
+    obj.cfg_put("paths", "TALER_DEPLOYMENT_DATA", "${HOME}/taler-data")
+    obj.cfg_put("paths", "TALER_DATA_HOME", "${HOME}/taler-data")
+    obj.cfg_put("taler", "CURRENCY", obj.currency)
+    obj.cfg_put("taler", "CURRENCY_ROUND_UNIT", f"{obj.currency}:0.01")
+
+    # Twisting the merchant backend responses.
+    if obj.twisted:
+
+        ##
+        # Instructs ARM to lunch the Twisters, any value works.
+        # If missing, ARM will not launch Twisters.
+        obj.cfg_put("twister", "taler_deploy", "")
+
+        obj.cfg_put("twister", "serve", "unix")
+        obj.cfg_put("twister", "chaos_rate", "20")
+        obj.cfg_put("twister", "destination_base_url", 
"https://backend.{}.taler.net".format(obj.envname))
+        obj.cfg_put("twister", "serve_unixpath", "$HOME/sockets/twister.http")
+        obj.cfg_put("twister", "serve_unixmode", "660")
+        obj.cfg_put("twister", "unixpath", 
"$HOME/sockets/twister-control.sock")
+        obj.cfg_put("twister", "unix_match_uid", "no")
+        obj.cfg_put("twister", "unix_match_gid", "yes")
+
+    obj.cfg_put("bank", "serve", "uwsgi")
+    obj.cfg_put("bank", "uwsgi_serve", "unix")
+    obj.cfg_put("bank", "uwsgi_unixpath", "$HOME/sockets/bank.uwsgi")
+    obj.cfg_put("bank", "uwsgi_unixpath_mode", "660")
+    obj.cfg_put("bank", "database", "taler"+obj.envname)
+    obj.cfg_put("bank", "max_debt", "%s:0.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", "database", "postgres:///taler{}".format(obj.envname))
+    obj.cfg_put("bank", "suggested_exchange", 
"https://exchange.{}.taler.net/".format(obj.envname))
+    obj.cfg_put("bank", "suggested_exchange_payto", 
"payto://x-taler-bank/bank.{}.taler.net/2".format(obj.envname))
+
+
+    obj.cfg_put("bank-admin", "uwsgi_serve", "unix")
+    obj.cfg_put("bank-admin", "uwsgi_unixpath", 
"$HOME/sockets/bank-admin.uwsgi")
+    obj.cfg_put("bank-admin", "uwsgi_unixpath_mode", "660")
+
+    obj.cfg_put("donations", "uwsgi_serve", "unix")
+    obj.cfg_put("donations", "uwsgi_unixpath", "$HOME/sockets/donations.uwsgi")
+    obj.cfg_put("donations", "uwsgi_unixpath_mode", "660")
+
+    obj.cfg_put("survey", "uwsgi_serve", "unix")
+    obj.cfg_put("survey", "uwsgi_unixpath", "$HOME/sockets/survey.uwsgi")
+    obj.cfg_put("survey", "uwsgi_unixpath_mode", "660")
+
+    obj.cfg_put("blog", "uwsgi_serve", "unix")
+    obj.cfg_put("blog", "uwsgi_unixpath", "$HOME/sockets/shop.uwsgi")
+    obj.cfg_put("blog", "uwsgi_unixpath_mode", "660")
+    obj.cfg_put("blog", "instance", "FSF")
+
+    obj.cfg_put("backoffice-all", "backend", 
"https://backend.{}.taler.net/".format(obj.envname))
+
+    # Keep only one back-office service for all instances, for simplicity.
+    obj.cfg_put("backoffice-all", "uwsgi_serve", "unix")
+    obj.cfg_put("backoffice-all", "uwsgi_unixpath_mode", "660")
+    obj.cfg_put("backoffice-all", "uwsgi_unixpath", 
"$HOME/sockets/backoffice.uwsgi")
+    obj.cfg_put("backoffice-all", "instances", "FSF default Tor")
+
+    obj.cfg_put("merchant", "wireformat", "test")
+    obj.cfg_put("merchant", "serve", "unix")
+    obj.cfg_put("merchant", "unixpath", "$HOME/sockets/merchant.http")
+    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{}".format(obj.envname))
+
+    if "demo" != obj.envname and obj.twisted:
+        obj.cfg_put("merchant-exchange-test", "url", 
"https://twister-exchange.wild.gv.taler.net/";)
+    else:
+        obj.cfg_put("merchant-exchange-test", "url", 
"https://exchange.{}.taler.net/".format(obj.envname))
+
+    obj.cfg_put("merchant-exchange-test", "master_key", obj.exchange_pub)
+
+    obj.cfg_put("frontends", "backend_apikey", "sandbox".format(obj.envname))
+
+    if "demo" != obj.envname and obj.twisted:
+        obj.cfg_put("frontends", "backend", 
"https://twister-backend.wild.gv.taler.net/";)
+    else:
+        obj.cfg_put("frontends", "backend", 
"https://backend.{}.taler.net/".format(obj.envname))
+
+    obj.cfg_put("merchant-exchange-{}".format(obj.currency), "master_key", 
obj.exchange_pub)
+    obj.cfg_put("merchant-exchange-{}".format(obj.currency), "currency", 
obj.currency)
+    obj.cfg_put("merchant-exchange-{}".format(obj.currency), "base_url", 
"https://exchange.{}.taler.net/".format(obj.envname))
+
+    obj.cfg_put("auditor", "serve", "unix")
+    obj.cfg_put("auditor", "auditor_url", 
"https://auditor.{}.taler.net/service/".format(obj.envname))
+    obj.cfg_put("auditor", "unixpath", "$HOME/sockets/auditor.http")
+    obj.cfg_put("auditor", "tiny_amount", obj.currency + ":0.01")
+
+    obj.cfg_put("exchange", "base_url", 
"https://exchange.{}.taler.net/".format(obj.envname))
+    obj.cfg_put("exchange", "serve", "unix")
+    obj.cfg_put("exchange", "unixpath", "$HOME/sockets/exchange.http")
+    obj.cfg_put("exchange", "master_public_key", obj.exchange_pub)
+    obj.cfg_put("exchange", "terms_etag", "0")
+    obj.cfg_put("exchange", "terms_dir", 
"$HOME/local/share/taler-exchange/tos")
+
+    obj.cfg_put("exchangedb-postgres", "db_conn_str", 
"postgres:///taler{}".format(obj.envname))
+    obj.cfg_put("exchangedb-postgres", "config", 
"postgres:///taler{}".format(obj.envname))
+    obj.cfg_put("auditordb-postgres", "db_conn_str", 
"postgres:///taler{}".format(obj.envname))
+    obj.cfg_put("auditordb-postgres", "config", 
"postgres:///taler{}".format(obj.envname))
+
+    if "demo" != obj.envname and obj.twisted:
+        bank_acct_url = 
"https://twister-bank.wild.gv.taler.net/taler-wire-gateway/Exchange/";
+    else:
+        bank_acct_url = 
f"https://bank.{obj.envname}.taler.net/taler-wire-gateway/Exchange/";
+
+    obj.cfg_put("exchange-account-1", "payto_uri", 
"payto://x-taler-bank/bank.{}.taler.net/Exchange".format(obj.envname))
+    obj.cfg_put("exchange-account-1", "wire_response", 
"${TALER_DATA_HOME}/exchange/wire/test.json")
+    obj.cfg_put("exchange-account-1", "plugin", "taler_bank")
+    obj.cfg_put("exchange-account-1", "wire_gateway_auth_method", "basic")
+    obj.cfg_put("exchange-account-1", "wire_gateway_url", bank_acct_url)
+    obj.cfg_put("exchange-account-1", "username", "Exchange")
+    obj.cfg_put("exchange-account-1", "password", "x")
+    obj.cfg_put("exchange-account-1", "enable_debit", "yes")
+    obj.cfg_put("exchange-account-1", "enable_credit", "yes")
+
+    obj.cfg_put("fees-x-taler-bank", "wire-fee-2018", obj.currency + ":" + 
"0.02")
+    obj.cfg_put("fees-x-taler-bank", "wire-fee-2019", obj.currency + ":" + 
"0.03")
+    obj.cfg_put("fees-x-taler-bank", "wire-fee-2020", obj.currency + ":" + 
"0.04")
+    obj.cfg_put("fees-x-taler-bank", "wire-fee-2021", obj.currency + ":" + 
"0.04")
+    obj.cfg_put("fees-x-taler-bank", "wire-fee-2022", obj.currency + ":" + 
"0.05")
+    obj.cfg_put("fees-x-taler-bank", "wire-fee-2023", obj.currency + ":" + 
"0.06")
+    obj.cfg_put("fees-x-taler-bank", "wire-fee-2024", obj.currency + ":" + 
"0.07")
+    obj.cfg_put("fees-x-taler-bank", "wire-fee-2025", obj.currency + ":" + 
"0.08")
+
+    obj.cfg_put("fees-x-taler-bank", "closing-fee-2018", obj.currency + ":" + 
"0.01")
+    obj.cfg_put("fees-x-taler-bank", "closing-fee-2019", obj.currency + ":" + 
"0.01")
+    obj.cfg_put("fees-x-taler-bank", "closing-fee-2020", obj.currency + ":" + 
"0.01")
+    obj.cfg_put("fees-x-taler-bank", "closing-fee-2021", obj.currency + ":" + 
"0.01")
+    obj.cfg_put("fees-x-taler-bank", "closing-fee-2022", obj.currency + ":" + 
"0.01")
+    obj.cfg_put("fees-x-taler-bank", "closing-fee-2023", obj.currency + ":" + 
"0.01")
+    obj.cfg_put("fees-x-taler-bank", "closing-fee-2024", obj.currency + ":" + 
"0.01")
+    obj.cfg_put("fees-x-taler-bank", "closing-fee-2025", obj.currency + ":" + 
"0.01")
+
+    # how long is one signkey valid?
+    obj.cfg_put("exchange_keys", "signkey_duration", "18 weeks")
+
+    # how long are the signatures with the signkey valid?
+    obj.cfg_put("exchange_keys", "legal_duration", "2 years")
+
+    # how long do we generate denomination and signing keys
+    # ahead of time?
+    obj.cfg_put("exchange_keys", "lookahead_sign", "32 weeks 1 day")
+
+    obj.cfg_put("exchange_keys", "lookahead_provide", "4 weeks 1 day")
+
+    # instance FSF
+    obj.cfg_put("instance-FSF", "keyfile", 
"${TALER_DATA_HOME}/merchant/fsf.priv")
+    obj.cfg_put("instance-FSF", "name", "Free Software Foundation")
+    obj.cfg_put("merchant-location-FSF-address", "street", "51 Franklin 
Street, Fifth Floor.")
+    obj.cfg_put("merchant-location-FSF-address", "city", "Boston")
+    obj.cfg_put("merchant-location-FSF-address", "country", "USA")
+    # instance Tor
+    obj.cfg_put("instance-Tor", "keyfile", 
"${TALER_DATA_HOME}/merchant/tor.priv")
+    obj.cfg_put("instance-Tor", "name", "The Tor Project")
+    # instance GNUnet
+    obj.cfg_put("instance-GNUnet", "keyfile", 
"${TALER_DATA_HOME}/merchant/gnunet.priv")
+    obj.cfg_put("instance-GNUnet", "name", "GNUnet Project")
+    # instance Taler
+    obj.cfg_put("instance-Taler", "keyfile", 
"${TALER_DATA_HOME}/merchant/taler.priv")
+    obj.cfg_put("instance-Taler", "name", "Taler")
+    # instance default
+    obj.cfg_put("instance-default", "keyfile", 
"${TALER_DATA_HOME}/merchant/default.priv")
+    obj.cfg_put("instance-default", "name", "Kudos Inc.")
+    obj.cfg_put("merchant-location-default-address", "country", "Kudosland")
+    obj.cfg_put("instance-default", "tip_reserve_priv_filename", 
"${TALER_DATA_HOME}/merchant/default-tip.priv")
+    obj.cfg_put("instance-default", "tip_exchange", 
"https://exchange.{}.taler.net/".format(obj.envname))
+    # instance tutorial
+    obj.cfg_put("instance-Tutorial", "keyfile", 
"${TALER_DATA_HOME}/merchant/tutorial.priv")
+    obj.cfg_put("instance-Tutorial", "name", "Tutorial")
+
+    if "demo" != obj.envname and obj.twisted:
+        obj.cfg_put("merchant-account-merchant", "payto_uri", 
"payto://x-taler-bank/twister-bank.taler.net/Tutorial")
+    else:
+        obj.cfg_put("merchant-account-merchant", "payto_uri", 
"payto://x-taler-bank/bank.{}.taler.net/Tutorial".format(obj.envname))
+
+    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")
+
+    obj.cfg_put("merchant-account-merchant", "HONOR_default", "YES")
+    obj.cfg_put("merchant-account-merchant", "HONOR_Tor", "YES")
+    obj.cfg_put("merchant-account-merchant", "HONOR_GNUnet", "YES")
+    obj.cfg_put("merchant-account-merchant", "HONOR_Taler", "YES")
+    obj.cfg_put("merchant-account-merchant", "HONOR_FSF", "YES")
+    obj.cfg_put("merchant-account-merchant", "HONOR_Tutorial", "YES")
+
+    coin(obj, "ct_10", "0.10")
+    coin(obj, "1", "1")
+    coin(obj, "2", "2")
+    coin(obj, "5", "5")
+    coin(obj, "10", "10")
+    coin(obj, "1000", "1000")
+
+
+@click.command()
+@click.option("--currency", default="KUDOS")
+@click.option("--envname", default="demo")
+@click.option("--outdir", required=True)
+# datadir is where all keys / wire-details files / are placed.
+@click.option("--exchange-pub", required=True)
+@click.option("--twisted", is_flag=True)
+def main(currency, envname, outdir, exchange_pub, twisted):
+
+    if envname not in ("demo", "test", "int", "euro", "chf"):
+        print("envname (%s) not demo/test/int, aborting config generation" % 
envname)
+        return
+
+    config_files = []
+
+    mc = ConfigFile(envname, currency, exchange_pub, twisted, "taler.conf")
+    config(mc)
+    config_files.append(mc)
+
+    sc = ConfigFile(envname, currency, exchange_pub, twisted, "sync.conf")
+    sc.cfg_put("sync", "annual_fee", sc.currency+":0.1")
+    sc.cfg_put("sync", "serve", "unix")
+    sc.cfg_put("sync", "unixpath", "$HOME/sockets/sync.http")
+    config_files.append(sc)
+
+    if "demo" != envname and twisted:
+
+        # Twisting the exchange.
+        twist_exchange_conf = ConfigFile(envname, currency, exchange_pub, 
"twister-exchange.conf")
+        twist_exchange_conf.cfg_put("twister", "serve", "unix")
+        twist_exchange_conf.cfg_put("twister", "chaos_rate", "20")
+        twist_exchange_conf.cfg_put("twister", "destination_base_url", 
"https://exchange.{}.taler.net"; % envname)
+        twist_exchange_conf.cfg_put("twister", "serve_unixpath", 
"$HOME/sockets/twister-exchange.http")
+        twist_exchange_conf.cfg_put("twister", "serve_unixmode", "660")
+        twist_exchange_conf.cfg_put("twister", "unixpath", 
"$HOME/sockets/twister-exchange-control.sock")
+        twist_exchange_conf.cfg_put("twister", "unix_match_uid", "no")
+        twist_exchange_conf.cfg_put("twister", "unix_match_gid", "yes")
+        config_files.append(twist_exchange_conf)
+
+        # Twisting the bank.
+        twist_bank_conf = ConfigFile(envname, currency, exchange_pub, 
"twister-bank.conf")
+        twist_bank_conf.cfg_put("twister", "serve", "unix")
+        twist_bank_conf.cfg_put("twister", "chaos_rate", "20")
+        twist_bank_conf.cfg_put("twister", "destination_base_url", 
"https://bank.{}.taler.net"; % envname)
+        twist_bank_conf.cfg_put("twister", "serve_unixpath", 
"$HOME/sockets/twister-bank.http")
+        twist_bank_conf.cfg_put("twister", "serve_unixmode", "660")
+        twist_bank_conf.cfg_put("twister", "unixpath", 
"$HOME/sockets/twister-bank-control.sock")
+        twist_bank_conf.cfg_put("twister", "unix_match_uid", "no")
+        twist_bank_conf.cfg_put("twister", "unix_match_gid", "yes")
+
+        config_files.append(twist_bank_conf)
+
+    assert (0 < len(config_files))
+    for obj in config_files:
+        obj.cfg_write(outdir)
+
+if __name__ == "__main__":
+    main()

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]