From a60d98654584e9c1c0602056d4b5150401912e22 Mon Sep 17 00:00:00 2001 From: streamer45 Date: Thu, 6 Jun 2024 15:59:49 +0200 Subject: [PATCH] Systemd --- docs/getting_started.md | 46 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index ed58805..6f4c49e 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -15,6 +15,9 @@ docker pull mattermost/rtcd:latest ## Running + +### Docker + To start `rtcd` we can run the following command: ```sh @@ -30,7 +33,7 @@ docker run --name rtcd -e "RTCD_LOGGER_ENABLEFILE=false" -e "RTCD_API_SECURITY_A - `8443/udp` and `8443/tcp` are the ports used to route all the calls related media traffic (i.e. voice, screen share). The first one (UDP) is preferred but the latter (TCP) can be used as a fallback. - `8045/tcp` Is the port used to serve the HTTP/WebSocket internal API to communicate with the Mattermost side (Calls plugin). -### Running with config file +#### Running with config file Of course it's also possible to provide the service with a complete config file by mounting a volume, e.g.: @@ -38,6 +41,47 @@ Of course it's also possible to provide the service with a complete config file docker run --name rtcd -v /path/to/rtcd/config:/config mattermost/rtcd -config /config/config.toml ``` +### Systemd + +Alternatively, the `rtcd` binary can be executed throuhg a systemd service file such as: + +``` +sudo touch /lib/systemd/system/rtcd.service +``` + +``` +[Unit] +Description=rtcd +After=network.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/rtcd +Restart=always +RestartSec=10 +User=mattermost +Group=mattermost +Environment=API_SECURITY_ALLOWSELFREGISTRATION=true + +[Install] +WantedBy=multi-user.target +``` + +> **_Note:_** By default the service starts even if no configuration file is provided. In such case default values are used. In the service file above we are overriding a config setting through environment variables: +> - `api.security.allow_self_registration` We set this to `true` so that clients (Mattermost instances) can automatically self register and authenticate to the service without manually having to create accounts. This is fine as long as the service is running in an internal/private network. + +Load the service file: + +``` +sudo systemctl daemon-reload +``` + +Enable and start the service: + +``` +sudo systemctl enable --now /lib/systemd/system/rtcd.service +``` + ### Verify service is running Finally, to verify that the service is correctly running we can try calling the HTTP API: