forked from mayan-edms/Mayan-EDMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrading.txt
250 lines (144 loc) · 7.02 KB
/
upgrading.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
=========
Upgrading
=========
Upgrading a Mayan EDMS Docker container is actually a matter of stopping and
deleting the container, downloading the most recent version of the image and
starting a container again. The container will take care of updating the
database structure to the newest version if necessary.
.. important::
Do not delete the volume storing the data, only the container.
Deleting the volume will delete all the document files.
.. important::
To upgrade the database container, follow the database container upgrade
procedure. In some cases, the existing database files may not be compatible
with the new database container version. A manual database full dump and
subsequent restore may be required.
Simple installation
===================
#. Stop the container to be upgraded:
.. code-block:: console
docker stop mayan-edms
#. Remove the container:
.. code-block:: console
docker rm mayan-edms
#. Pull the new image version:
.. code-block:: console
docker pull mayanedms/mayanedms:|DOCKER_MAYAN_IMAGE_VERSION|
.. note::
Do not use the ``latest`` tag, it does not point to the latest version.
#. Start the container again with the new image version:
.. code-block:: console
docker run \
-d \
--name mayan-edms \
--restart=always \
-p 80:8000 \
-e MAYAN_CELERY_BROKER_URL="redis://:|DEFAULT_REDIS_PASSWORD|@172.17.0.1:6379/0" \
-e MAYAN_CELERY_RESULT_BACKEND="redis://:|DEFAULT_REDIS_PASSWORD|@172.17.0.1:6379/1" \
-e MAYAN_DATABASES="{'default':{'ENGINE':'django.db.backends.postgresql','NAME':'|DEFAULT_DATABASE_NAME|','PASSWORD':'|DEFAULT_DATABASE_PASSWORD|','USER':'|DEFAULT_DATABASE_USER|','HOST':'172.17.0.1'}}" \
-e MAYAN_LOCK_MANAGER_BACKEND="mayan.apps.lock_manager.backends.redis_lock.RedisLock" \
-e MAYAN_LOCK_MANAGER_BACKEND_ARGUMENTS="{'redis_url':'redis://:|DEFAULT_REDIS_PASSWORD|@172.17.0.1:6379/2'}" \
-v /docker-volumes/mayan-edms/media:/var/lib/mayan \
mayanedms/mayanedms:|DOCKER_MAYAN_IMAGE_VERSION|
.. note::
Ensure any customized environment variables used when launching the old version
of the container match the variables used to launch the new version
(e.g database password). If Mayan loads but login fails post upgrade,
this could be a cause.
Docker Compose installation
===========================
.. note::
If you are invoking the ``docker-compose`` command in the same directory
where the file ``docker-compose.yml`` resides, there is no need to
add the ``--file docker-compose.yml`` option.
.. note::
Use the same project name as your did during installation. This example
follows the installation shown in :ref:`docker_compose_install` which
specifies a project name of ``mayan``.
Upgrade between minor versions
------------------------------
#. Stop and delete the container stack:
.. code-block:: console
docker-compose --file docker-compose.yml --project-name mayan down
#. Rename the Docker Compose file and keep it for future reference:
.. code-block:: console
mv docker-compose.yml docker-compose.yml.bck
#. Download the new Docker Compose files:
.. code-block:: console
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/docker-compose.yml -O
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/env_file -O
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/.env -O
#. Edit and the adjust the new Docker Compose file, copying over all relevant
values like username, password, etc.
#. Launch the rest of container stack:
.. code-block:: console
docker-compose --file docker-compose.yml --project-name mayan up --detach
.. note::
The app container will perform all the necessary migrations to the
existing data.
Upgrade between major versions
------------------------------
.. note::
The additional steps in this process are required to move the database
content from one version of PostgreSQL to a new version of PostgreSQL.
If the upgrade is between major versions of Mayan EDMS but the major
version of the database manager remains the same, this process is not
necessary and the simpler upgrade process can be used.
#. Dump the existing database into an SQL file.
.. code-block:: console
docker-compose --file docker-compose.yml --project-name mayan exec postgresql /bin/bash -c 'pg_dumpall --username="$POSTGRES_USER"' > mayan.sql
#. Verify the SQL file:
.. code-block:: console
cat mayan.sql | more
#. Stop and delete the container stack:
.. code-block:: console
docker-compose --file docker-compose.yml --project-name mayan down
#. Make a backup of the database binary files:
.. code-block:: console
docker volume inspect mayan_postgres
> [
> {
> "CreatedAt": "2021-06-17T05:32:28Z",
> "Driver": "local",
> "Labels": {
> "com.docker.compose.project": "mayan",
> "com.docker.compose.version": "1.29.1",
> "com.docker.compose.volume": "postgres"
> },
> "Mountpoint": "/var/lib/docker/volumes/mayan_postgres/_data",
> "Name": "mayan_postgres",
> "Options": null,
> "Scope": "local"
> }
> ]
sudo cp --recursive /var/lib/docker/volumes/mayan_postgres/_data ~/mayan_binary_backup
#. Delete the database volume:
.. code-block:: console
docker volume rm mayan_postgres
.. important::
Only delete the database volume after dumping the data into SQL, backing
up the volume binary content, and verifying that both files were created
successfully. Do not delete the app volume. This is where the actual
document files are stored.
#. Rename the Docker Compose file and keep it for future reference:
.. code-block:: console
mv docker-compose.yml docker-compose.yml.bck
#. Download the new Docker Compose files:
.. code-block:: console
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/docker-compose.yml -O
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/env_file -O
curl https://gitlab.com/mayan-edms/mayan-edms/-/raw/master/docker/.env -O
#. Edit and the adjust the new Docker Compose file, copying over all relevant
values like username, password, etc.
#. Launch the database container alone:
.. code-block:: console
docker-compose --file docker-compose.yml --project-name mayan up --detach postgresql
#. Load the database data from the SQL file:
.. code-block:: console
cat mayan.sql | docker-compose --file docker-compose.yml --project-name mayan exec -T postgresql /bin/bash -c 'psql --username="$POSTGRES_USER"'
#. Launch the rest of container stack:
.. code-block:: console
docker-compose --file docker-compose.yml --project-name mayan up --detach
.. note::
The app container will perform all the necessary migrations to the
existing data.