mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 12:28:06 +00:00
Compare commits
1 Commits
hagi/metri
...
hagi/insta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
345d3f9b35 |
3
.github/workflows/test-and-deploy.yaml
vendored
3
.github/workflows/test-and-deploy.yaml
vendored
@@ -7,9 +7,6 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'scripts/**'
|
- 'scripts/**'
|
||||||
- '**/README.md'
|
|
||||||
- 'CHANGELOG.md'
|
|
||||||
- 'LICENSE'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
|
|||||||
@@ -2,12 +2,6 @@
|
|||||||
|
|
||||||
## untagged
|
## untagged
|
||||||
|
|
||||||
- run metrics generation with systemd-timer instead of cron
|
|
||||||
([#304](https://github.com/deltachat/chatmail/pull/304))
|
|
||||||
|
|
||||||
- change default for delete_mails_after from 40 to 20 days
|
|
||||||
([#300]https://github.com/deltachat/chatmail/pull/300)
|
|
||||||
|
|
||||||
- fix writing of multiple obs repositories in `/etc/apt/sources.list`
|
- fix writing of multiple obs repositories in `/etc/apt/sources.list`
|
||||||
([#272](https://github.com/deltachat/chatmail/issues/272))
|
([#272](https://github.com/deltachat/chatmail/issues/272))
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ after which the initially specified password is required for using them.
|
|||||||
|
|
||||||
## Deploying your own chatmail server
|
## Deploying your own chatmail server
|
||||||
|
|
||||||
To deploy chatmail on your own server, you must have set-up ssh authentication and need to use an ed25519 key, due to an [upstream bug in paramiko](https://github.com/paramiko/paramiko/issues/2191). You also need to add your private key to the local ssh-agent, because you can't type in your password during deployment.
|
|
||||||
|
|
||||||
We use `chat.example.org` as the chatmail domain in the following steps.
|
We use `chat.example.org` as the chatmail domain in the following steps.
|
||||||
Please substitute it with your own domain.
|
Please substitute it with your own domain.
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ max_user_send_per_minute = 60
|
|||||||
max_mailbox_size = 100M
|
max_mailbox_size = 100M
|
||||||
|
|
||||||
# days after which mails are unconditionally deleted
|
# days after which mails are unconditionally deleted
|
||||||
delete_mails_after = 20
|
delete_mails_after = 40
|
||||||
|
|
||||||
# minimum length a username must have
|
# minimum length a username must have
|
||||||
username_min_length = 9
|
username_min_length = 9
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ def test_read_config_testrun(make_config):
|
|||||||
assert config.postfix_reinject_port == 10025
|
assert config.postfix_reinject_port == 10025
|
||||||
assert config.max_user_send_per_minute == 60
|
assert config.max_user_send_per_minute == 60
|
||||||
assert config.max_mailbox_size == "100M"
|
assert config.max_mailbox_size == "100M"
|
||||||
assert config.delete_mails_after == "20"
|
assert config.delete_mails_after == "40"
|
||||||
assert config.username_min_length == 9
|
assert config.username_min_length == 9
|
||||||
assert config.username_max_length == 9
|
assert config.username_max_length == 9
|
||||||
assert config.password_min_length == 9
|
assert config.password_min_length == 9
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ from pyinfra.operations import apt, files, pip, server, systemd
|
|||||||
|
|
||||||
from .acmetool import deploy_acmetool
|
from .acmetool import deploy_acmetool
|
||||||
|
|
||||||
root_owned = dict(user="root", group="root", mode="644")
|
|
||||||
|
|
||||||
def _build_chatmaild(dist_dir) -> None:
|
def _build_chatmaild(dist_dir) -> None:
|
||||||
dist_dir = Path(dist_dir).resolve()
|
dist_dir = Path(dist_dir).resolve()
|
||||||
@@ -51,6 +50,7 @@ def _install_remote_venv_with_chatmaild(config) -> None:
|
|||||||
remote_dist_file = f"{remote_base_dir}/dist/{dist_file.name}"
|
remote_dist_file = f"{remote_base_dir}/dist/{dist_file.name}"
|
||||||
remote_venv_dir = f"{remote_base_dir}/venv"
|
remote_venv_dir = f"{remote_base_dir}/venv"
|
||||||
remote_chatmail_inipath = f"{remote_base_dir}/chatmail.ini"
|
remote_chatmail_inipath = f"{remote_base_dir}/chatmail.ini"
|
||||||
|
root_owned = dict(user="root", group="root", mode="644")
|
||||||
|
|
||||||
apt.packages(
|
apt.packages(
|
||||||
name="apt install python3-virtualenv",
|
name="apt install python3-virtualenv",
|
||||||
@@ -85,19 +85,9 @@ def _install_remote_venv_with_chatmaild(config) -> None:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# create metrics every 5 minutes via systemd
|
|
||||||
|
|
||||||
files.put(
|
|
||||||
name="Upload metrics.timer",
|
|
||||||
src=importlib.resources.files(__package__).joinpath("service/metrics.timer"),
|
|
||||||
dest=f"/etc/systemd/system/metrics.timer",
|
|
||||||
**root_owned,
|
|
||||||
)
|
|
||||||
|
|
||||||
files.template(
|
files.template(
|
||||||
name="upload metrics.service",
|
src=importlib.resources.files(__package__).joinpath("metrics.cron.j2"),
|
||||||
src=importlib.resources.files(__package__).joinpath("service/metrics.service.j2"),
|
dest="/etc/cron.d/chatmail-metrics",
|
||||||
dest="/etc/systemd/system/metrics.service",
|
|
||||||
user="root",
|
user="root",
|
||||||
group="root",
|
group="root",
|
||||||
mode="644",
|
mode="644",
|
||||||
@@ -107,15 +97,6 @@ def _install_remote_venv_with_chatmaild(config) -> None:
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
systemd.service(
|
|
||||||
name=f"Setup metrics timer",
|
|
||||||
service="metrics.timer",
|
|
||||||
running=True,
|
|
||||||
enabled=True,
|
|
||||||
restarted=True,
|
|
||||||
daemon_reload=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
# install systemd units
|
# install systemd units
|
||||||
for fn in (
|
for fn in (
|
||||||
"doveauth",
|
"doveauth",
|
||||||
@@ -371,23 +352,6 @@ def _configure_dovecot(config: Config, debug: bool = False) -> bool:
|
|||||||
commands=["/usr/bin/sievec /etc/dovecot/default.sieve"],
|
commands=["/usr/bin/sievec /etc/dovecot/default.sieve"],
|
||||||
)
|
)
|
||||||
|
|
||||||
files.template(
|
|
||||||
src=importlib.resources.files(__package__).joinpath("service/expunge.service.j2"),
|
|
||||||
dest="/etc/systemd/system/expunge.service",
|
|
||||||
config={
|
|
||||||
"mail_domain": config.mail_domain,
|
|
||||||
"delete_mails_after": config.delete_mails_after,
|
|
||||||
},
|
|
||||||
**root_owned,
|
|
||||||
)
|
|
||||||
|
|
||||||
files.put(
|
|
||||||
name="Upload expunge.timer",
|
|
||||||
src=importlib.resources.files(__package__).joinpath("service/expunge.timer"),
|
|
||||||
dest=f"/etc/systemd/system/expunge.timer",
|
|
||||||
**root_owned,
|
|
||||||
)
|
|
||||||
|
|
||||||
files.template(
|
files.template(
|
||||||
src=importlib.resources.files(__package__).joinpath("dovecot/expunge.cron.j2"),
|
src=importlib.resources.files(__package__).joinpath("dovecot/expunge.cron.j2"),
|
||||||
dest="/etc/cron.d/expunge",
|
dest="/etc/cron.d/expunge",
|
||||||
@@ -559,7 +523,6 @@ def deploy_chatmail(config_path: Path) -> None:
|
|||||||
"systemctl reset-failed unbound.service",
|
"systemctl reset-failed unbound.service",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
systemd.service(
|
systemd.service(
|
||||||
name="Start and enable unbound",
|
name="Start and enable unbound",
|
||||||
service="unbound.service",
|
service="unbound.service",
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ def deploy_acmetool(email="", domains=[]):
|
|||||||
restarted=service_file.changed,
|
restarted=service_file.changed,
|
||||||
)
|
)
|
||||||
|
|
||||||
if str(host) != "staging.testrun.org":
|
server.shell(
|
||||||
server.shell(
|
name=f"Request certificate for: { ', '.join(domains) }",
|
||||||
name=f"Request certificate for: { ', '.join(domains) }",
|
commands=[f"acmetool want --xlog.severity=debug { ' '.join(domains)}"],
|
||||||
commands=[f"acmetool want --xlog.severity=debug { ' '.join(domains)}"],
|
)
|
||||||
)
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Expunge old mails after {{ config.delete_mails_after }} days
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
# delete all mails after {{ config.delete_mails_after }} days, in the Inbox
|
|
||||||
ExecStart=/home/vmail/mail/{{ config.mail_domain }} -path '*/cur/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
|
||||||
# or in any IMAP subfolder
|
|
||||||
ExecStart=vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/.*/cur/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
|
||||||
# even if they are unseen
|
|
||||||
ExecStart=vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/new/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
|
||||||
ExecStart=vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/new/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
|
||||||
# or only temporary (but then they shouldn't be around after {{ config.delete_mails_after }} days anyway).
|
|
||||||
ExecStart=vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
|
||||||
ExecStart=vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/.*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
|
||||||
ExecStart=vmail find /home/vmail/mail/{{ config.mail_domain }} -name 'maildirsize' -type f -delete
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Run expunge.service daily
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=weekly
|
|
||||||
Persistent=true
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Generate metrics in /var/www/html/metrics
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart={{ config.execpath }} /home/vmail/mail/{{ config.mail_domain }} > /var/www/html/metrics
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Run metrics.service every 5 minutes
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=5min
|
|
||||||
OnUnitActiveSec=5min
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
Submodule scripts/dovecot/dovecot-build/dovecot deleted from 4b7f802ca1
Reference in New Issue
Block a user