Upgrade Docker container

From LogicalDOC Community Wiki
Revision as of 14:32, 10 December 2021 by Blucecio (talk | contribs)
Jump to navigationJump to search

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

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 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