Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions cmdeploy/src/cmdeploy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,22 @@ def _remove_rspamd() -> None:
apt.packages(name="Remove rspamd", packages="rspamd", present=False)


def _configure_coturn(config) -> bool:
"""Configures coturn STUN and TURN server."""
coturn_config = files.template(
src=importlib.resources.files(__package__).joinpath(
"coturn/turnserver.conf.j2"
),
dest="/etc/turnserver.conf",
user="root",
group="root",
mode="640",
config=config,
)
need_restart = coturn_config.changed
return need_restart


def check_config(config):
mail_domain = config.mail_domain
if mail_domain != "testrun.org" and not mail_domain.endswith(".testrun.org"):
Expand Down Expand Up @@ -731,6 +747,11 @@ def deploy_chatmail(config_path: Path, disable_mail: bool) -> None:
packages=["fcgiwrap"],
)

apt.packages(
name="Install coturn STUN and TURN server",
packages=["coturn"],
)

www_path = importlib.resources.files(__package__).joinpath("../../../www").resolve()

build_dir = www_path.joinpath("build")
Expand All @@ -743,6 +764,7 @@ def deploy_chatmail(config_path: Path, disable_mail: bool) -> None:
dovecot_need_restart = _configure_dovecot(config, debug=debug)
postfix_need_restart = _configure_postfix(config, debug=debug)
nginx_need_restart = _configure_nginx(config)
coturn_need_restart = _configure_coturn(config)
_uninstall_mta_sts_daemon()

_remove_rspamd()
Expand Down Expand Up @@ -784,6 +806,14 @@ def deploy_chatmail(config_path: Path, disable_mail: bool) -> None:
restarted=nginx_need_restart,
)

systemd.service(
name="Start and enable coturn",
service="coturn.service",
running=True,
enabled=True,
restarted=coturn_need_restart,
)

# This file is used by auth proxy.
# https://wiki.debian.org/EtcMailName
server.shell(
Expand Down
Loading