From 2df661a91e0b5facbfcaa2c39e874f162f3fcd0e Mon Sep 17 00:00:00 2001 From: andryyy Date: Wed, 23 Sep 2020 11:20:00 +0200 Subject: [PATCH] [Dovecot] Move mail index to new volume --- data/Dockerfiles/dovecot/docker-entrypoint.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data/Dockerfiles/dovecot/docker-entrypoint.sh b/data/Dockerfiles/dovecot/docker-entrypoint.sh index d3a38bfa..419038c3 100755 --- a/data/Dockerfiles/dovecot/docker-entrypoint.sh +++ b/data/Dockerfiles/dovecot/docker-entrypoint.sh @@ -132,7 +132,7 @@ cat < /etc/dovecot/sql/dovecot-dict-sql-userdb.conf # Autogenerated by mailcow driver = mysql connect = "host=/var/run/mysqld/mysqld.sock dbname=${DBNAME} user=${DBUSER} password=${DBPASS}" -user_query = SELECT CONCAT(JSON_UNQUOTE(JSON_VALUE(attributes, '$.mailbox_format')), mailbox_path_prefix, '%d/%n/${MAILDIR_SUB}:VOLATILEDIR=/var/volatile/%u') AS mail, '%s' AS protocol, 5000 AS uid, 5000 AS gid, concat('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND (active = '1' OR active = '2') +user_query = SELECT CONCAT(JSON_UNQUOTE(JSON_VALUE(attributes, '$.mailbox_format')), mailbox_path_prefix, '%d/%n/${MAILDIR_SUB}:VOLATILEDIR=/var/volatile/%u:INDEX=/var/vmail_index/%u') AS mail, '%s' AS protocol, 5000 AS uid, 5000 AS gid, concat('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND (active = '1' OR active = '2') iterate_query = SELECT username FROM mailbox WHERE active = '1' OR active = '2'; EOF @@ -191,11 +191,11 @@ EOF cat /etc/dovecot/global_sieve_after > /var/vmail/sieve/global_sieve_after.sieve cat /etc/dovecot/global_sieve_before > /var/vmail/sieve/global_sieve_before.sieve -# Check permissions of vmail/attachments directory. +# Check permissions of vmail/index/garbage directories. # Do not do this every start-up, it may take a very long time. So we use a stat check here. if [[ $(stat -c %U /var/vmail/) != "vmail" ]] ; then chown -R vmail:vmail /var/vmail ; fi if [[ $(stat -c %U /var/vmail/_garbage) != "vmail" ]] ; then chown -R vmail:vmail /var/vmail/_garbage ; fi -if [[ $(stat -c %U /var/attachments) != "vmail" ]] ; then chown -R vmail:vmail /var/attachments ; fi +if [[ $(stat -c %U /var/vmail_index) != "vmail" ]] ; then chown -R vmail:vmail /var/vmail_index ; fi # Cleanup random user maildirs rm -rf /var/vmail/mailcow.local/* @@ -298,6 +298,7 @@ chown root:dovecot /etc/dovecot/sql/dovecot-dict-sql-sieve* /etc/dovecot/sql/dov chmod 640 /etc/dovecot/sql/*.conf /etc/dovecot/lua/app-passdb.lua chown -R vmail:vmail /var/vmail/sieve chown -R vmail:vmail /var/volatile +chown -R vmail:vmail /var/vmail_index adduser vmail tty chmod g+rw /dev/console chown root:tty /dev/console