Step 1: Check if all the external data storage folders are mounted
Make sure that all the container volumes used to store ONLYOFFICE Mail data are mounted using the following command:
sudo docker inspect --format='{{range $p,$conf:=.HostConfig.Binds}}{{$conf}};{{end}}' {{MAIL_SERVER_ID}}
where {{MAIL_SERVER_ID}} stands for the ONLYOFFICE Mail container name or ID.
You can easily find out the current
ONLYOFFICE Mail container name or ID using the Docker command which will list all the existing containers:
docker ps -a
You can backup the mounted folders located on the host machine, as a precaution:
/app/onlyoffice/MailServer/logs
/app/onlyoffice/MailServer/mysql
/app/onlyoffice/MailServer/data
/app/onlyoffice/MailServer/data/certs
In case you have not mounted the folders during the ONLYOFFICE Mail installation, you will need to perform the backup of the following folders within the Docker container:
/var/log
that contains ONLYOFFICE Mail logs
/var/lib/mysql
that contains MySQL database data
/var/vmail
that contains mail storage
/etc/pki/tls/mailserver
that contains certificates
You can copy these data folders from the Docker container to a folder on your host machine:
sudo docker cp {{MAIL_SERVER_ID}}:var/log /home/user/Backup/MailServer/log
sudo docker cp {{MAIL_SERVER_ID}}:var/lib/mysql /home/user/Backup/MailServer/mysql
sudo docker cp {{MAIL_SERVER_ID}}:var/vmail /home/user/Backup/MailServer/vmail
sudo docker cp {{MAIL_SERVER_ID}}:etc/pki/tls/mailserver /home/user/Backup/MailServer/mailserver
Where {{MAIL_SERVER_ID}} stands for the ONLYOFFICE Mail container name or ID and /home/user/Backup/MailServer stands for a path to any folder on your host machine.
Step 2: Remove the current container
sudo docker rm -f {{MAIL_SERVER_ID}}
where {{MAIL_SERVER_ID}} stands for the ONLYOFFICE Mail container name or ID.
Step 3: Remove the current image
The image used to install ONLYOFFICE Mail also needs to be removed, otherwise it will be used to install it anew and no upgrade will happen:
sudo docker rmi -f $(sudo docker images | grep onlyoffice/mailserver | awk '{ print $3 }')
Step 4: Run the new ONLYOFFICE Mail image with the same map paths
Create a network for Docker containers if it had not been created for the previous version:
docker network create --driver bridge onlyoffice
Run the new ONLYOFFICE Mail image:
sudo docker run --net onlyoffice --privileged -i -t -d --restart=always --name onlyoffice-mail-server \
-p 25:25 -p 143:143 -p 587:587 \
-v /app/onlyoffice/MailServer/data:/var/vmail \
-v /app/onlyoffice/MailServer/data/certs:/etc/pki/tls/mailserver \
-v /app/onlyoffice/MailServer/logs:/var/log \
-v /app/onlyoffice/MailServer/mysql:/var/lib/mysql \
-h yourdomain.com \
onlyoffice/mailserver
Where yourdomain.com
is your ONLYOFFICE Mail hostname.
Your domain that will be used for maintaining correspondence must be valid and configured for this machine (i.e. it should have the appropriate A record in the DNS settings that points your domain name to the IP address of the machine where ONLYOFFICE Mail is installed).
In the command above, the "yourdomain.com"
parameter must be understood as a service domain for Mail Server. It is usually specified in the MX record of the domain that will be used for maintaining correspondence. As a rule, the "yourdomain.com"
looks like mx1.onlyoffice.com
Make sure that you run the new image with the folder paths mapped exactly as they had been mounted before you deleted ONLYOFFICE Mail image, otherwise the data stored in these folders will not be picked up automatically.
If you have not mounted the folders during the previous version installation, you will need to restore data manually before installing the ONLYOFFICE Mail new version. To do that you can copy the backup data from the folders on your host machine to the new folders on the host that will be mounted during the further installation:
sudo mkdir -p /app/onlyoffice/MailServer/logs && sudo cp -a /home/user/Backup/MailServer/log/. $_
sudo mkdir -p /app/onlyoffice/MailServer/mysql && sudo cp -a /home/user/Backup/MailServer/mysql/. $_
sudo mkdir -p /app/onlyoffice/MailServer/data && sudo cp -a /home/user/Backup/MailServer/vmail/. $_
sudo mkdir -p /app/onlyoffice/MailServer/data/certs && sudo cp -a /home/user/Backup/MailServer/mailserver/. $_
Where /home/user/Backup/MailServer stands for a path to any folder on your host machine. When the backup is restored, install ONLYOFFICE Mail as described above.
Step 5: Run the ONLYOFFICE Docs & ONLYOFFICE Community Server images with the same map paths
Run a new ONLYOFFICE Docs container and then the ONLYOFFICE Community Server container connecting them as described here. When running the containers, you will also need to mount data folders exactly as they had been mounted in the previous version.
Now you can run the portal and check the data for consistency and correct work.