[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-deployment] branch master updated (176d5b7 -> c0941eb)
From: |
gnunet |
Subject: |
[taler-deployment] branch master updated (176d5b7 -> c0941eb) |
Date: |
Sun, 14 Nov 2021 15:28:46 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a change to branch master
in repository deployment.
from 176d5b7 DCE
new 8c21fd6 taler-local
new c0941eb taler-local: launch euFin and donations
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
bin/WIP/taler-local | 203 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 186 insertions(+), 17 deletions(-)
diff --git a/bin/WIP/taler-local b/bin/WIP/taler-local
index 56fc938..bbb6abd 100755
--- a/bin/WIP/taler-local
+++ b/bin/WIP/taler-local
@@ -52,6 +52,8 @@ from werkzeug.exceptions import HTTPException
TALER_ROOT_DIR = Path.home() / ".taler"
+TALER_PREFIX = Path.home() / ".local"
+
# Print No Newline.
def print_nn(msg):
print(msg, end="")
@@ -101,9 +103,8 @@ def update_checkout(r: Repo, p: Path):
def default_configure(*extra):
- pfx = Path.home() / ".local"
extra_list = list(extra)
- subprocess.run(["./configure", f"--prefix={pfx}"] + extra_list, check=True)
+ subprocess.run(["./configure", f"--prefix={TALER_PREFIX}"] + extra_list,
check=True)
def pyconfigure(*extra):
"""For python programs, --prefix doesn't work."""
@@ -545,6 +546,16 @@ class TalerReverseProxy(Flask):
def get_app(self):
return self
+
+LOG_DIR = TALER_ROOT_DIR / "logs"
+UNIX_SOCKETS_DIR = TALER_ROOT_DIR / "sockets"
+REV_PROXY_NETLOC = "localhost:8080"
+REV_PROXY_PROTO = "http"
+NEXUS_DB_FILE = "/tmp/nexus.sqlite"
+SANDBOX_DB_FILE = "/tmp/sandbox.sqlite"
+REV_PROXY_URL = f"{REV_PROXY_PROTO}://{REV_PROXY_NETLOC}"
+SANDBOX_ADMIN_PASSWORD = "secret"
+
@cli.command()
def prepare():
@@ -718,12 +729,15 @@ def prepare():
CURRENCY = "EUR"
WIRE_METHOD = "sepa"
+ # euFin URLs
+ SANDBOX_URL = REV_PROXY_URL + "/sandbox"
+ NEXUS_URL = REV_PROXY_URL + "/nexus"
+
# Filesystem's paths
CFG_OUTDIR = TALER_ROOT_DIR / "config"
- UNIX_SOCKETS_DIR = TALER_ROOT_DIR / "sockets"
TALER_RUNTIME_DIR = TALER_ROOT_DIR / "runtime"
TALER_DATA_DIR = TALER_ROOT_DIR / "data"
- LOG_DIR = TALER_ROOT_DIR / "logs"
+ TALER_UNIT_FILES_DIR = TALER_ROOT_DIR / "systemd-unit-files"
# IBANs
IBAN_EXCHANGE = "EX00000000000000000000"
@@ -738,20 +752,10 @@ def prepare():
# Credentials / API keys
SANDBOX_ADMIN_USERNAME = "admin"
- SANDBOX_ADMIN_PASSWORD = "secret"
EXCHANGE_NEXUS_USERNAME = "exchange-nexus-user"
EXCHANGE_NEXUS_PASSWORD = "exchange-nexus-password"
FRONTENDS_API_TOKEN = "secret-token:secret"
TALER_MERCHANT_TOKEN = "secret-token:secret"
-
- # Network locations
- REV_PROXY_NETLOC = "localhost:8080"
- REV_PROXY_PROTO = "http"
-
- # URLs
- REV_PROXY_URL = f"{REV_PROXY_PROTO}://{REV_PROXY_NETLOC}"
- SANDBOX_URL = REV_PROXY_URL + "/sandbox"
- NEXUS_URL = REV_PROXY_URL + "/nexus"
# EBICS
EBICS_HOST_ID = "ebicsDeployedHost"
@@ -760,8 +764,6 @@ def prepare():
EBICS_URL = REV_PROXY_URL + "/sandbox/ebicsweb"
# euFin
- NEXUS_DB_FILE = "/tmp/nexus.sqlite"
- SANDBOX_DB_FILE = "/tmp/sandbox.sqlite"
EXCHANGE_BANK_ACCOUNT_NEXUS = "exchange-imported-account-nexus"
EXCHANGE_BANK_ACCOUNT_SANDBOX = "exchange-account-sandbox"
EXCHANGE_BANK_CONNECTION = "exchange-ebics-connection"
@@ -960,7 +962,7 @@ def prepare():
obj.cfg_put("donations", "serve", "uwsgi")
obj.cfg_put("donations", "uwsgi_serve", "unix")
- obj.cfg_put("donations", "uwsgi_unixpath", str(unix_sockets_dir /
"donations.Sock"))
+ obj.cfg_put("donations", "uwsgi_unixpath", str(unix_sockets_dir /
"donations.sock"))
obj.cfg_put("donations", "uwsgi_unixpath_mode", "660")
obj.cfg_put("landing", "serve", "uwsgi")
@@ -1574,5 +1576,172 @@ Logs: {rev_proxy.get_log_filename()}"
print_nn("Stopping the reverse proxy...")
rev_proxy.stop()
print(" OK")
+
+ print_nn("Installing SystemD unit files...")
+ systemd_user_dir = Path.home() / ".config" / "systemd" / "user"
+
+ if not systemd_user_dir.exists():
+ systemd_user_dir.mkdir(parents=True, exist_ok=True)
+
+ if not TALER_UNIT_FILES_DIR.exists():
+ TALER_UNIT_FILES_DIR.mkdir(parents=True, exist_ok=True)
+
+ # Exchange unit file.
+ exchange_unit = open(TALER_UNIT_FILES_DIR / "exchange.service", "w")
+ exchange_unit.write("[Unit]\n")
+ exchange_unit.write('Description="Taler Exchange"\n')
+ exchange_unit.write("[Service]\n")
+ exchange_unit.write(
+ f"ExecStart={TALER_PREFIX}/bin/taler-exchange-httpd -c {CFG_OUTDIR /
'taler.conf'}\n"
+ )
+ # Exchange RSA helper unit file.
+ exchange_rsa_unit = open(TALER_UNIT_FILES_DIR /
"exchange-secmod-rsa.service", "w")
+ exchange_rsa_unit.write("[Unit]\n")
+ exchange_rsa_unit.write('Description="Taler Exchange RSA security
module."\n')
+ exchange_rsa_unit.write("[Service]\n")
+ exchange_rsa_unit.write(
+ f"ExecStart={TALER_PREFIX}/bin/taler-exchange-secmod-rsa -c
{CFG_OUTDIR / 'taler.conf'}\n"
+ )
+ exchange_rsa_unit.close()
+ # Exchange EDDSA helper unit file.
+ exchange_eddsa_unit = open(TALER_UNIT_FILES_DIR /
"exchange-secmod-eddsa.service", "w")
+ exchange_eddsa_unit.write("[Unit]\n")
+ exchange_eddsa_unit.write('Description="Taler Exchange EDDSA security
module."\n')
+ exchange_eddsa_unit.write("[Service]\n")
+ exchange_eddsa_unit.write(
+ f"ExecStart={TALER_PREFIX}/bin/taler-exchange-secmod-eddsa -c
{CFG_OUTDIR / 'taler.conf'}\n"
+ )
+ exchange_eddsa_unit.close()
+ # Merchant unit file.
+ merchant_unit = open(TALER_UNIT_FILES_DIR / "merchant-backend.service",
"w")
+ merchant_unit.write("[Unit]\n")
+ merchant_unit.write('Description="Taler Merchant Backend"\n')
+ merchant_unit.write("[Service]\n")
+ merchant_unit.write(
+ f"ExecStart={TALER_PREFIX}/bin/taler-merchant-httpd -c {CFG_OUTDIR /
'taler.conf'}\n"
+ )
+
+ # Custom Postgres connection.
+ if os.environ.get("PGPORT"):
+ exchange_unit.write(f"EnvironmentFile={systemd_user_dir /
'exchange.env'}")
+ merchant_unit.write(f"EnvironmentFile={systemd_user_dir /
'merchant-backend.env'}")
+ with open(TALER_UNIT_FILES_DIR / "exchange.env", "w") as exchange_env:
+ exchange_env.write(f"PGPORT={os.environ.get('PGPORT')}")
+ with open(TALER_UNIT_FILES_DIR / "merchant-backend.env", "w") as
merchant_env:
+ merchant_env.write(f"PGPORT={os.environ.get('PGPORT')}")
+ # Symlinking the environment files into the SystemD canonical user
directory.
+ if not os.path.islink(systemd_user_dir / "exchange.env"):
+ os.symlink(exchange_env.name, systemd_user_dir / "exchange.env")
+ if not os.path.islink(systemd_user_dir / "merchant-backend.env"):
+ os.symlink(merchant_env.name, systemd_user_dir /
"merchant-backend.env")
+
+ exchange_unit.close()
+ merchant_unit.close()
+
+ # euFin unit files.
+ sandbox_unit = open(TALER_UNIT_FILES_DIR / "sandbox.service", "w")
+ sandbox_unit.write("[Unit]\n")
+ sandbox_unit.write('Description="euFin Sandbox"\n')
+ sandbox_unit.write("[Service]\n")
+ sandbox_unit.write(
+ f"ExecStart={TALER_PREFIX}/bin/libeufin-sandbox serve
--with-unix-socket {UNIX_SOCKETS_DIR / 'sandbox.sock'}\n"
+ )
+ sandbox_unit.write(f"EnvironmentFile={systemd_user_dir / 'sandbox.env'}")
+ sandbox_unit.close()
+
+ nexus_unit = open(TALER_UNIT_FILES_DIR / "nexus.service", "w")
+ nexus_unit.write("[Unit]\n")
+ nexus_unit.write('Description="euFin Nexus"\n')
+ nexus_unit.write("[Service]\n")
+ nexus_unit.write(
+ f"ExecStart={TALER_PREFIX}/bin/libeufin-nexus serve --with-unix-socket
{UNIX_SOCKETS_DIR / 'nexus.sock'}\n"
+ )
+ nexus_unit.write(f"EnvironmentFile={systemd_user_dir / 'nexus.env'}")
+ nexus_unit.close()
+ # euFin env files.
+ sandbox_env = open(TALER_UNIT_FILES_DIR / "sandbox.env", "w")
+
sandbox_env.write(f"LIBEUFIN_SANDBOX_DB_CONNECTION=jdbc:sqlite:{SANDBOX_DB_FILE}\n")
+
sandbox_env.write(f"LIBEUFIN_SANDBOX_ADMIN_PASSWORD={SANDBOX_ADMIN_PASSWORD}")
+ sandbox_env.close()
+ nexus_env = open(TALER_UNIT_FILES_DIR / "nexus.env", "w")
+
nexus_env.write(f"LIBEUFIN_NEXUS_DB_CONNECTION=jdbc:sqlite:{NEXUS_DB_FILE}")
+ nexus_env.close()
+
+ # Frontends
+ donations_unit = open(TALER_UNIT_FILES_DIR / "donations.service", "w")
+ donations_unit.write("[Unit]\n")
+ donations_unit.write("Description=Donation Website that accepts Taler
payments.\n")
+ donations_unit.write("[Service]\n")
+ donations_unit.write(
+ f"ExecStart={TALER_PREFIX}/bin/taler-merchant-demos donations -c
{CFG_OUTDIR / 'taler.conf'}\n"
+ )
+ donations_unit.write(f"EnvironmentFile={systemd_user_dir /
'donations.env'}\n")
+ donations_unit.close()
+ donations_env = open(TALER_UNIT_FILES_DIR / "donations.env", "w")
+ donations_env.write(f"PATH={os.environ.get('PATH')}")
+ donations_env.close()
+ # Symlinking the unit (and env, for euFin) files into the canonical
SystemD user directory.
+ if not os.path.islink(systemd_user_dir / "exchange.service"):
+ os.symlink(exchange_unit.name, systemd_user_dir / "exchange.service")
+ if not os.path.islink(systemd_user_dir / "merchant-backend.service"):
+ os.symlink(merchant_unit.name, systemd_user_dir /
"merchant-backend.service")
+ if not os.path.islink(systemd_user_dir / "exchange-secmod-rsa.service"):
+ os.symlink(exchange_rsa_unit.name, systemd_user_dir /
"exchange-secmod-rsa.service")
+ if not os.path.islink(systemd_user_dir / "exchange-secmod-eddsa.service"):
+ os.symlink(exchange_eddsa_unit.name, systemd_user_dir /
"exchange-secmod-eddsa.service")
+ if not os.path.islink(systemd_user_dir / "sandbox.service"):
+ os.symlink(sandbox_unit.name, systemd_user_dir / "sandbox.service")
+ if not os.path.islink(systemd_user_dir / "sandbox.env"):
+ os.symlink(sandbox_env.name, systemd_user_dir / "sandbox.env")
+ if not os.path.islink(systemd_user_dir / "nexus.service"):
+ os.symlink(nexus_unit.name, systemd_user_dir / "nexus.service")
+ if not os.path.islink(systemd_user_dir / "nexus.env"):
+ os.symlink(nexus_env.name, systemd_user_dir / "nexus.env")
+ if not os.path.islink(systemd_user_dir / "donations.service"):
+ os.symlink(donations_unit.name, systemd_user_dir / "donations.service")
+ if not os.path.islink(systemd_user_dir / "donations.env"):
+ os.symlink(donations_env.name, systemd_user_dir / "donations.env")
+
+ print(" OK")
+
+ # more units here..
+ print_nn("Reload SystemD...")
+ Command(["systemctl", "--user", "daemon-reload"]).run()
+ print(" OK")
+
+@cli.command()
+def launch():
+
+ subprocess.run(["systemctl", "--user", "start", "exchange.service"],
check=True)
+ subprocess.run(["systemctl", "--user", "start",
"exchange-secmod-rsa.service"], check=True)
+ subprocess.run(["systemctl", "--user", "start",
"exchange-secmod-eddsa.service"], check=True)
+ subprocess.run(["systemctl", "--user", "start",
"merchant-backend.service"], check=True)
+ subprocess.run(["systemctl", "--user", "start", "nexus.service"],
check=True)
+ subprocess.run(["systemctl", "--user", "start", "sandbox.service"],
check=True)
+ subprocess.run(["systemctl", "--user", "start", "donations.service"],
check=True)
+
+ rev_proxy = TalerReverseProxy(
+ LOG_DIR,
+ UNIX_SOCKETS_DIR,
+ REV_PROXY_PROTO,
+ REV_PROXY_NETLOC
+ )
+ netloc_parts = REV_PROXY_NETLOC.split(":")
+ rev_proxy.run(
+ host=netloc_parts[0],
+ port=netloc_parts[1],
+ debug=False
+ )
+ # Stop with CTRL+C
+ print_nn("Stopping the services...")
+ subprocess.run(["systemctl", "--user", "stop", "donations.service"],
check=True)
+ subprocess.run(["systemctl", "--user", "stop", "nexus.service"],
check=True)
+ subprocess.run(["systemctl", "--user", "stop", "sandbox.service"],
check=True)
+ subprocess.run(["systemctl", "--user", "stop",
"merchant-backend.service"], check=True)
+ subprocess.run(["systemctl", "--user", "stop", "exchange.service"],
check=True)
+ subprocess.run(["systemctl", "--user", "stop",
"exchange-secmod-rsa.service"], check=True)
+ subprocess.run(["systemctl", "--user", "stop",
"exchange-secmod-eddsa.service"], check=True)
+ print(" OK")
+
if __name__ == "__main__":
cli()
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-deployment] branch master updated (176d5b7 -> c0941eb),
gnunet <=