Skip to content

Commit 09a6885

Browse files
committed
cmdeploy: add ssh_host chatmail.ini option to deploy remotely
1 parent dafa77c commit 09a6885

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

chatmaild/src/chatmaild/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Config:
2121
def __init__(self, inipath, params):
2222
self._inipath = inipath
2323
self.mail_domain = params["mail_domain"]
24+
self.ssh_host = params.get("ssh_host", self.mail_domain)
2425
self.max_user_send_per_minute = int(params.get("max_user_send_per_minute", 60))
2526
self.max_user_send_burst_size = int(params.get("max_user_send_burst_size", 10))
2627
self.max_mailbox_size = params["max_mailbox_size"]

chatmaild/src/chatmaild/ini/chatmail.ini.f

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# mail domain (MUST be set to fully qualified chat mail domain)
44
mail_domain = {mail_domain}
55

6+
# Where to deploy the relay - if unspecified, mail_domain will be used.
7+
ssh_host = "localhost"
8+
69
#
710
# If you only do private test deploys, you don't need to modify any settings below
811
#

cmdeploy/src/cmdeploy/cmdeploy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def run_cmd_options(parser):
8888
def run_cmd(args, out):
8989
"""Deploy chatmail services on the remote server."""
9090

91-
ssh_host = args.ssh_host if args.ssh_host else args.config.mail_domain
91+
ssh_host = args.ssh_host if args.ssh_host else args.config.ssh_host
9292
sshexec = get_sshexec(ssh_host)
9393
require_iroh = args.config.enable_iroh_relay
9494
if not args.dns_check_disabled:
@@ -108,7 +108,7 @@ def run_cmd(args, out):
108108
pyinf = "pyinfra --dry" if args.dry_run else "pyinfra"
109109

110110
cmd = f"{pyinf} --ssh-user root {ssh_host} {deploy_path} -y"
111-
if ssh_host in ["localhost", "@docker"]:
111+
if ssh_host in ["localhost", "@local", "@docker"]:
112112
cmd = f"{pyinf} @local {deploy_path} -y"
113113

114114
if version.parse(pyinfra.__version__) < version.parse("3"):
@@ -149,7 +149,7 @@ def dns_cmd_options(parser):
149149

150150
def dns_cmd(args, out):
151151
"""Check DNS entries and optionally generate dns zone file."""
152-
ssh_host = args.ssh_host if args.ssh_host else args.config.mail_domain
152+
ssh_host = args.ssh_host if args.ssh_host else args.config.ssh_host
153153
sshexec = get_sshexec(ssh_host, verbose=args.verbose)
154154
remote_data = dns.get_initial_remote_data(sshexec, args.config.mail_domain)
155155
if not remote_data:
@@ -183,7 +183,7 @@ def status_cmd_options(parser):
183183
def status_cmd(args, out):
184184
"""Display status for online chatmail instance."""
185185

186-
ssh_host = args.ssh_host if args.ssh_host else args.config.mail_domain
186+
ssh_host = args.ssh_host if args.ssh_host else args.config.ssh_host
187187
sshexec = get_sshexec(ssh_host, verbose=args.verbose)
188188

189189
out.green(f"chatmail domain: {args.config.mail_domain}")

0 commit comments

Comments
 (0)