1
0

docker-compose.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # This compose file is compatible with Compose itself, it might need some
  2. # adjustments to run properly with stack.
  3. version: '3'
  4. services:
  5. synapse:
  6. build:
  7. context: ../..
  8. dockerfile: docker/Dockerfile
  9. image: docker.io/matrixdotorg/synapse:latest
  10. # Since synapse does not retry to connect to the database, restart upon
  11. # failure
  12. restart: unless-stopped
  13. # See the readme for a full documentation of the environment settings
  14. # NOTE: You must edit homeserver.yaml to use postgres, it defaults to sqlite
  15. environment:
  16. - SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
  17. volumes:
  18. # You may either store all the files in a local folder
  19. - ./files:/data
  20. # .. or you may split this between different storage points
  21. # - ./files:/data
  22. # - /path/to/ssd:/data/uploads
  23. # - /path/to/large_hdd:/data/media
  24. depends_on:
  25. - db
  26. # In order to expose Synapse, remove one of the following, you might for
  27. # instance expose the TLS port directly:
  28. ports:
  29. - 8448:8448/tcp
  30. # ... or use a reverse proxy, here is an example for traefik:
  31. labels:
  32. # The following lines are valid for Traefik version 1.x:
  33. - traefik.enable=true
  34. - traefik.frontend.rule=Host:my.matrix.Host
  35. - traefik.port=8008
  36. # Alternatively, for Traefik version 2.0:
  37. - traefik.enable=true
  38. - traefik.http.routers.http-synapse.entryPoints=http
  39. - traefik.http.routers.http-synapse.rule=Host(`my.matrix.host`)
  40. - traefik.http.middlewares.https_redirect.redirectscheme.scheme=https
  41. - traefik.http.middlewares.https_redirect.redirectscheme.permanent=true
  42. - traefik.http.routers.http-synapse.middlewares=https_redirect
  43. - traefik.http.routers.https-synapse.entryPoints=https
  44. - traefik.http.routers.https-synapse.rule=Host(`my.matrix.host`)
  45. - traefik.http.routers.https-synapse.service=synapse
  46. - traefik.http.routers.https-synapse.tls=true
  47. - traefik.http.services.synapse.loadbalancer.server.port=8008
  48. - traefik.http.routers.https-synapse.tls.certResolver=le-ssl
  49. db:
  50. image: docker.io/postgres:12-alpine
  51. # Change that password, of course!
  52. environment:
  53. - POSTGRES_USER=synapse
  54. - POSTGRES_PASSWORD=changeme
  55. # ensure the database gets created correctly
  56. # https://matrix-org.github.io/synapse/latest/postgres.html#set-up-database
  57. - POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
  58. volumes:
  59. # You may store the database tables in a local folder..
  60. - ./schemas:/var/lib/postgresql/data
  61. # .. or store them on some high performance storage for better results
  62. # - /path/to/ssd/storage:/var/lib/postgresql/data