From ce591bf75b2b58a72539d100e941ccfdfa1e9f2b Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Wed, 6 Jan 2021 23:54:31 -0500 Subject: 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 --- docker/MoveToComplement.Dockerfile | 35 ----------------------------------- docker/configure_workers_and_start.py | 12 +++++++----- docker/start.py | 4 ++++ 3 files changed, 11 insertions(+), 40 deletions(-) delete mode 100644 docker/MoveToComplement.Dockerfile 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")) -- cgit 1.4.1