cmdeploy: enable running DNS commands on localhost

This commit is contained in:
missytake
2025-08-26 11:01:54 +02:00
parent f05fc8b84c
commit c4f07009ed
4 changed files with 12 additions and 5 deletions

View File

@@ -72,7 +72,7 @@ def run_cmd_options(parser):
parser.add_argument(
"--ssh-host",
dest="ssh_host",
help="specify an SSH host to deploy to; uses mail_domain from chatmail.ini by default",
help="Deploy to 'localhost', via 'docker', or to a specific SSH host",
)
parser.add_argument(
"--skip-dns-check",
@@ -135,6 +135,11 @@ def dns_cmd_options(parser):
default=None,
help="write out a zonefile",
)
parser.add_argument(
"--ssh-host",
dest="ssh_host",
help="Run the DNS queries on 'localhost', in the chatmail 'docker' container, or on a specific SSH host",
)
def dns_cmd(args, out):

View File

@@ -10,7 +10,7 @@ def get_initial_remote_data(sshexec, mail_domain):
if sshexec == "docker":
return remote.rdns.perform_initial_checks(mail_domain, pre_command="docker exec chatmail ")
elif sshexec == "localhost":
return remote.rdns.perform_initial_checks(mail_domain, pre_command="running on localhost")
return remote.rdns.perform_initial_checks(mail_domain, pre_command="")
return sshexec.logged(
call=remote.rdns.perform_initial_checks, kwargs=dict(mail_domain=mail_domain)
)

View File

@@ -26,9 +26,6 @@ def perform_initial_checks(mail_domain, pre_command=""):
WWW = query_dns("CNAME", f"www.{mail_domain}")
res = dict(mail_domain=mail_domain, A=A, AAAA=AAAA, MTA_STS=MTA_STS, WWW=WWW)
if pre_command == "running on localhost":
return res
res["acme_account_url"] = shell(pre_command + "acmetool account-url", fail_ok=True)
res["dkim_entry"], res["web_dkim_entry"] = get_dkim_entry(
mail_domain, pre_command, dkim_selector="opendkim"

View File

@@ -96,6 +96,11 @@ docker compose logs -f chatmail # view container logs, press CTRL+C to exit
8. After installation is complete, you can open `https://<your_domain_name>` in your browser.
9. To send messages to other chatmail relays,
you need to set additional DNS records.
Run `docker exec chatmail scripts/cmdeploy.sh dns --ssh-host localhost`
to see recommended DNS records and check whether they are correct.
## Using custom files
When using Docker, you can apply modified configuration files to make the installation more personalized. This is usually needed for the `www/src` section so that the Chatmail landing page is customized to your taste, but it can be used for any other cases as well.