Upgrade Docker container

From LogicalDOC Community Wiki
Revision as of 08:37, 31 May 2022 by Car031 (talk | contribs)
Jump to navigationJump to search


Note idea.png This guide refers to a basic single-server deployment scenario. Please be aware that this procedure is not coverded by the standard support contract. In case something goes wrong during the migration process, the support team cannot offer any help and LogicalDOC is not liable for any data loss.
In case you want this delicate matter to be handled professionally, please write to sales@logicaldoc.com for a quote.


Initial Situation

Here is how you usually start a Docker container with LogicalDOC connected to a MySQL 8.0 container for DB engine

Get the LogicalDOC 8.6.1 image

docker pull logicaldoc/logicaldoc:8.6.1

Run the MySQL container

docker run --name=mysqlld861 -e MYSQL_ROOT_PASSWORD=mypassword -e MYSQL_DATABASE=logicaldoc -e MYSQL_USER=ldoc -e MYSQL_PASSWORD=changeme mysql:latest --default-authentication-plugin=mysql_native_password

Run the LogicalDOC container connected to the MySQL one

docker run -p 8080:8080 -e LDOC_USERNO=543645 -e DB_HOST=mysqlld861 --link mysqlld861 logicaldoc/logicaldoc:8.6.1

Prepare for the upgrade

Since our reference system is version 8.6.1 we will download the update to bring it to the next version, then update 86, if the version is different download the relevant update and copy it to the correct folder.

Download the upgrade package for LD 8.6.1 from http://network.logicaldoc.com/ and copy it from the host to the container instance.

Note that the file will be copied in the container to the directory prepared to contain the update packages

docker cp ldoc_upd-00000086.zip <Logicaldoc-container-name>:/LogicalDOC/updates/

The upgrade package ldoc_upd-00000086.zip will upgrade the system from version 8.6.1 to version 8.7

Create image (snapshot) from container filesystem

docker commit <Logicaldoc-container-ID> mysnapshot

Use the inspect command to inspect the location of /conf and /repository directories

docker inspect <Logicaldoc-container-name>

I capture the paths of the /conf and /repository directories of the current Logicaldoc container and replace them for the snapshot image.

docker run -ti -v /var/lib/docker/volumes/89bbc84f2bc8ed5d748710876bde62ac30d065fbb582888bec52b2bcf2542a47/_data:/LogicalDOC/conf -v /var/lib/docker/volumes/353b4ee020551ccadb668353dedac87f9706a277d027b9a9993e096462a1ff1e/_data:/LogicalDOC/repository --link mysqlld861 mysnapshot /bin/bash

Notice the mapping of /LogicalDOC/conf and /LogicalDOC/repository

Of course the MySQL container should be connected with the --link parameter

Starting the update

After you have connected to the snpashot instance (mysnapshot) you can proceed to launch the LogicalDOC application update.

LogicalDOC updates usually consist of an application update on the filesystem and possible updates to the configuration (/conf/context.properties) and to the data on the database.

Launch the update with the following commands on the snapshot container instance

cd /Logicaldoc/bin
./update.sh

After the process completes you can exit from the snapshot with command

exit

After the upgrade

At this point we can make a copy of my updated container (mysnapshot) or run it as is.

I choose the latter solution to have a friendlier name (I also add the version name)

docker commit --change='CMD ["/LogicalDOC/logicaldoc.sh", "run"]' <ID-of-container-mysnapshot> mycompanyname/logicaldoc:8.7
  1. Start the new Docker container with the paths of the old instance (for configuration and document repository)
docker run -ti -p 8080:8080 -v /var/lib/docker/volumes/89bbc84f2bc8ed5d748710876bde62ac30d065fbb582888bec52b2bcf2542a47/_data:/LogicalDOC/conf -v /var/lib/docker/volumes/353b4ee020551ccadb668353dedac87f9706a277d027b9a9993e096462a1ff1e/_data:/LogicalDOC/repository --link mysqlld861 mycompanyname/logicaldoc:8.7

Further considerations

The update process must be performed for each released update, it is not possible to upgrade for example from version 8.3.4 to version 8.6

Data backup

The document physical files of your LogicalDOC are contained in the folder /LogicalDOOC/repository, the system configuration in the folder /LogicalDOC/conf, while all the meta information of the documents and of the repository structure are inside the database. Before proceeding with the system update, it is therefore a good idea to back up the configuration folder, the data in the database and the documents.

To find out the folder where the document files reside and the confituration folder, it is advisable to query your docker instance with the command

docker inspect <Logicaldoc-container-name>

What you are interested in is the path on the host system of the mapping /LogicalDOC/conf e /LogicalDOC/repository (documents)

More Information

For more information about LogicalDOC Docker image: https://hub.docker.com/r/logicaldoc/logicaldoc