Upgrading Growi from 4.5 to 5.0 on docker-compose

How to upgrade Growi 4.5 to 5.0 running on docker-compose

* This page contains promotional content

I have written about upgrading Growi before, but this time it is a major upgrade from 4.x to 5.x.

Assume that Growi is running on Docker with the configuration below

AppVersion
Growi4.5.19
mongodb4.4

Note that if you are building it with docker for the first time, you can build it just as the official installation describes, so the work from here on is unnecessary

Get 4.x up to the latest version first

If you are running it on docker, I think it is better to update 4.x to the latest version as far as you can, based on the official upgrade information below.

As of writing, that is v4.5.19

The upgrade work

Before upgrading, always take a backup of mongodb and of the archive
There are also a lot of important changes, so read through the official article once

Stopping Growi

Be careful not to run docker-compose down!

$ docker-compose stop

Deleting the containers and the Elasticsearch volume

$ docker-compose rm app
 Going to remove growi-app-1 (y/N) y

$ docker-compose rm elasticsearch
 Going to remove growi-elasticsearch-1 (y/N) y

Delete the docker volume that the Elasticsearch container was using

$ docker volume ls|grep es_data
local     growi_es_data
$ docker volume rm growi_es_data

Deleting the images

Change the image IDs (07d ded 5e3) to match your own environment

$ docker images|grep growi
growi_app                                       latest          07d9d010ddc1   25 minutes ago   781MB
weseek/growi                                    4               dedb45121a0e   10 days ago      753MB
growi_elasticsearch                             latest          5e32778e509f   4 months ago     981MB

$ docker rmi 07d ded 5e3

Updating the repository

If you have files you have edited, take a backup of them

$ pwd
/growi

$ cp docker-compose.yml docker-compose.yml.bak

$ git pull

In my case there were changes to docker-compose.yml and elasticsearch/Dockerfile, so the following work was necessary

$ git pull
-
Please commit your changes or stash them before you merge

$ git checkout docker-compose.yml
$ git checkout elasticsearch/Dockerfile

$ git pull origin master

Editing docker-compose.yml

The docker-compose.yml you git pulled has gone back to its initial values, so edit it while comparing it with the docker-compose.yml.bak you backed up
The diff in my case

--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -6,7 +6,7 @@ services:
       context: .
       dockerfile: ./Dockerfile
     ports:
-      - 127.0.0.1:3000:3000    # localhost only by default
+      - 3000:3000    # localhost only by default
     links:
       - mongo:mongo
       - elasticsearch:elasticsearch
@@ -16,15 +16,20 @@ services:
     environment:
       - MONGO_URI=mongodb://mongo:27017/growi
       - ELASTICSEARCH_URI=http://elasticsearch:9200/growi
-      - PASSWORD_SEED=changeme
+      - PASSWORD_SEED=ae9xxxxxxxxxxxxxxxxxxxxxxx
       # - FILE_UPLOAD=local     # activate this line if you use local storage of server rather than AWS
+      - FILE_UPLOAD=aws     # activate this line if you use local storage of server rather than AWS

If you have changed files other than docker-compose.yml, edit those as appropriate too

Build

$ docker-compose build

Confirm that it succeeded by seeing Successfully built

Starting it up

$ docker-compose up -d

With this, you are finished once you can connect and log in as before

Converting the pages to the v5 compatible format

When you log in to Growi as an administrator, I think you will see the warning below

You will want to press the conversion link right away, but it fails unless you switch to maintenance mode

Click App settings in the left column and start maintenance mode on the bottom row of the right column

After that, start the conversion to the v5 compatible format

Once the conversion has completed without trouble, exit maintenance mode

This upgrade to v5 changed the permalinks, which threw me off, but since it is a wiki only for me it is not much of a problem, so I went ahead with the upgrade; if you were running it at a workplace, with colleagues or in a club, it looks like you would need to think it through carefully
As for how the upgrade felt, with most OSS and applications every upgrade tends to mean more memory consumption, or things getting heavier and less pleasant to use, but with Growi v5.x, partly because elasticsearch went up to 7, I could really feel the search speed and the overall speed improve, and I think it has become more pleasant to use

oss 

See also