Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 3cdf5a1

Browse files
authored
Fix up healthcheck generation for workers docker image (#12405)
This wasn't quite generating the right thing.
1 parent 961ee75 commit 3cdf5a1

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

changelog.d/12405.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix up healthcheck generation for workers docker image.

docker/Dockerfile-workers

-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ COPY ./docker/conf-workers/* /conf/
1414
# Expose nginx listener port
1515
EXPOSE 8080/tcp
1616

17-
# Volume for user-editable config files, logs etc.
18-
VOLUME ["/data"]
19-
2017
# A script to read environment variables and create the necessary
2118
# files to run the desired worker configuration. Will start supervisord.
2219
COPY ./docker/configure_workers_and_start.py /configure_workers_and_start.py

docker/configure_workers_and_start.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
308308
309309
Args:
310310
environ: _Environ[str]
311-
config_path: Where to output the generated Synapse main worker config file.
311+
config_path: The location of the generated Synapse main worker config file.
312312
data_dir: The location of the synapse data directory. Where log and
313313
user-facing config files live.
314314
"""
@@ -321,7 +321,8 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
321321
# and adding a replication listener.
322322

323323
# First read the original config file and extract the listeners block. Then we'll add
324-
# another listener for replication. Later we'll write out the result.
324+
# another listener for replication. Later we'll write out the result to the shared
325+
# config file.
325326
listeners = [
326327
{
327328
"port": 9093,
@@ -387,6 +388,10 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
387388
# worker_type + instance #
388389
worker_type_counter: Dict[str, int] = {}
389390

391+
# A list of internal endpoints to healthcheck, starting with the main process
392+
# which exists even if no workers do.
393+
healthcheck_urls = ["http://localhost:8080/health"]
394+
390395
# For each worker type specified by the user, create config values
391396
for worker_type in worker_types:
392397
worker_type = worker_type.strip()
@@ -411,6 +416,8 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
411416
# Update the shared config with any worker-type specific options
412417
shared_config.update(worker_config["shared_extra_conf"])
413418

419+
healthcheck_urls.append("http://localhost:%d/health" % (worker_port,))
420+
414421
# Check if more than one instance of this worker type has been specified
415422
worker_type_total_count = worker_types.count(worker_type)
416423
if worker_type_total_count > 1:
@@ -476,15 +483,10 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
476483
# Determine the load-balancing upstreams to configure
477484
nginx_upstream_config = ""
478485

479-
# At the same time, prepare a list of internal endpoints to healthcheck
480-
# starting with the main process which exists even if no workers do.
481-
healthcheck_urls = ["http://localhost:8080/health"]
482-
483486
for upstream_worker_type, upstream_worker_ports in nginx_upstreams.items():
484487
body = ""
485488
for port in upstream_worker_ports:
486489
body += " server localhost:%d;\n" % (port,)
487-
healthcheck_urls.append("http://localhost:%d/health" % (port,))
488490

489491
# Add to the list of configured upstreams
490492
nginx_upstream_config += NGINX_UPSTREAM_CONFIG_BLOCK.format(

scripts-dev/complement.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ if [[ -n "$WORKERS" ]]; then
5252
COMPLEMENT_DOCKERFILE=SynapseWorkers.Dockerfile
5353

5454
# And provide some more configuration to complement.
55-
export COMPLEMENT_SPAWN_HS_TIMEOUT_SECS=25
55+
export COMPLEMENT_SPAWN_HS_TIMEOUT_SECS=60
5656
else
5757
export COMPLEMENT_BASE_IMAGE=complement-synapse
5858
COMPLEMENT_DOCKERFILE=Dockerfile

0 commit comments

Comments
 (0)