Difference between revisions of "Upgrade Docker container"

From LogicalDOC Community Wiki
Jump to navigationJump to search
(Starting the update)
m
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{Advice|This guide refers to containers created from Docker images older than release 8.8. All the containers created from a Docker image release 8.8 and forward, can be updated using the default procedure as per the manual: [https://docs.logicaldoc.com/en/update/update-procedure https://docs.logicaldoc.com/en/update/update-procedure]}}
 +
 
== Initial Situation ==
 
== Initial Situation ==
  
Line 19: Line 21:
  
 
== Prepare for the upgrade ==
 
== 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.<br>
 
Download the upgrade package for LD 8.6.1 from http://network.logicaldoc.com/ and copy it from the host to the container instance.<br>
  
Note that the file will be copied to the directory prepared to contain the update packages
+
Note that the file will be copied in the container to the directory prepared to contain the update packages
 
<pre>
 
<pre>
 
docker cp ldoc_upd-00000086.zip <Logicaldoc-container-name>:/LogicalDOC/updates/
 
docker cp ldoc_upd-00000086.zip <Logicaldoc-container-name>:/LogicalDOC/updates/
Line 66: Line 70:
  
 
== After the upgrade ==  
 
== After the upgrade ==  
At this point I can make a copy of my updated container (mysnapshot) or run it as is.<br>
+
At this point we can make a copy of my updated container (mysnapshot) or run it as is.<br>
  
 
I choose the latter solution to have a friendlier name (I also add the version name)
 
I choose the latter solution to have a friendlier name (I also add the version name)
 
<pre>
 
<pre>
docker commit --change='CMD ["/LogicalDOC/logicaldoc.sh", "run"]' <ID-of-container-mysnapshot> myCompanyName/logicaldoc:8.7
+
docker commit --change='CMD ["/LogicalDOC/logicaldoc.sh", "run"]' <ID-of-container-mysnapshot> mycompanyname/logicaldoc:8.7
 
</pre>
 
</pre>
  
 
# Start the new Docker container with the paths of the old instance (for configuration and document repository)
 
# Start the new Docker container with the paths of the old instance (for configuration and document repository)
docker run -ti -v /var/lib/docker/volumes/89bbc84f2bc8ed5d748710876bde62ac30d065fbb582888bec52b2bcf2542a47/_data:/LogicalDOC/conf -v /var/lib/docker/volumes/353b4ee020551ccadb668353dedac87f9706a277d027b9a9993e096462a1ff1e/_data:/LogicalDOC/repository --link mysqlld861 myCompanyName/logicaldoc:8.7
+
<pre>
 +
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
 +
</pre>
 +
 
 +
== 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<br>
 +
 
 +
=== 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
 +
<pre>
 +
docker inspect <Logicaldoc-container-name>
 +
</pre>
 +
 
 +
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 https://hub.docker.com/r/logicaldoc/logicaldoc]
 +
 
 +
[[Category: Docker]]

Latest revision as of 08:42, 31 May 2022


Note idea.png This guide refers to containers created from Docker images older than release 8.8. All the containers created from a Docker image release 8.8 and forward, can be updated using the default procedure as per the manual: https://docs.logicaldoc.com/en/update/update-procedure


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