docker-compose.yml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. environment:
  15. - SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
  16. volumes:
  17. # You may either store all the files in a local folder
  18. - ./files:/data
  19. # .. or you may split this between different storage points
  20. # - ./files:/data
  21. # - /path/to/ssd:/data/uploads
  22. # - /path/to/large_hdd:/data/media
  23. depends_on:
  24. - db
  25. # In order to expose Synapse, remove one of the following, you might for
  26. # instance expose the TLS port directly:
  27. ports:
  28. - 8448:8448/tcp
  29. # ... or use a reverse proxy, here is an example for traefik:
  30. labels:
  31. # The following lines are valid for Traefik version 1.x:
  32. - traefik.enable=true
  33. - traefik.frontend.rule=Host:my.matrix.Host
  34. - traefik.port=8008
  35. # Alternatively, for Traefik version 2.0:
  36. - traefik.enable=true
  37. - traefik.http.routers.http-synapse.entryPoints=http
  38. - traefik.http.routers.http-synapse.rule=Host(`my.matrix.host`)
  39. - traefik.http.middlewares.https_redirect.redirectscheme.scheme=https
  40. - traefik.http.middlewares.https_redirect.redirectscheme.permanent=true
  41. - traefik.http.routers.http-synapse.middlewares=https_redirect
  42. - traefik.http.routers.https-synapse.entryPoints=https
  43. - traefik.http.routers.https-synapse.rule=Host(`my.matrix.host`)
  44. - traefik.http.routers.https-synapse.service=synapse
  45. - traefik.http.routers.https-synapse.tls=true
  46. - traefik.http.services.synapse.loadbalancer.server.port=8008
  47. - traefik.http.routers.https-synapse.tls.certResolver=le-ssl
  48. db:
  49. image: docker.io/postgres:10-alpine
  50. # Change that password, of course!
  51. environment:
  52. - POSTGRES_USER=synapse
  53. - POSTGRES_PASSWORD=changeme
  54. # ensure the database gets created correctly
  55. # https://github.com/matrix-org/synapse/blob/master/docs/postgres.md#set-up-database
  56. - POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
  57. volumes:
  58. # You may store the database tables in a local folder..
  59. - ./schemas:/var/lib/postgresql/data
  60. # .. or store them on some high performance storage for better results
  61. # - /path/to/ssd/storage:/var/lib/postgresql/data