Skip to content

Commit abdb5b0

Browse files
author
Alan Christie
committed
fix: Attempt to fix wss listener issue and ess_cert_issuer moved to defaults
1 parent 4564d1f commit abdb5b0

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

ansible/roles/app/defaults/main.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ ess_ws_hostname: SetMe
1919
ess_ampq_url: SetMe
2020
# What image tag do you want to deploy?
2121
ess_image_tag: SetMe
22+
# SSL certificate issuer?
23+
# One of 'production', 'staging' or blank (for no SSL).
24+
ess_cert_issuer:
2225

2326
# Required with defaults ---------------------------------------------------------------
2427

ansible/roles/app/vars/main.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ ess_ingress_class: nginx
77
# and typically have 'letsencrypt-nginx-staging'
88
# and 'letsencrypt-nginx-production'
99
ess_cert_manager_issuer_base: letsencrypt-{{ ess_ingress_class }}
10-
# SSL certificate issuer?
11-
# One of 'production', 'staging' or blank (for no SSL).
12-
ess_cert_issuer:
1310

1411
# memcached image tag
1512
ess_memcached_tag: 1.6.39-alpine3.22

ws_listener.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"""
66
import argparse
77
import json
8+
import ssl
89

10+
import certifi
911
from simple_websocket import Client, ConnectionClosed
1012

1113

@@ -19,12 +21,20 @@ def main(c_args: argparse.Namespace):
1921
elif c_args.ordinal_offset:
2022
params = f"?stream_from_ordinal={c_args.ordinal_offset}"
2123

24+
# Compensate for observed CERTIFICATE_VERIFY_FAILED errors
25+
# when using secure web-sockets
26+
context = (
27+
ssl.create_default_context(cafile=certifi.where())
28+
if c_args.location.startswith("wss:")
29+
else None
30+
)
31+
2232
total_bytes = 0
2333
total_messages = 0
2434
min_bytes = 1_000_000
2535
max_bytes = 0
2636
url = f"{c_args.location}{params}"
27-
ws = Client.connect(url)
37+
ws = Client.connect(url, ssl_context=context)
2838
try:
2939
while True:
3040

0 commit comments

Comments
 (0)