Introduction
Dockerfile for installation of matrix open federated Instant Messaging and
VoIP communication server.
The riot.im web client has now his own docker file at github.
Contribution
If you want contribute to this project feel free to fork this project, do your
work in a branch and create a pull request.
To support this Dockerimage or my work you can pledge via bountysource or
paypal.me/silviofricke. 50% will go to charity.
Configuration
To configure run the image with "generate" as argument. You have to setup the
server domain and a /data-directory. After this you have to edit the
generated homeserver.yaml file.
To get the things done, "generate" will create a own self-signed certificate.
This needs to be changed for production usage.
Example:
$ docker run -v /tmp/data:/data --rm -e SERVER_NAME=localhost -e REPORT_STATS=no silviof/docker-matrix generate
Start
For starting you need the port bindings and a mapping for the/data-directory.
$ docker run -d -p 8448:8448 -p 3478:3478 -v /tmp/data:/data silviof/docker-matrix start
Port configurations
Matrix Homeserver
The following ports are used in the container for the Matrix server. You can use -p-option ondocker run to configure this part (eg.: -p 443:8448):8008,8448 tcp
Coturn server
If you only need STUN to work you need the following ports:3478, 5349 udp/tcp
The server has the following as alt-ports: 3479, 5350 udp/tcp
For TURN (using the server as a relay) you also need to forward this portrange:49152-65535/udp
You may also have to set the external ip of the server in turnserver.conf which is located in the /data volume:external-ip=XX.XX.XX.XX
In case you don't want to expose the whole port range on udp you can change the portrange in turnserver.conf:min-port=XXXXXmax-port=XXXXX
Version information
To get the installed synapse version you can run the image with version as
argument or look at the container via cat.
$ docker run -ti --rm silviof/docker-matrix version
-=> Matrix Version
synapse: master (7e0a1683e639c18bd973f825b91c908966179c15)
coturn: master (88bd6268d8f4cdfdfaffe4f5029d489564270dd6)
# docker exec -it CONTAINERID cat /synapse.version
synapse: master (7e0a1683e639c18bd973f825b91c908966179c15)
coturn: master (88bd6268d8f4cdfdfaffe4f5029d489564270dd6)
Environment variables
SERVER_NAME: Server and domain name, mandatory, needed only forgenerateREPORT_STATS: statistic report, mandatory, values:yesorno, needed
only forgenerateMATRIX_UID/MATRIX_GID: UserID and GroupID of user within container which
runs the synapse server. The files mounted under /data arechowned to this
ownership. Default isMATRIX_UID=991andMATRIX_GID=991. It can overriden
via-e MATRIX_UID=...and-e MATRIX_GID=...at start time.
build specific arguments
BV_SYN: synapse version, optional, defaults tomasterBV_TUR: coturn turnserver version, optional, defaults tomaster
For building of synapse version v0.11.0-rc2 and coturn with commit a9fc47e add--build-arg BV_SYN=v0.11.0-rc2 --build-arg BV_TUR=a9fc47efd77 to the docker
build command.
diff between system and fresh generated config file
To get a hint about new options etc you can do a diff between your configured
homeserver.yaml and a newly created config file. Call your image with diff as
argument.
$ docker run --rm -ti -v /tmp/data:/data silviof/docker-matrix diff
[...]
+# ldap_config:
+# enabled: true
+# server: "ldap://localhost"
+# port: 389
+# tls: false
+# search_base: "ou=Users,dc=example,dc=com"
+# search_property: "cn"
+# email_property: "email"
+# full_name_property: "givenName"
[...]
For generating of this output its diff from busybox used. The used diff
parameters can be changed through DIFFPARAMS environment variable. The
default is Naur.
Exported volumes
/data: data-container
After the latest update I'm getting error
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/synapse/app/homeserver.py", line 491, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/synapse/app/homeserver.py", line 486, in main
hs = setup(sys.argv[1:])
File "/usr/local/lib/python2.7/dist-packages/synapse/app/homeserver.py", line 289, in setup
config.setup_logging()
File "/usr/local/lib/python2.7/dist-packages/synapse/config/logger.py", line 122, in setup_logging
setup_logging(self.log_config, self.log_file, self.verbosity)
File "/usr/local/lib/python2.7/dist-packages/synapse/config/logger.py", line 173, in setup_logging
logging.config.dictConfig(yaml.load(f))
File "/usr/lib/python2.7/logging/config.py", line 794, in dictConfig
dictConfigClass(config).configure()
File "/usr/lib/python2.7/logging/config.py", line 576, in configure
'%r: %s' % (name, e))
ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/homeserver.log'
In homserver.yaml I have
log_file: "/data/homeserver.log"
so is it looking for the log file in the wrong place?
@rarcibero
On the error message the solution is wrong. There is typo in STATS and you need another -e. I think.
docker run -v /tmp/data:/data --rm -e SERVER_NAME={{hostname}} -e REPORT_STATS=yes silviof/docker-matrix generate
The "homeserver.yaml" must be edited.
Please note that recaptcha keys comments are missplaced. The Private Key is reffered as "Secret Key" and the Public Key is reffered as "Site Key" on Google Recaptcha.
Got error message on generate:
STOP! environment variable REPORT_STATS must be set to 'no' or 'yes'
Solution;
docker run -v /tmp/data:/data --rm -e SERVER_NAME={{hostname}} REPORT_STATUS=yes silviof/docker-matrix generate