docker: disable port check if docker is running. fix #694

This commit is contained in:
missytake
2025-11-13 21:29:51 +01:00
committed by j4n
parent 615613bd66
commit 8bba78ebaf
3 changed files with 35 additions and 31 deletions

View File

@@ -109,6 +109,8 @@ def run_cmd(args, out):
cmd = f"{pyinf} --ssh-user root {ssh_host} {deploy_path} -y" cmd = f"{pyinf} --ssh-user root {ssh_host} {deploy_path} -y"
if ssh_host in ["localhost", "@docker"]: if ssh_host in ["localhost", "@docker"]:
if ssh_host == "@docker":
env["CHATMAIL_DOCKER"] = "True"
cmd = f"{pyinf} @local {deploy_path} -y" cmd = f"{pyinf} @local {deploy_path} -y"
if version.parse(pyinfra.__version__) < version.parse("3"): if version.parse(pyinfra.__version__) < version.parse("3"):

View File

@@ -535,12 +535,13 @@ class GithashDeployer(Deployer):
) )
def deploy_chatmail(config_path: Path, disable_mail: bool, website_only: bool) -> None: def deploy_chatmail(config_path: Path, disable_mail: bool, website_only: bool, docker: bool) -> None:
"""Deploy a chat-mail instance. """Deploy a chat-mail instance.
:param config_path: path to chatmail.ini :param config_path: path to chatmail.ini
:param disable_mail: whether to disable postfix & dovecot :param disable_mail: whether to disable postfix & dovecot
:param website_only: if True, only deploy the website :param website_only: if True, only deploy the website
:param docker: whether it is running in a docker container
""" """
config = read_config(config_path) config = read_config(config_path)
check_config(config) check_config(config)
@@ -566,6 +567,7 @@ def deploy_chatmail(config_path: Path, disable_mail: bool, website_only: bool) -
Out().red(f"Deploy failed: mtail_address {config.mtail_address} is not available (VPN up?).\n") Out().red(f"Deploy failed: mtail_address {config.mtail_address} is not available (VPN up?).\n")
exit(1) exit(1)
if not docker:
port_services = [ port_services = [
(["master", "smtpd"], 25), (["master", "smtpd"], 25),
("unbound", 53), ("unbound", 53),

View File

@@ -15,8 +15,8 @@ def main():
) )
disable_mail = bool(os.environ.get("CHATMAIL_DISABLE_MAIL")) disable_mail = bool(os.environ.get("CHATMAIL_DISABLE_MAIL"))
website_only = bool(os.environ.get("CHATMAIL_WEBSITE_ONLY")) website_only = bool(os.environ.get("CHATMAIL_WEBSITE_ONLY"))
docker = bool(os.environ.get("CHATMAIL_DOCKER"))
deploy_chatmail(config_path, disable_mail, website_only) deploy_chatmail(config_path, disable_mail, website_only, docker)
if pyinfra.is_cli: if pyinfra.is_cli: