guidance on data persistence?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

guidance on data persistence?

zhong ming wu
Hello

When moving postfix to docker, I run into the issue that when the containers go away postfix queued mail will get lost unless I made an effort to persist on the host.

A naive attempt to simply map an empty folder on the host as `/var/spool/postifx` on the container does not work, because postfix expects some empty folders there.

My first question is that given a postfix installation, is there a command I can run to initialize the directory tree to be saved on a persisted volume which is to be mounted in the container?

There may be a way to pre-create this folder structure on the host but it can be hard to manage the user id mappings.  Will that be ok if all subfolders are owned by say root inside the container?

z m wu

Reply | Threaded
Open this post in threaded view
|

Re: guidance on data persistence?

Wietse Venema
zhong ming wu:
> Hello
>
> When moving postfix to docker, I run into the issue that when the
> containers go away postfix queued mail will get lost unless I made an
> effort to persist on the host.
>
> A naive attempt to simply map an empty folder on the host as
> `/var/spool/postifx` on the container does not work, because postfix
> expects some empty folders there.

The top-level queue directory must be owned by root, mode 755, and
must exist before Postfix can run.

The subdirectories are created with the command 'postfix check' or
'postfix start'. These also set correct ownership and permissions.

    # mkdir /var/spool/postfix
    # postfix check
    # ls /var/spool/postfix
    active          defer           hold            pid             saved
    bounce          deferred        incoming        private         trace
    corrupt         flush           maildrop        public

> Will that be ok if all subfolders are owned by say root inside the
> container?

No. See above for postfix commands and access permissions.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: guidance on data persistence?

zhong ming wu


> On Nov 9, 2017, at 7:07 AM, Wietse Venema <[hidden email]> wrote:
>
> zhong ming wu:
>> Hello
>>
>> When moving postfix to docker, I run into the issue that when the
>> containers go away postfix queued mail will get lost unless I made an
>> effort to persist on the host.
>>
>> A naive attempt to simply map an empty folder on the host as
>> `/var/spool/postifx` on the container does not work, because postfix
>> expects some empty folders there.
>
> The top-level queue directory must be owned by root, mode 755, and
> must exist before Postfix can run.
>
> The subdirectories are created with the command 'postfix check' or
> 'postfix start'. These also set correct ownership and permissions.
>
>    # mkdir /var/spool/postfix
>    # postfix check
>    # ls /var/spool/postfix
>    active          defer           hold            pid             saved
>    bounce          deferred        incoming        private         trace
>    corrupt         flush           maildrop        public


awesome!  this works perfectly now


>> Will that be ok if all subfolders are owned by say root inside the
>> container?
>
> No. See above for postfix commands and access permissions.
>
>    Wietse