Persist mail state directories#195
Conversation
|
For now I store my mails in a local directory. @tve Is it possible to mount a local directory to this persistent state directory too? |
|
I would be very happy if this PR could be merged. |
|
@Josef-Friedrich if by "local directory" you mean a directory on the docker host, then yes, you can do that. My docker-compose-fu isn't well developed yet, but for sure it works if you use something like the following in your docker-compose.yaml: Here /mnt/mail-state is a directory on the host. You can then back this dir up. I haven't figured out how to do it with the named volumes syntax. |
|
Docs for the wiki (waiting to hear from @tomav whether he likes the direction of this PR): Configuring BackupsUser mail directoriesAssuming that you use docker-compose and a data volume container named maildata, you can backup your user mails like this: Mail state directoriesIn addition to the user mail directories you may want to persist and even back up the state of the various daemons, such as postfix mail queues, clamav virus database, spamassassin learning, etc. Inside the container the files for this are normally found in various directories under In docker-compose.yaml you can enable the merging of all daemon state into one directory and the mounting of a volume as follows: This configuration persists the mailstat volume across container restarts. If you want to back mailstate up to secondary storage you need to launch a backup container as suggested above for maildata backups. Alternatively, you can also mount one or both volumes from a specific path on the host. To do that do not use the named volumes syntax and instead use something like: This second form is useful if you want to place these volumes onto a filesystem/device where you perform snapshot backups or something similar. |
|
I'm having trouble getting a build to complete. Travis times out just building the container images :-( |
|
The download of the main.cvd is very slow. I'm just building the image on my laptop ... |
|
Yeah, I did set things up so I could build and test locally, and there the tests pass. It's just not nice to have a PR where "all checks have failed"... |
|
A question: why don't we change where these daemons write their content to the single folder, using configuration files, instead of adding new code in |
|
That's certainly a very valid alternative. I didn't want to dive into the documentation for the 7 different daemons to find what I had to change and then test that I didn't forget something, etc... |
|
I understand, but there's another easier way by adding the folder list to a data container. No code, and it's more docker compliant. |
|
Interesting, I didn't know one could do that. I guess no PR needed in that case? I'll keep using my fork because I want to map these directories to an EC2 EBS volume so I can do snapshot-backups and I can't do that easily with docker volumes, but that may not be of interest to many other folks. |
|
@tomav I tried your docker-compose.yml file from above. I got this error:
|
|
There are some ownerships/permissions to set. |
|
No time for this right time. I'm gonna merge your PR and will try to do something more docker compliant later. |
|
Thanks for the work anyway! |
Persist mail state directories
This PR consolidates all directories with mail state into /var/mail-state, which can then be mounted as a volume. This is to address #191.
This PR is based off the changes in PR 194, please look at the one new commit 4ca39f9 for the changes.
If you like this approach, I will add docs to the Wiki. Dunno whether you want this to be in the docker-compose.yaml.dist or not. Also, I changed the tests to use the consolidated directories, but I don't really know how you want to proceed, so this PR is a bit of a WIP 'til I hear back...