Commit Graph

1243 Commits

Author SHA1 Message Date
j4n
56741ed404 docker/ci: enable v4 and push again 2026-03-05 15:39:49 +01:00
j4n
273c03dd95 docker: remove build support apt packages when done 2026-03-05 15:39:49 +01:00
j4n
e5eb4a1e33 docker: update docs a bit 2026-03-05 15:39:49 +01:00
j4n
7c6f637490 docker: normalize GIT_HASH to full sha, document version files 2026-03-05 15:39:49 +01:00
j4n
238884be70 docker: flatten docker/files/ into docker/
Move chatmail-init.sh, chatmail-init.service, and entrypoint.sh up
from docker/files/ to docker/
2026-03-05 15:39:49 +01:00
j4n
ee6573efec docker: comments and cleanup 2026-03-05 15:39:49 +01:00
j4n
c7c31fc588 chatmaild: remove noacme config env, superceeded by tls_cert_and_key 2026-03-05 15:39:49 +01:00
j4n
35ca13e2f2 docker/ci: use zstd compressed image instead of push pull 2026-03-05 15:39:49 +01:00
j4n
9e62adf451 docker/ci: fix acme/dkim persistence and zone deploy 2026-03-05 15:39:49 +01:00
j4n
32a53ba2fd docker: restore chatmail-version to fix tests 2026-03-05 15:39:49 +01:00
j4n
107ff80410 docker/ci: don't run the regular deploys for the j4n/docker-pr branch 2026-03-05 15:39:49 +01:00
j4n
51e65aee7c docker/ci: fix offline tests env 2026-03-05 15:39:49 +01:00
j4n
f99531acc3 docker: skip dns check when mail_domain is an ip
and try the ci skip

skip-checks:true
2026-03-05 15:39:49 +01:00
j4n
1793325ce8 docker/ci: deduplicate into matrix based workflow
skip-checks: true
2026-03-05 15:39:49 +01:00
j4n
46de9cf916 fix(cmdeploy): docker: route test commands through container via CHATMAIL_DOCKER
Tests SSH into the host and run systemctl/journalctl/env directly,
which fails on Docker deployments where services run inside the
container. When CHATMAIL_DOCKER is set (to container name), Remote
and SSHExec now wrap commands in `docker exec`. Without CHATMAIL_DOCKER,
behavior is unchanged.
2026-03-05 15:39:49 +01:00
j4n
920f8a4865 docker: trim comments entrypoint 2026-03-05 15:39:49 +01:00
j4n
d8c50d9827 docker: trim chatmail init comments 2026-03-05 15:39:49 +01:00
j4n
dc2beaf89c docker/doc: explain build.sh 2026-03-05 15:39:49 +01:00
j4n
3d4d4e08ce docker/doc: document inotify reload caveat 2026-03-05 15:39:49 +01:00
j4n
e456183919 docker: set log driver to none to not persist logs 2026-03-05 15:39:49 +01:00
j4n
b5d01c4e5d docker: move ForwardToConsole to the end so it does not get clobbered 2026-03-05 15:39:49 +01:00
j4n
59ffbf9cb4 docker/docs: add journalctl example 2026-03-05 15:39:49 +01:00
j4n
e64993ba26 docker: fix test command in docs 2026-03-05 15:39:49 +01:00
j4n
fa834e7737 docker: rebase again on hpk/tls-external and modify our end
Remove the custom certmon timer (polling via sha1sum every 60s),
replaced by the deployer's tls-cert-reload.path unit (inotify).

chatmail-init.sh: inject TLS_EXTERNAL_CERT_AND_KEY env var into
chatmail.ini at startup if not already present.

