SynapseWorkers.Dockerfile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # This dockerfile builds on top of 'docker/Dockerfile-worker' in matrix-org/synapse
  2. # by including a built-in postgres instance, as well as setting up the homeserver so
  3. # that it is ready for testing via Complement.
  4. #
  5. # Instructions for building this image from those it depends on is detailed in this guide:
  6. # https://github.com/matrix-org/synapse/blob/develop/docker/README-testing.md#testing-with-postgresql-and-single-or-multi-process-synapse
  7. FROM matrixdotorg/synapse-workers
  8. # Download a caddy server to stand in front of nginx and terminate TLS using Complement's
  9. # custom CA.
  10. # We include this near the top of the file in order to cache the result.
  11. RUN curl -OL "https://github.com/caddyserver/caddy/releases/download/v2.3.0/caddy_2.3.0_linux_amd64.tar.gz" && \
  12. tar xzf caddy_2.3.0_linux_amd64.tar.gz && rm caddy_2.3.0_linux_amd64.tar.gz && mv caddy /root
  13. # Install postgresql
  14. RUN apt-get update && \
  15. DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y postgresql-13
  16. # Configure a user and create a database for Synapse
  17. RUN pg_ctlcluster 13 main start && su postgres -c "echo \
  18. \"ALTER USER postgres PASSWORD 'somesecret'; \
  19. CREATE DATABASE synapse \
  20. ENCODING 'UTF8' \
  21. LC_COLLATE='C' \
  22. LC_CTYPE='C' \
  23. template=template0;\" | psql" && pg_ctlcluster 13 main stop
  24. # Modify the shared homeserver config with postgres support, certificate setup
  25. # and the disabling of rate-limiting
  26. COPY conf-workers/workers-shared.yaml /conf/workers/shared.yaml
  27. WORKDIR /data
  28. # Copy the caddy config
  29. COPY conf-workers/caddy.complement.json /root/caddy.json
  30. COPY conf-workers/postgres.supervisord.conf /etc/supervisor/conf.d/postgres.conf
  31. COPY conf-workers/caddy.supervisord.conf /etc/supervisor/conf.d/caddy.conf
  32. # Copy the entrypoint
  33. COPY conf-workers/start-complement-synapse-workers.sh /
  34. # Expose caddy's listener ports
  35. EXPOSE 8008 8448
  36. ENTRYPOINT ["/start-complement-synapse-workers.sh"]
  37. # Update the healthcheck to have a shorter check interval
  38. HEALTHCHECK --start-period=5s --interval=1s --timeout=1s \
  39. CMD /bin/sh /healthcheck.sh