Changed Backup Section to Compose switch
Dieser Commit ist enthalten in:
Ursprung
e28b5b8cac
Commit
9e69d091b5
10 geänderte Dateien mit 246 neuen und 55 gelöschten Zeilen
|
@ -10,15 +10,39 @@ Wir erstellen automatisch tägliche Backups (24 Stunden Intervall ab dem Hochfah
|
|||
|
||||
Kopieren Sie die Datei mit dem Namen des Benutzers, den Sie wiederherstellen wollen, nach `__MAILCOW_DIRECTORY__/data/conf/sogo`.
|
||||
|
||||
1\. Kopieren Sie die Sicherung: `cp /var/lib/docker/volumes/mailcowdockerized_sogo-userdata-backup-vol-1/_data/restoreme@example.org __MAILCOW_DIRECTORY__/data/conf/sogo`
|
||||
1. Kopieren Sie die Sicherung: `cp /var/lib/docker/volumes/mailcowdockerized_sogo-userdata-backup-vol-1/_data/restoreme@example.org __MAILCOW_DIRECTORY__/data/conf/sogo`
|
||||
|
||||
2\. Starten Sie `docker compose exec -u sogo sogo-mailcow sogo-tool restore -F ALL /etc/sogo restoreme@example.org`.
|
||||
2. FĂĽhren Sie folgenden Befehl aus:
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose exec -u sogo sogo-mailcow sogo-tool restore -F ALL /etc/sogo restoreme@example.org
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose exec -u sogo sogo-mailcow sogo-tool restore -F ALL /etc/sogo restoreme@example.org
|
||||
```
|
||||
|
||||
Führen Sie `sogo-tool` ohne Parameter aus, um nach möglichen Wiederherstellungsoptionen zu suchen.
|
||||
|
||||
3\. Löschen Sie die kopierte Sicherung, indem Sie `rm __MAILCOW_DIRECTORY__/data/conf/sogo` ausführen
|
||||
3. Löschen Sie die kopierte Sicherung, indem Sie `rm __MAILCOW_DIRECTORY__/data/conf/sogo` ausführen
|
||||
|
||||
4\. Starten Sie SOGo und Memcached neu: `docker compose restart sogo-mailcow memcached-mailcow`
|
||||
4. Starten Sie SOGo und Memcached neu:
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose restart sogo-mailcow memcached-mailcow
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose restart sogo-mailcow memcached-mailcow
|
||||
```
|
||||
|
||||
### Mail
|
||||
|
||||
|
@ -34,7 +58,17 @@ Um die Mailbox wiederherzustellen, stellen Sie sicher, dass Sie tatsächlich auf
|
|||
|
||||
Kopieren Sie die Ordner von `/var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/_garbage/[timestamp]_[domain_sanitized][user_sanitized]` zurĂĽck nach `/var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/[domain]/[user]` und synchronisieren Sie die Ordner neu und berechnen Sie die Quota (Speicherplatz) neu:
|
||||
|
||||
```
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose exec dovecot-mailcow doveadm force-resync -u restoreme@example.net '*'
|
||||
docker compose exec dovecot-mailcow doveadm quota recalc -u restoreme@example.net
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose exec dovecot-mailcow doveadm force-resync -u restoreme@example.net '*'
|
||||
docker-compose exec dovecot-mailcow doveadm quota recalc -u restoreme@example.net
|
||||
```
|
|
@ -10,15 +10,39 @@ We automatically create daily backups (24h interval starting from running up -d)
|
|||
|
||||
Copy the file named after the user you want to restore to `__MAILCOW_DIRECTORY__/data/conf/sogo`.
|
||||
|
||||
1\. Copy the backup: `cp /var/lib/docker/volumes/mailcowdockerized_sogo-userdata-backup-vol-1/_data/restoreme@example.org __MAILCOW_DIRECTORY__/data/conf/sogo`
|
||||
1. Copy the backup: `cp /var/lib/docker/volumes/mailcowdockerized_sogo-userdata-backup-vol-1/_data/restoreme@example.org __MAILCOW_DIRECTORY__/data/conf/sogo`
|
||||
|
||||
2\. Run `docker compose exec -u sogo sogo-mailcow sogo-tool restore -F ALL /etc/sogo restoreme@example.org`
|
||||
2. Run the following command:
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose exec -u sogo sogo-mailcow sogo-tool restore -F ALL /etc/sogo restoreme@example.org
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose exec -u sogo sogo-mailcow sogo-tool restore -F ALL /etc/sogo restoreme@example.org
|
||||
```
|
||||
|
||||
Run `sogo-tool` without parameters to check for possible restore options.
|
||||
|
||||
3\. Delete the copied backup by running `rm __MAILCOW_DIRECTORY__/data/conf/sogo`
|
||||
3. Delete the copied backup by running `rm __MAILCOW_DIRECTORY__/data/conf/sogo`
|
||||
|
||||
4\. Restart SOGo and Memcached: `docker compose restart sogo-mailcow memcached-mailcow`
|
||||
4. Restart SOGo and Memcached:
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose restart sogo-mailcow memcached-mailcow
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose restart sogo-mailcow memcached-mailcow
|
||||
```
|
||||
|
||||
### Mail
|
||||
|
||||
|
@ -34,7 +58,16 @@ To restore make sure you are actually restoring to the same mailcow it was delet
|
|||
|
||||
Copy the folders from `/var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/_garbage/[timestamp]_[domain_sanitized][user_sanitized]` back to `/var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/[domain]/[user]` and resync the folder and recalc the quota:
|
||||
|
||||
```
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose exec dovecot-mailcow doveadm force-resync -u restoreme@example.net '*'
|
||||
docker compose exec dovecot-mailcow doveadm quota recalc -u restoreme@example.net
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose exec dovecot-mailcow doveadm force-resync -u restoreme@example.net '*'
|
||||
docker-compose exec dovecot-mailcow doveadm quota recalc -u restoreme@example.net
|
||||
```
|
|
@ -111,7 +111,21 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|||
Am Zielort (in diesem Fall `/external_share/backups`) möchten Sie vielleicht Snapshot-Möglichkeiten haben (ZFS, Btrfs usw.). Machen Sie täglich einen Snapshot und bewahren Sie ihn für n Tage auf, um ein konsistentes Backup zu erhalten.
|
||||
FĂĽhren Sie **kein** rsync auf eine Samba-Freigabe durch, Sie mĂĽssen die richtigen Berechtigungen behalten!
|
||||
|
||||
Zum Wiederherstellen mĂĽssen Sie rsync einfach in umgekehrter Richtung ausfĂĽhren und Docker neu starten, um die Volumes erneut zu lesen. FĂĽhren Sie `docker compose pull` und `docker compose up -d` aus.
|
||||
Zum Wiederherstellen mĂĽssen Sie rsync einfach in umgekehrter Richtung ausfĂĽhren und Docker neu starten, um die Volumes erneut zu lesen. FĂĽhren Sie folgende Befehle aus:
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
Wenn Sie Glück haben, können Redis und MariaDB die inkonsistenten Datenbanken automatisch reparieren (wenn sie inkonsistent _sind_).
|
||||
Im Falle einer beschädigten Datenbank müssen Sie das Hilfsskript verwenden, um die inkonsistenten Elemente wiederherzustellen. Wenn die Wiederherstellung fehlschlägt, versuchen Sie, die Sicherungen zu extrahieren und die Dateien manuell zurück zu kopieren. Behalten Sie die Dateiberechtigungen bei!
|
|
@ -111,7 +111,21 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|||
On the destination (in this case `/external_share/backups`) you may want to have snapshot capabilities (ZFS, Btrfs etc.). Snapshot daily and keep for n days for a consistent backup.
|
||||
Do **not** rsync to a Samba share, you need to keep the correct permissions!
|
||||
|
||||
To restore you'd simply need to run rsync the other way round and restart Docker to re-read the volumes. Run `docker compose pull` and `docker compose up -d`.
|
||||
To restore you'd simply need to run rsync the other way round and restart Docker to re-read the volumes. Run:
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
If you are lucky Redis and MariaDB can automatically fix the inconsistent databases (if they _are_ inconsistent).
|
||||
In case of a corrupted database you'd need to use the helper script to restore the inconsistent elements. If a restore fails, try to extract the backups and copy the files back manually. Keep the file permissions!
|
||||
|
|
|
@ -1,16 +1,36 @@
|
|||
### Sicherung
|
||||
|
||||
Diese Zeile sichert das vmail-Verzeichnis in eine Datei backup_vmail.tar.gz im mailcow-Root-Verzeichnis:
|
||||
```
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
cd /pfad/zu/mailcow-dockerized
|
||||
docker run --rm -i -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:stretch-slim tar cvfz /backup/backup_vmail.tar.gz /vmail
|
||||
docker run --rm -i -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:bullseye-slim tar cvfz /backup/backup_vmail.tar.gz /vmail
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
cd /pfad/zu/mailcow-dockerized
|
||||
docker run --rm -i -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker-compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:bullseye-slim tar cvfz /backup/backup_vmail.tar.gz /vmail
|
||||
```
|
||||
|
||||
Sie können den Pfad ändern, indem Sie ${PWD} (das dem aktuellen Verzeichnis entspricht) zu einem beliebigen Pfad ändern, auf den Sie Schreibzugriff haben.
|
||||
Setzen Sie den Dateinamen `backup_vmail.tar.gz` auf einen beliebigen Namen, aber lassen Sie den Pfad so wie er ist. Beispiel: `[...] tar cvfz /backup/mein_eigener_dateiname_.tar.gz`
|
||||
|
||||
### Wiederherstellen
|
||||
```
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
cd /pfad/zu/mailcow-dockerized
|
||||
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:stretch-slim tar xvfz /backup/backup_vmail.tar.gz
|
||||
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:bullseye-slim tar xvfz /backup/backup_vmail.tar.gz
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
cd /pfad/zu/mailcow-dockerized
|
||||
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker-compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:bullseye-slim tar xvfz /backup/backup_vmail.tar.gz
|
||||
```
|
|
@ -1,16 +1,36 @@
|
|||
### Backup
|
||||
|
||||
This line backups the vmail directory to a file backup_vmail.tar.gz in the mailcow root directory:
|
||||
```
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
cd /path/to/mailcow-dockerized
|
||||
docker run --rm -i -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:stretch-slim tar cvfz /backup/backup_vmail.tar.gz /vmail
|
||||
docker run --rm -i -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:bullseye-slim tar cvfz /backup/backup_vmail.tar.gz /vmail
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
cd /path/to/mailcow-dockerized
|
||||
docker run --rm -i -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker-compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:bullseye-slim tar cvfz /backup/backup_vmail.tar.gz /vmail
|
||||
```
|
||||
|
||||
You can change the path by adjusting ${PWD} (which equals to the current directory) to any path you have write-access to.
|
||||
Set the filename `backup_vmail.tar.gz` to any custom name, but leave the path as it is. Example: `[...] tar cvfz /backup/my_own_filename_.tar.gz`
|
||||
|
||||
### Restore
|
||||
```
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
cd /path/to/mailcow-dockerized
|
||||
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:stretch-slim tar xvfz /backup/backup_vmail.tar.gz
|
||||
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:bullseye-slim tar xvfz /backup/backup_vmail.tar.gz
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
cd /path/to/mailcow-dockerized
|
||||
docker run --rm -it -v $(docker inspect --format '{{ range .Mounts }}{{ if eq .Destination "/var/vmail" }}{{ .Name }}{{ end }}{{ end }}' $(docker-compose ps -q dovecot-mailcow)):/vmail -v ${PWD}:/backup debian:bullseye-slim tar xvfz /backup/backup_vmail.tar.gz
|
||||
```
|
|
@ -1,18 +1,34 @@
|
|||
## Sicherung
|
||||
|
||||
```
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
cd /pfad/zu/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
DATE=$(date +"%Y%m%d_%H%M%S")
|
||||
docker compose exec -T mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > backup_${DBNAME}_${DATE}.sql
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
cd /pfad/zu/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
DATE=$(date +"%Y%m%d_%H%M%S")
|
||||
docker-compose exec -T mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > backup_${DBNAME}_${DATE}.sql
|
||||
```
|
||||
|
||||
## Wiederherstellen
|
||||
|
||||
!!! warning
|
||||
!!! warning "Warnung"
|
||||
=== "docker compose (Plugin)"
|
||||
Sie sollten den SQL-Dump ohne `docker compose` umleiten, um Parsing-Fehler zu vermeiden.
|
||||
|
||||
```
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
Sie sollten den SQL-Dump ohne `docker-compose` umleiten, um Parsing-Fehler zu vermeiden.
|
||||
|
||||
``` bash
|
||||
cd /pfad/zu/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
docker exec -i $(docker compose ps -q mysql-mailcow) mysql -u${DBUSER} -p${DBPASS} ${DBNAME} < backup_file.sql
|
||||
|
|
|
@ -1,18 +1,34 @@
|
|||
## Backup
|
||||
|
||||
```
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
cd /path/to/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
DATE=$(date +"%Y%m%d_%H%M%S")
|
||||
docker compose exec -T mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > backup_${DBNAME}_${DATE}.sql
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
cd /path/to/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
DATE=$(date +"%Y%m%d_%H%M%S")
|
||||
docker-compose exec -T mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > backup_${DBNAME}_${DATE}.sql
|
||||
```
|
||||
|
||||
## Restore
|
||||
|
||||
!!! warning
|
||||
=== "docker compose (Plugin)"
|
||||
You should redirect the SQL dump without `docker compose` to prevent parsing errors.
|
||||
|
||||
```
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
You should redirect the SQL dump without `docker-compose` to prevent parsing errors.
|
||||
|
||||
``` bash
|
||||
cd /path/to/mailcow-dockerized
|
||||
source mailcow.conf
|
||||
docker exec -i $(docker compose ps -q mysql-mailcow) mysql -u${DBUSER} -p${DBPASS} ${DBNAME} < backup_file.sql
|
||||
|
|
|
@ -18,7 +18,19 @@ Das Skript verwendet rsync mit dem `--delete` Flag. Das Ziel wird eine exakte Ko
|
|||
|
||||
`mariabackup` wird verwendet, um eine konsistente Kopie des SQL-Datenverzeichnisses zu erstellen.
|
||||
|
||||
Nach dem Rsync der Daten fĂĽhren wir `docker compose pull` aus und entfernen alte Image-Tags aus dem Ziel.
|
||||
Nach dem Rsync der Daten fĂĽhren wir folgenden Befehl aus (anhand der gesetzten docker compose Version in der mailcow.conf) und entfernen alte Image-Tags aus dem Ziel:
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose pull
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose pull
|
||||
```
|
||||
|
||||
Ihre Quelle wird zu keinem Zeitpunkt verändert.
|
||||
|
||||
|
|
|
@ -18,7 +18,19 @@ The script uses rsync with the `--delete` flag. The destination will be an exact
|
|||
|
||||
`mariabackup` is used to create a consistent copy of the SQL data directory.
|
||||
|
||||
After rsync'ing the data we will run `docker compose pull` and remove old image tags from the destination.
|
||||
After rsync'ing the data we will run the command below (depending on your set docker compose type in mailcow.conf) and remove old image tags from the destination:
|
||||
|
||||
=== "docker compose (Plugin)"
|
||||
|
||||
``` bash
|
||||
docker compose pull
|
||||
```
|
||||
|
||||
=== "docker-compose (Standalone)"
|
||||
|
||||
``` bash
|
||||
docker-compose pull
|
||||
```
|
||||
|
||||
Your source will not be changed at any time.
|
||||
|
||||
|
|
Laden …
In neuem Issue referenzieren