Merge branch 'stage' into prod

This commit is contained in:
Christoph Haas 2025-11-03 09:03:26 +01:00
commit d3c4afc61e
2 changed files with 28 additions and 9 deletions

View file

@ -103,7 +103,15 @@ UPDATE users SET mail_host='new.mail.server';
## Migrate rspamd spam training data ## Migrate rspamd spam training data
If you have been using rspamd with the Redis backend then copy over the Redis database from your previous server. If you have been using rspamd with the Redis backend then copy over the Redis database from your previous server.
Details are found in the rspamd chapter.
Stop rspamd on both the old and the new server. Then:
```sh
rsync -va oldserver:/var/lib/redis/ /var/lib/redis/
```
Once the redis database is started again on the new server, `rspamc stat` should show you that the training data is
found.
## Migrate the Maildirs hot ## Migrate the Maildirs hot
@ -129,9 +137,10 @@ need to copy emails from another server where you only have IMAP access but cann
Copy over everything in /etc/letsencrypt and /var/lib/rspamd/dkim from your old to the new server. Copy over everything in /etc/letsencrypt and /var/lib/rspamd/dkim from your old to the new server.
``` ```sh
rsync -va oldserver:/etc/letsencrypt/ /etc/letsencrypt/ rsync -va oldserver:/etc/letsencrypt/archive/ /etc/letsencrypt/archive/
rsync -va oldserver:/var/lib/rspamd/dkim/ /var/lib/rspamd/dkim/ rsync -va oldserver:/var/lib/rspamd/dkim/ /var/lib/rspamd/dkim/
rsync -v oldserver:/etc/rspamd/dkim_selectors.map /etc/rspamd
``` ```
## Downtime ## Downtime
@ -144,7 +153,7 @@ You told your users about the downtime, right? The time has come? Okay. Shut dow
copied consistently.) Lets synchronize again. *rsync* will only copy those files that have changed which makes it much copied consistently.) Lets synchronize again. *rsync* will only copy those files that have changed which makes it much
faster than the first sync. On your new server run: faster than the first sync. On your new server run:
``` ```sh
rsync -va --delete oldserver:/var/vmail/ /var/vmail/ rsync -va --delete oldserver:/var/vmail/ /var/vmail/
``` ```
@ -177,3 +186,13 @@ postconf soft_bounce=no
## Shut down the old server ## Shut down the old server
If possible do a final backup of the old server. If users are not complaining then dismiss the old system after a week. If possible do a final backup of the old server. If users are not complaining then dismiss the old system after a week.
## Unsolved issues
You may see error messages like:
```
Error: sieve: binary /var/vmail/example.org/user/.dovecot.svbin: read: binary stored with different major version 2.0 (!= 3.0; automatically fixed when re-compiled)
```
You may need to run `sievec` on those files.

View file

@ -52,7 +52,7 @@ that. For that “john-to-himself” mapping you need to create another “.cf
```sh title="Run this on your server" ```sh title="Run this on your server"
# Create the john-to-himself mapping # Create the john-to-himself mapping
cat > /etc/postfix/mysql-email2email.cf << EOF cat > /etc/postfix/mariadb-email2email.cf << EOF
user = mailserver user = mailserver
password = MAILSERVER-PASSWORD-HERE password = MAILSERVER-PASSWORD-HERE
hosts = 127.0.0.1 hosts = 127.0.0.1
@ -61,18 +61,18 @@ query = SELECT email FROM virtual_users WHERE email='%s'
EOF EOF
# Fix the permissions of that file # Fix the permissions of that file
chgrp postfix /etc/postfix/mysql-*.cf chgrp postfix /etc/postfix/mariadb-*.cf
chmod u=rw,g=r,o= /etc/postfix/mysql-*.cf chmod u=rw,g=r,o= /etc/postfix/mariadb-*.cf
# Add the new mapping to the virtual_alias_maps # Add the new mapping to the virtual_alias_maps
# (The order is not important. Postfix will check all mapping files.) # (The order is not important. Postfix will check all mapping files.)
postconf virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf postconf virtual_alias_maps=mysql:/etc/postfix/mariadb-virtual-alias-maps.cf,mysql:/etc/postfix/mariadb-email2email.cf
``` ```
Check that you get Johns email address back when you ask Postfix if there are any aliases for him: Check that you get Johns email address back when you ask Postfix if there are any aliases for him:
```sh title="Run this on your server" ```sh title="Run this on your server"
postmap -q john@example.org mysql:/etc/postfix/mysql-email2email.cf postmap -q john@example.org mysql:/etc/postfix/mariadb-email2email.cf
``` ```
The result should be the same address: The result should be the same address: