[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-deployment] branch master updated: Restarting merchant with MERCH
From: |
gnunet |
Subject: |
[taler-deployment] branch master updated: Restarting merchant with MERCHANT_AUTH_TOKEN in env. |
Date: |
Fri, 28 May 2021 17:51:01 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository deployment.
The following commit(s) were added to refs/heads/master by this push:
new 76029d3 Restarting merchant with MERCHANT_AUTH_TOKEN in env.
76029d3 is described below
commit 76029d3e9c8bc9e41d27fca7d84106bfa4d9aaea
Author: MS <ms@taler.net>
AuthorDate: Fri May 28 17:47:26 2021 +0200
Restarting merchant with MERCHANT_AUTH_TOKEN in env.
More checks to see whether the merchant restarted correctly.
---
bin/taler-deployment-config-instances | 63 +++++++++++++++++++++++++++--------
1 file changed, 50 insertions(+), 13 deletions(-)
diff --git a/bin/taler-deployment-config-instances
b/bin/taler-deployment-config-instances
index 162ae52..06199d8 100755
--- a/bin/taler-deployment-config-instances
+++ b/bin/taler-deployment-config-instances
@@ -80,31 +80,68 @@ def ensure_instance(instance_id, name, payto_uris, auth):
else:
exit(1)
+def is_merchant_running():
+ for proc in psutil.process_iter():
+ if proc.name() == "taler-merchant-httpd" and proc.username ==
getuser():
+ return True
+ return False
+
+
def ensure_default_instance():
- system("taler-deployment-arm -k taler-merchant")
- # Wait that merchant actually terminated.
- still_running = True
- while still_running:
- still_running = False
- for proc in psutil.process_iter():
- if proc.name() == "taler-merchant-httpd" and proc.username ==
getuser():
- still_running = True
- sleep(1)
- break
+ # Assumed is managed by ARM
+ if is_merchant_running():
+ system("taler-deployment-arm -k taler-merchant")
+
+ checks = 10
+ while checks > 0:
+ if is_merchant_running():
+ sleep(1)
+ checks--
+ continue
+ break
+
+ if checks == 0:
+ print("Could not stop the running merchant.")
+ exit(1)
+ # ARM is _not_ running the merchant at this point.
env_with_token = environ.copy()
env_with_token["TALER_MERCHANT_TOKEN"] = TALER_ENV_FRONTENDS_APITOKEN
+
+ # Start the merchant natively.
merchant = Popen(["taler-merchant-httpd"], env=env_with_token)
- wait_merchant()
+ # Check it started correctly and it is ready to serve requests.
+ checks = 10
+ while checks > 0:
+
+ try:
+ resp = get(MERCHANT_BACKEND_BASE_URL, timeout=1.5):
+ except Exception:
+ sleep(1)
+ checks--
+ continue
+
+ if resp.status_code != 200:
+ sleep(1)
+ checks--
+ continue
+
+ if checks == 0:
+ print("Could not start the merchant (with TALER_MERCHANT_TOKEN in the
env).")
+ exit(1)
+
ensure_instance(
- "default",
+ "default",
"default",
payto_uris=[f"payto://x-taler-bank/bank.{TALER_ENV_NAME}.taler.net/Taler"],
- auth=dict(method="token", token="secret-token:sandbox")
+ auth=dict(method="token", token=TALER_ENV_FRONTENDS_APITOKEN)
)
+
merchant.terminate()
merchant.wait()
+
+ print("Starting the merchant again via ARM")
system("taler-deployment-arm -i taler-merchant")
ensure_default_instance()
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-deployment] branch master updated: Restarting merchant with MERCHANT_AUTH_TOKEN in env.,
gnunet <=