docker-compose.yaml: remove CMDEPLOY_STAGES, CHATMAIL_NOSYSCTL,
TLS_EXTERNAL_CERT_AND_KEY from base environment (set in init script
or via override file).
2026-03-05 15:39:49 +01:00
j4n
696d07f70c docker: clean up dockerfile 2026-03-05 15:39:49 +01:00
j4n
97a0b88b97 docker: consolidate 2026-03-05 15:39:49 +01:00
j4n
a50690ca55 docker: consolidate ci files 2026-03-05 15:39:49 +01:00
j4n
3f5c85f901 docker: change branch name of actions 2026-03-05 15:39:49 +01:00
j4n
e83d51ea6f docker: add gh action deployments 2026-03-05 15:39:49 +01:00
j4n
07040897d6 docker: use buildx, stop services before portcheck 2026-03-05 15:39:49 +01:00
j4n
97b309b12c docker: cache downloads during build 2026-03-05 15:39:48 +01:00
j4n
d375512065 cmdeploy/deployers: commit one upstream fix 2026-03-05 15:39:48 +01:00
j4n
813d8bee7c docker: rename docker/* files for consistency 2026-03-05 15:39:48 +01:00
j4n
78e0ae2762 docker: do actually do the portcheck on startup 2026-03-05 15:39:48 +01:00
j4n
ce2aebbe28 docker/cmdeploy: remove @docker
Superceeded by CHATMAIL_* environment variables and not widely used.
2026-03-05 15:39:48 +01:00
j4n
0b8521300b docker: expand security notice 2026-03-05 15:39:48 +01:00
j4n
a98910f94a docker: streamline overrides, rename datadirs, external TLS
also
- get rid of CHATMAIL_* in compose
- trim compose override example
2026-03-05 15:39:48 +01:00
j4n
6f230c185c fix(docker): remove CHATMAIL_INI from env 2026-03-05 15:39:48 +01:00
j4n
e0b376ef28 fix(docker): Add TZ to env 2026-03-05 15:39:48 +01:00
j4n
93c24fb309 typo 2026-03-05 15:39:48 +01:00
j4n
d245d55cb6 docker: clear up docker compose v1/v2 differences (doc/compose.yaml) 2026-03-05 15:39:48 +01:00
j4n
7df907f271 feat: add Docker and Compose support
Add Docker-based deployment: Dockerfile based on systemd image,
docker-compose.yaml, build script, entrypoint, external certificate
monitoring, CI workflow, and documentation.

This builds on the chatmaild/cmdeploy preparation in the previous
commit (j4n/docker-prep-chatmail) which added the env-var-driven
feature flags (CHATMAIL_NOSYSCTL, CHATMAIL_NOPORTCHECK, CHATMAIL_NOACME)
and @local deployment support needed by the container.

This is commit 2 of 3 to merge squashed changes on j4n/docker and docker
branches, original commits were beef0ec..606f36e

Architecture overview (mostly by original author Keonik1):
- Debian-systemd image wrapping the existing cmdeploy install
- Host networking to not manually expose the many ports needed
- Config via MAIL_DOMAIN env var or (new) mounted chatmail.ini
- New: cmdeploy stages: install at build, configure+activate at startup
- New: Monitoring service for external certs via systemd timer (chatmail-certmon)
- New: Image version tracking for automatic upgrade detection (cm + config hash)
- New: docker-compose.override.yaml pattern for user customizations
- New: GitHub Actions CI for ghcr.io image builds

Traefik reverse-proxy support is prepared but the specific files are
excluded from this PR and will be submitted separately.

TODO:
- [ ] Pull out CHATMAIL_NOACME as PR #855 introduced a proper mechanism
- [ ] Check if underlying image could be based on regular debian-slim
  images with a step to enable systemd, similar to
  https://github.com/alexdzyoba/docker-debian-systemd

Files added:
  .dockerignore
  .github/workflows/docker-build.yaml
  docker-compose.yaml
  docker-compose.override.yaml.example
  docker/build.sh
  docker/chatmail_relay.dockerfile
  docker/files/chatmail-certmon.{service,sh,timer}
  docker/files/entrypoint.sh
  docker/files/setup_chatmail.service
  docker/files/setup_chatmail_docker.sh
  env.example
  doc/source/docker.rst

Files modified:
  .gitignore
  doc/source/getting_started.rst
  doc/source/index.rst

Co-authored-by: Keonik1 <keonik.dev@gmail.com>
Co-authored-by: missytake <missytake@systemli.org>
2026-03-05 15:39:48 +01:00
j4n
f5469899f7 cmdeploy: prepare chatmaild/cmdeploy changes for Docker support
- chatmaild:
  - basedeploy.py: Add has_systemd() guard. During Docker image builds
    there's no running systemd, so deployers that query SystemdEnabled
    facts would crash; this change might also be helpful for non-systemd
    platforms.
- cmdeploy:
  - cmdeploy.py:
    - when deploying to @docker, auto-set CHATMAIL_NOPORTCHECK and
      CHATMAIL_NOSYSCTL since neither makes sense inside a container
    - --config default now reads CHATMAIL_INI env var, so Docker
      entrypoints can point to a mounted ini without CLI flags.
  - deployers.py:
    - skip port check / CHATMAIL_NOPORTCHECK
    - skip echobot systemd cleanup w/ has_systemd
  - dovecot/deployer.py:
    - Guard sysctl writes behind CHATMAIL_NOSYSCTL
    - invert dovecot install check so it works without systemd
  - sshexec.py: Add __call__ to LocalExec so cmdeploy status works with
    @local target. Without it, cmdeploy status tried to call the
    executor directly and got TypeError.

Consolidated from j4n/docker branch commits (selection):
- 8953fde feat(cmdeploy): read CHATMAIL_INI env var for default --config path
- 81d7782 fix(cmdeploy): add __call__ to LocalExec so status works with @local
- 8bba78e docker: disable port check if docker is running. fix #694
- 865b514 docker: replace config flags with env vars, drop docker param (instead of f26cb08)

Files: cmdeploy/src/cmdeploy/{basedeploy,cmdeploy,deployers,sshexec,dovecot/deployer}.py

Co-authored-by: Keonik1 <keonik.dev@gmail.com>
Co-authored-by: missytake <missytake@systemli.org>
2026-03-05 15:39:48 +01:00
j4n
ff1d3541ab cmdeploy: prepare chatmaild/cmdeploy changes for Docker support
- chatmaild:
  - basedeploy.py: Add has_systemd() guard. During Docker image builds
    there's no running systemd, so deployers that query SystemdEnabled
    facts would crash; this change might also be helpful for non-systemd
    platforms.
- cmdeploy:
  - cmdeploy.py:
    - when deploying to @docker, auto-set CHATMAIL_NOPORTCHECK and
      CHATMAIL_NOSYSCTL since neither makes sense inside a container
    - --config default now reads CHATMAIL_INI env var, so Docker
      entrypoints can point to a mounted ini without CLI flags.
  - deployers.py:
    - skip port check / CHATMAIL_NOPORTCHECK
    - skip echobot systemd cleanup w/ has_systemd
  - dovecot/deployer.py:
    - Guard sysctl writes behind CHATMAIL_NOSYSCTL
    - invert dovecot install check so it works without systemd
  - sshexec.py: Add __call__ to LocalExec so cmdeploy status works with
    @local target. Without it, cmdeploy status tried to call the
    executor directly and got TypeError.

Consolidated from j4n/docker branch commits (selection):
- 8953fde feat(cmdeploy): read CHATMAIL_INI env var for default --config path
- 81d7782 fix(cmdeploy): add __call__ to LocalExec so status works with @local
- 8bba78e docker: disable port check if docker is running. fix #694
- 865b514 docker: replace config flags with env vars, drop docker param (instead of f26cb08)

Files: cmdeploy/src/cmdeploy/{basedeploy,cmdeploy,deployers,sshexec,dovecot/deployer}.py

Co-authored-by: Keonik1 <keonik.dev@gmail.com>
Co-authored-by: missytake <missytake@systemli.org>
2026-03-05 15:39:48 +01:00
holger krekel
3d6ff8122e remove tls extrernal test file, it's too large, and should only be added if we can run it from work flows 2026-03-05 15:39:48 +01:00
holger krekel
17961e1bf7 revert pure whitespace chagnes 2026-03-05 15:39:48 +01:00
holger krekel
b30acabcfb addressed link2xt comments except tls cleanup and fixed linting, removed leftovers 2026-03-05 15:39:48 +01:00
holger krekel
0ae2c19dab feat: support externally managed TLS via tls_external_cert_and_key option
Adds a new tls_external_cert_and_key config option for chatmail servers
that manage their own TLS certificates (e.g. via an external ACME client
or a load balancer).

A systemd path unit (tls-cert-reload.path) watches the certificate file
via inotify and automatically reloads dovecot and nginx when it changes.
Postfix reads certs per TLS handshake so needs no reload.

Also extracts openssl_selfsigned_args() so cert generation parameters
are shared between SelfSignedTlsDeployer and the e2e test.
2026-03-05 15:39:48 +01:00
j4n
06d53503e5 feat(chatmaild/fsreport): add Prometheus textfile output, count files
- Count files in report
- Extend size buckets to bigger messages (5, 10 MiB)
- Two textfile exporters:
  - Full, bucketed size statistics with --textfile option
  - Account count only matching metrics.py format with --legacy-metrics
    option (filename defaults to /var/www/html/metrics)
- Improve option help texts
2026-03-05 13:52:09 +01:00
Alex V.
b128935940 fix: use msg.path instead of nonexistent msg.relpath in fsreport
FileEntry namedtuple has (path, mtime, size), not relpath.
Crashes with AttributeError when --mdir flag is used.
2026-03-05 13:52:09 +01:00