How to upgrade gogs (docker) from 0.11.x to 0.12.x?

I am currently using gogs 0.11.91 as a docker container with a mysql 5.7 backend (which also runs in a container is connected to gogs via a docker network using docker-compose).

I today tried to upgrade to gogs 0.12.3, which failed. This version no longer seems to be able to connect to the mysql database.

On the gogs side, I receive the following error:
[error] failed to initialize database, got error failed to connect to host=db user=gogs database=gogs: failed to receive message (unknown message type: J)
On the db side, I get this:
2020-10-16T08:06:17.671572Z 1170 [Note] Got an error reading communication packets
2020-10-16T08:06:18.670974Z 1171 [Note] Got packets out of order

It seems like gogs no longer supports this old (but still extremely common) version of mysql. Is there some kind of upgrade path I can follow to upgrade gogs without losing my data?

Hi, MySQL >= 5.7 is supported, so your MySQL version should just work file.

The problem I’m seeing is that the connection string “host=db user=gogs database=gogs” is for Postgres, which became the default database option since 0.12.

So I suspect the app.ini you have didn’t get read by the Gogs properly. Someone else also reported using docker-compose and somehow the config file wasn’t loaded inside the Gogs container (which I tried and couldn’t reproduce) :thinking:

Just in case, would you mind sharing your Docker compose and the app.ini (with secrets redacted)?

This is my docker-compose.yaml:

 version: '3.3'
 services:
      gogs:
        restart: always
        image: gogs/gogs:0.11.91
        ports:
          - "10080:3000"
          - "10022:22"
        volumes:
          - /opt/services/gogs/data:/data
      db:
        image: mysql:5.7
        volumes:
          - /opt/services/gogs/db:/var/lib/mysql
        restart: always
        ports:
          - "3310:3306"
        environment:
          ...

And this my app.ini file:

APP_NAME = ITU git
RUN_USER = git
RUN_MODE = prod

[database]
DB_TYPE  = mysql
HOST     = db:3306
NAME     = XXXX
USER     = XXXX
PASSWD   = XXXX
SSL_MODE = disable
PATH     = data/gogs.db

[repository]
ROOT = /data/git/gogs-repositories

[server]
DOMAIN           = XXXX
HTTP_PORT        = 3000
ROOT_URL         = XXXX
DISABLE_SSH      = false
SSH_PORT         = 22
START_SSH_SERVER = false
OFFLINE_MODE     = false

[mailer]
...

[service]
REGISTER_EMAIL_CONFIRM = true
ENABLE_NOTIFY_MAIL     = true
DISABLE_REGISTRATION   = true
ENABLE_CAPTCHA         = false
REQUIRE_SIGNIN_VIEW    = false

[picture]
DISABLE_GRAVATAR        = false
ENABLE_FEDERATED_AVATAR = false

[session]
PROVIDER = file

[log]
MODE      = file
LEVEL     = Info
ROOT_PATH = /app/gogs/log

[security]
INSTALL_LOCK = true
SECRET_KEY   = XXXX

I have a similar question, when I upgrade from 0.11.91.0811 to 0.12.3 – Which I also run as a Docker container with a Traefik ingress load balancer in front, I now just get 502 errors.

I’m using the built in SQLite database driver.

Are there any upgrade notes from 0.11 to 0.12? I couldn’t find any, are there any specific things that need to be adjusted before for the upgrade to suceed?

Kind regards

James