Skip to content

add cmdeploy remove command - #1013

Closed
ccclxxiii wants to merge 3 commits into
mainfrom
ccclxxiii/relay-component-removal
Closed

ccclxxiii wants to merge 3 commits into
mainfrom
ccclxxiii/relay-component-removal

Conversation

@ccclxxiii

@ccclxxiii ccclxxiii commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

pr overview:

  • related to please make a command to remove all parts you deployed #1012
  • adds cmdeploy remove so operators can tear down relay from server before redeploying or decommissioning it.
  • covers services, systemd units, relay config/state, mailboxes, web files, local binaries, users/groups, packages, and legacy leftovers. includes --dry-run, --yes, and --keep-packages.
  • also documents the removal flow and the CAA accounturi gotcha when redeploying after ACME state is removed.
  • smoke-test against darkrun.dev live

@ccclxxiii
ccclxxiii temporarily deployed to staging.chatmail.at/doc/relay/ June 25, 2026 13:19 — with GitHub Actions Inactive
@ccclxxiii ccclxxiii added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 25, 2026
Comment thread cmdeploy/src/cmdeploy/cmdeploy.py Resolved
Comment on lines +7 to +136
CHATMAIL_UNITS = [
"doveauth.service",
"lastlogin.service",
"chatmail-metadata.service",
"chatmail-expire.service",
"chatmail-expire.timer",
"chatmail-fsreport.service",
"chatmail-fsreport.timer",
"filtermail.service",
"filtermail-incoming.service",
"filtermail-transport.service",
"turnserver.service",
"iroh-relay.service",
"mtail.service",
"acmetool-redirector.service",
"acmetool-reconcile.service",
"acmetool-reconcile.timer",
"tls-cert-reload.path",
"tls-cert-reload.service",
]

LEGACY_UNITS = [
"doveauth-dictproxy.service",
"echobot.service",
"mta-sts-daemon.service",
]

PACKAGE_UNITS = [
"dovecot.service",
"postfix.service",
"nginx.service",
"opendkim.service",
"unbound.service",
"fcgiwrap.service",
]

PACKAGE_NAMES = [
"acmetool",
"dovecot-core",
"dovecot-imapd",
"dovecot-lmtpd",
"postfix",
"opendkim",
"opendkim-tools",
"nginx",
"nginx-common",
"libnginx-mod-stream",
"fcgiwrap",
"unbound",
"unbound-anchor",
"dnsutils",
"python3-virtualenv",
"gcc",
"python3-dev",
"curl",
"rsync",
]

RELAY_FILES = [
"/etc/apt/apt.conf.d/00InstallRecommends",
"/etc/apt/keyrings/obs-home-deltachat.gpg",
"/etc/apt/preferences.d/pin-dovecot",
"/etc/chatmail-nocreate",
"/etc/chatmail-version",
"/etc/cron.d/acmetool",
"/etc/cron.d/chatmail-metrics",
"/etc/cron.d/expunge",
"/etc/dovecot/auth.conf",
"/etc/dovecot/dovecot.conf",
"/etc/dovecot/push_notification.lua",
"/etc/iroh-relay.toml",
"/etc/mailname",
"/etc/mta-sts-daemon.yml",
"/etc/mtail/delivered_mail.mtail",
"/etc/nginx/nginx.conf",
"/etc/opendkim.conf",
"/etc/postfix/lmtp_header_cleanup",
"/etc/postfix/login_map",
"/etc/postfix/main.cf",
"/etc/postfix/master.cf",
"/etc/postfix/smtp_tls_policy_map",
"/etc/postfix/smtp_tls_policy_map.db",
"/etc/postfix/submission_header_cleanup",
"/etc/systemd/journald.conf",
"/etc/systemd/system/mta-sts-daemon.service",
"/etc/systemd/system/dovecot.service.d/10_restart.conf",
"/etc/systemd/system/opendkim.service.d/10-prevent-memory-leak.conf",
"/etc/systemd/system/postfix@.service.d/10_restart.conf",
"/etc/unbound/unbound.conf.d/chatmail.conf",
"/usr/lib/cgi-bin/newemail.py",
"/usr/local/bin/chatmail-turn",
"/usr/local/bin/filtermail",
"/usr/local/bin/iroh-relay",
"/usr/local/bin/mtail",
"/usr/sbin/policy-rc.d",
"/var/www/html/metrics",
]

PACKAGE_CONFIG_DIRS = [
"/etc/dkimkeys",
"/etc/dovecot",
"/etc/nginx",
"/etc/opendkim",
"/etc/postfix",
"/etc/unbound",
]

RELAY_DIRS = [
"/etc/mtail",
"/root/from-cmdeploy",
"/usr/local/lib/chatmaild",
"/usr/local/lib/postfix-mta-sts-resolver",
"/var/lib/dovecot",
"/var/lib/nginx",
"/var/lib/postfix",
"/var/lib/unbound",
"/var/log/nginx",
"/var/spool/postfix",
"/var/www/html",
]

EMPTY_SYSTEMD_DIRS = [
"/etc/systemd/system/dovecot.service.d",
"/etc/systemd/system/opendkim.service.d",
"/etc/systemd/system/postfix@.service.d",
]

RELAY_USERS = ["vmail", "iroh", "opendkim"]
RELAY_GROUPS = ["vmail", "iroh", "opendkim"]

@j-g00da j-g00da Jun 25, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should keep paths/file names/package names in dicts in something like constants.py, then reference them everywhere instead of hardcoding strings all over the place. This way we can be sure that what is deployed matches what is removed (this can very easily diverge and be missed in a review).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@j-g00da that's a good call, thank you. let's see if anyone else has input. but a const would make sense so you change it in one place. appreciate the feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccclxxiii

Copy link
Copy Markdown
Contributor Author

closing re:

@ccclxxiii ccclxxiii closed this Jun 26, 2026
@ccclxxiii
ccclxxiii deleted the ccclxxiii/relay-component-removal branch June 26, 2026 11:57

This branch was successfully deployed

1 active deployment
staging.chatmail.at/doc/relay/ — d7a16d2b Deployed Jun 25, 2026 by ccclxxiii via build #413
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants