summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2021-01-06 23:54:31 -0500
committerAndrew Morgan <andrew@amorgan.xyz>2021-01-07 00:08:29 -0500
commitce591bf75b2b58a72539d100e941ccfdfa1e9f2b (patch)
treead1325bf3ef545830a58e781f853615f9761fece
parentRemove replication listener from the global template (diff)
downloadsynapse-ce591bf75b2b58a72539d100e941ccfdfa1e9f2b.tar.xz
Remove MoveToComplement.Dockerfile
Also added some debug logging in order to try and figure out why the
main homeserver config file isn't getting generated by start.py
-rw-r--r--docker/MoveToComplement.Dockerfile35
-rwxr-xr-xdocker/configure_workers_and_start.py12
-rwxr-xr-xdocker/start.py4
3 files changed, 11 insertions, 40 deletions
diff --git a/docker/MoveToComplement.Dockerfile b/docker/MoveToComplement.Dockerfile
deleted file mode 100644
index c91000bc7f..0000000000
--- a/docker/MoveToComplement.Dockerfile
+++ /dev/null
@@ -1,35 +0,0 @@
-# This dockerfile builds on top of Dockerfile-worker and includes a built-in postgres instance.
-# It is intended to be used for Complement testing
-
-FROM matrixdotorg/synapse:workers
-
-# Install postgres
-RUN apt-get update
-RUN apt-get install -y postgres
-
-# Create required databases in postgres
-
-# Create a user without a password
-RUN sudo -u postgres createuser -w synapse_user
-
-# Then set their password
-RUN sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'somesecret';"
-
-# Create the synapse database
-RUN sudo -u postgres psql -c "CREATE DATABASE synapse \
- ENCODING 'UTF8' \
- LC_COLLATE='C' \
- LC_CTYPE='C' \
- template=template0 \
- OWNER synapse_user;"
-
-# Modify Synapse's database config to point to the local postgres
-COPY ./docker/synapse_use_local_postgres.py /synapse_use_local_postgres.py
-RUN /synapse_use_local_postgres.py
-
-VOLUME ["/data"]
-
-EXPOSE 8008/tcp 8009/tcp 8448/tcp
-
-# Start supervisord
-CMD ["/usr/bin/supervisord"]
\ No newline at end of file
diff --git a/docker/configure_workers_and_start.py b/docker/configure_workers_and_start.py
index ceba03f71f..12ab81839f 100755
--- a/docker/configure_workers_and_start.py
+++ b/docker/configure_workers_and_start.py
@@ -144,7 +144,8 @@ def generate_base_homeserver_config():
     """
     # start.py already does this for us, so just call that.
     # note that this script is copied in in the official, monolith dockerfile
-    subprocess.check_output(["/usr/local/bin/python", "/start.py", "migrate_config"])
+    output = subprocess.check_output(["/usr/local/bin/python", "/start.py", "generate"], shell=True)
+    print("Got output:", output)
 
 
 def generate_worker_files(environ, config_path: str, data_dir: str):
@@ -302,11 +303,12 @@ stderr_logfile_maxbytes=0""".format_map(worker_config)
 
         worker_port += 1
 
-    # Write out the config files
+    # Write out the config files. We use append mode for each in case the
+    # files may have already been written to by others.
 
     # Shared homeserver config
     print(homeserver_config)
-    with open("/conf/workers/shared.yaml", "w") as f:
+    with open("/conf/workers/shared.yaml", "a") as f:
         f.write(homeserver_config)
 
     # Nginx config
@@ -314,7 +316,7 @@ stderr_logfile_maxbytes=0""".format_map(worker_config)
     print(nginx_config_template_header)
     print(nginx_config_body)
     print(nginx_config_template_end)
-    with open("/etc/nginx/conf.d/matrix-synapse.conf", "w") as f:
+    with open("/etc/nginx/conf.d/matrix-synapse.conf", "a") as f:
         f.write(nginx_config_template_header)
         f.write(nginx_config_body)
         f.write(nginx_config_template_end)
@@ -322,7 +324,7 @@ stderr_logfile_maxbytes=0""".format_map(worker_config)
     # Supervisord config
     print()
     print(supervisord_config)
-    with open("/etc/supervisor/conf.d/supervisord.conf", "w") as f:
+    with open("/etc/supervisor/conf.d/supervisord.conf", "a") as f:
         f.write(supervisord_config)
 
     # Ensure the logging directory exists
diff --git a/docker/start.py b/docker/start.py
index c3a6d96861..759d9b7062 100755
--- a/docker/start.py
+++ b/docker/start.py
@@ -134,6 +134,7 @@ def run_generate_config(environ, ownership):
 
     Never returns.
     """
+    print("running generate config")
     for v in ("SYNAPSE_SERVER_NAME", "SYNAPSE_REPORT_STATS"):
         if v not in environ:
             error("Environment variable '%s' is mandatory in `generate` mode." % (v,))
@@ -149,6 +150,8 @@ def run_generate_config(environ, ownership):
         log("Creating log config %s" % (log_config_file,))
         convert("/conf/log.config", log_config_file, environ)
 
+    print("Generating config at", config_path, "Config dir:", config_dir)
+
     args = [
         "python",
         "-m",
@@ -178,6 +181,7 @@ def run_generate_config(environ, ownership):
         os.execv("/usr/local/bin/python", args)
 
 def main(args, environ):
+    print("bla")
     mode = args[1] if len(args) > 1 else "run"
     desired_uid = int(environ.get("UID", "991"))
     desired_gid = int(environ.get("GID", "991"))