Unable to upgrade Gitea from 1.14.7 to 1.15.2 #7829

Closed
opened 2025-11-02 07:38:34 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @NiklasRosenstein on GitHub (Sep 10, 2021).

  • Gitea version (or commit ref): 1.14.7
  • Git version:
  • Operating system: Debian 9
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:

Description

I want to upgrade my Gitea instance deployed via Docker to 1.15.2. But the server won't start up and actually dies after a minute or so.

$ docker-compose up
Starting gitea_server_1 ... done
Attaching to gitea_server_1
server_1  | Server listening on :: port 22.
server_1  | Server listening on 0.0.0.0 port 22.
server_1  | 2021/09/10 20:50:12 cmd/web.go:102:runWeb() [I] Starting Gitea on PID: 14
server_1  | 2021/09/10 20:50:12 cmd/web.go:146:runWeb() [I] Global init
server_1  | 2021/09/10 20:50:12 routers/init.go:74:GlobalInit() [I] Git Version: 2.30.2, Wire Protocol Version 2 Enabledserver_1  | 2021/09/10 20:50:12 routers/init.go:77:GlobalInit() [I] AppPath: /app/gitea/gitea
server_1  | 2021/09/10 20:50:12 routers/init.go:78:GlobalInit() [I] AppWorkPath: /app/gitea
server_1  | 2021/09/10 20:50:12 routers/init.go:79:GlobalInit() [I] Custom path: /data/gitea
server_1  | 2021/09/10 20:50:12 routers/init.go:80:GlobalInit() [I] Log path: /data/gitea/log
server_1  | 2021/09/10 20:50:12 routers/init.go:81:GlobalInit() [I] Run Mode: Prod
server_1  | Received signal 15; terminating.

My docker-compose file:

version: '2'
networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:latest
    environment:
      - USER_UID=998   # git
      - USER_GID=1007  # git
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
    ports:
      - "127.0.0.1:8701:3000"
      - "127.0.0.1:8702:22"

However if I go back to gitea/gitea:1.14.7 Gitea won't start up because the schema version has been increased. Luckily I can change the schema version back via sqlite3 and it works again. 😌

I have tried to incrementally take versions 1.15.0, 1.15.1 and 1.15.2 but all have the same issue.

What could be going wrong here?

Originally created by @NiklasRosenstein on GitHub (Sep 10, 2021). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.14.7 - Git version: - Operating system: Debian 9 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - Log gist: <!-- It really is important to provide pertinent logs --> <!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems --> <!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini --> ## Description I want to upgrade my Gitea instance deployed via Docker to 1.15.2. But the server won't start up and actually dies after a minute or so. ``` $ docker-compose up Starting gitea_server_1 ... done Attaching to gitea_server_1 server_1 | Server listening on :: port 22. server_1 | Server listening on 0.0.0.0 port 22. server_1 | 2021/09/10 20:50:12 cmd/web.go:102:runWeb() [I] Starting Gitea on PID: 14 server_1 | 2021/09/10 20:50:12 cmd/web.go:146:runWeb() [I] Global init server_1 | 2021/09/10 20:50:12 routers/init.go:74:GlobalInit() [I] Git Version: 2.30.2, Wire Protocol Version 2 Enabledserver_1 | 2021/09/10 20:50:12 routers/init.go:77:GlobalInit() [I] AppPath: /app/gitea/gitea server_1 | 2021/09/10 20:50:12 routers/init.go:78:GlobalInit() [I] AppWorkPath: /app/gitea server_1 | 2021/09/10 20:50:12 routers/init.go:79:GlobalInit() [I] Custom path: /data/gitea server_1 | 2021/09/10 20:50:12 routers/init.go:80:GlobalInit() [I] Log path: /data/gitea/log server_1 | 2021/09/10 20:50:12 routers/init.go:81:GlobalInit() [I] Run Mode: Prod server_1 | Received signal 15; terminating. ``` My docker-compose file: ```yml version: '2' networks: gitea: external: false services: server: image: gitea/gitea:latest environment: - USER_UID=998 # git - USER_GID=1007 # git restart: always networks: - gitea volumes: - ./gitea:/data ports: - "127.0.0.1:8701:3000" - "127.0.0.1:8702:22" ``` However if I go back to `gitea/gitea:1.14.7` Gitea won't start up because the schema version has been increased. Luckily I can change the schema version back via sqlite3 and it works again. 😌 I have tried to incrementally take versions `1.15.0`, `1.15.1` and `1.15.2` but all have the same issue. What could be going wrong here?
Author
Owner

@zeripath commented on GitHub (Sep 11, 2021):

Have you checked your logs?

There will be some information there.


The most likely problem is that you have custom templates with {{StaticUrlPrefix}} in them. These should be {{AssetUrlPrefix}}.

Please read the breaking notes for 1.15.0.

@zeripath commented on GitHub (Sep 11, 2021): Have you checked your logs? There will be some information there. --- The most likely problem is that you have custom templates with `{{StaticUrlPrefix}}` in them. These should be `{{AssetUrlPrefix}}`. Please read the breaking notes for 1.15.0.
Author
Owner

@NiklasRosenstein commented on GitHub (Sep 12, 2021):

Hey @zeripath , thanks I totally missed that there is a log/gitea.log file and was wondering why there are so little container logs. 🤦

Going from 1.14.7 to 1.15.2 I see this:

2021/09/12 13:52:38 routers/init.go:93:GlobalInit() [I] SQLite3 Supported
2021/09/12 13:52:38 routers/common/db.go:20:InitDBEngine() [I] Beginning ORM engine initialization.
2021/09/12 13:52:38 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #1/10...
2021/09/12 13:52:38 ...om/urfave/cli/app.go:524:HandleAction() [I] PING DATABASE sqlite3
2021/09/12 13:52:38 ...ations/migrations.go:382:Migrate() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' and name = ? [version] - 127.871µs
2021/09/12 13:52:38 routers/common/db.go:28:InitDBEngine() [I] [SQL] SELECT * FROM version LIMIT 0 [] - 52.274µs
2021/09/12 13:52:38 routers/common/db.go:28:InitDBEngine() [I] [SQL] SELECT * FROM version LIMIT 0 [] - 30.836µs
2021/09/12 13:52:38 ...rm.io/xorm/engine.go:1139:Get() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 [1] - 199.457µs
2021/09/12 13:52:38 ...ations/migrations.go:419:Migrate() [I] Migration[184]: Rename Task errors to message
2021/09/12 13:52:38 models/models.go:229:NewEngine() [I] [SQL] BEGIN TRANSACTION [] - 52.227µs
2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' [] - 36.441µs
2021/09/12 13:52:38 ...ations/migrations.go:49:Migrate() [I] [SQL] SELECT sql FROM sqlite_master WHERE type='table' and name = ? [task] - 313.75µs
2021/09/12 13:52:38 ...ations/migrations.go:49:Migrate() [I] [SQL] SELECT sql FROM sqlite_master WHERE type='index' and tbl_name = ? [task] - 30.39µs
2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] DROP INDEX `IDX_task_doer_id` [] - 550.588µs
2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] DROP INDEX `IDX_task_owner_id` [] - 497.308µs
2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] DROP INDEX `IDX_task_repo_id` [] - 402.625µs
2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column id but struct has not related field
2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column doer_id but struct has not related field
2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column owner_id but struct has not related field
2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column repo_id but struct has not related field
2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column start_time but struct has not related field
2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column end_time but struct has not related field
2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column payload_content but struct has not related field
2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column message but struct has not related field
2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column created but struct has not related field
2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] ALTER TABLE `task` RENAME COLUMN errors TO message [] - 29.122253ms
2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] ROLLBACK [] - 343.854µs
2021/09/12 13:52:38 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: migrate: do migrate: error in table task after rename: duplicate column name: message
2021/09/12 13:52:38 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds

I suspect this could stem from the first attempt to upgrade where some parts of the db migration might have already run. Any idea how to fix this? 🤔

The most likely problem is that you have custom templates with {{StaticUrlPrefix}} in them. These should be {{AssetUrlPrefix}}.

Unless there comes anything "custom" with the Docker image, I should not have any custom templates.

@NiklasRosenstein commented on GitHub (Sep 12, 2021): Hey @zeripath , thanks I totally missed that there is a log/gitea.log file and was wondering why there are so little container logs. 🤦 Going from 1.14.7 to 1.15.2 I see this: ``` 2021/09/12 13:52:38 routers/init.go:93:GlobalInit() [I] SQLite3 Supported 2021/09/12 13:52:38 routers/common/db.go:20:InitDBEngine() [I] Beginning ORM engine initialization. 2021/09/12 13:52:38 routers/common/db.go:27:InitDBEngine() [I] ORM engine initialization attempt #1/10... 2021/09/12 13:52:38 ...om/urfave/cli/app.go:524:HandleAction() [I] PING DATABASE sqlite3 2021/09/12 13:52:38 ...ations/migrations.go:382:Migrate() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' and name = ? [version] - 127.871µs 2021/09/12 13:52:38 routers/common/db.go:28:InitDBEngine() [I] [SQL] SELECT * FROM version LIMIT 0 [] - 52.274µs 2021/09/12 13:52:38 routers/common/db.go:28:InitDBEngine() [I] [SQL] SELECT * FROM version LIMIT 0 [] - 30.836µs 2021/09/12 13:52:38 ...rm.io/xorm/engine.go:1139:Get() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 [1] - 199.457µs 2021/09/12 13:52:38 ...ations/migrations.go:419:Migrate() [I] Migration[184]: Rename Task errors to message 2021/09/12 13:52:38 models/models.go:229:NewEngine() [I] [SQL] BEGIN TRANSACTION [] - 52.227µs 2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] SELECT name FROM sqlite_master WHERE type='table' [] - 36.441µs 2021/09/12 13:52:38 ...ations/migrations.go:49:Migrate() [I] [SQL] SELECT sql FROM sqlite_master WHERE type='table' and name = ? [task] - 313.75µs 2021/09/12 13:52:38 ...ations/migrations.go:49:Migrate() [I] [SQL] SELECT sql FROM sqlite_master WHERE type='index' and tbl_name = ? [task] - 30.39µs 2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] DROP INDEX `IDX_task_doer_id` [] - 550.588µs 2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] DROP INDEX `IDX_task_owner_id` [] - 497.308µs 2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] DROP INDEX `IDX_task_repo_id` [] - 402.625µs 2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column id but struct has not related field 2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column doer_id but struct has not related field 2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column owner_id but struct has not related field 2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column repo_id but struct has not related field 2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column start_time but struct has not related field 2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column end_time but struct has not related field 2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column payload_content but struct has not related field 2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column message but struct has not related field 2021/09/12 13:52:38 routers/init.go:97:GlobalInit() [W] Table task has column created but struct has not related field 2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] ALTER TABLE `task` RENAME COLUMN errors TO message [] - 29.122253ms 2021/09/12 13:52:38 ...ations/migrations.go:422:Migrate() [I] [SQL] ROLLBACK [] - 343.854µs 2021/09/12 13:52:38 routers/common/db.go:33:InitDBEngine() [E] ORM engine initialization attempt #1/10 failed. Error: migrate: do migrate: error in table task after rename: duplicate column name: message 2021/09/12 13:52:38 routers/common/db.go:34:InitDBEngine() [I] Backing off for 3 seconds ``` I suspect this could stem from the first attempt to upgrade where some parts of the db migration might have already run. Any idea how to fix this? 🤔 > The most likely problem is that you have custom templates with {{StaticUrlPrefix}} in them. These should be {{AssetUrlPrefix}}. Unless there comes anything "custom" with the Docker image, I should not have any custom templates.
Author
Owner

@zeripath commented on GitHub (Sep 12, 2021):

OK, you're the third person to report this task message field.

I don't understand where this field is coming from - there is no code that should be creating it.

Either:

  • With a gitea 1.14.7 version of your DB run gitea doctor recreate-table task and then the migration will proceed.
  • Or, just drop the message field from this table manually.
@zeripath commented on GitHub (Sep 12, 2021): OK, you're the third person to report this `task` `message` field. I don't understand where this field is coming from - there is no code that should be creating it. Either: * With a gitea 1.14.7 version of your DB run `gitea doctor recreate-table task` and then the migration will proceed. * Or, just drop the `message` field from this table manually.
Author
Owner

@NiklasRosenstein commented on GitHub (Sep 12, 2021):

Nice, that worked! (I did the doctor command)

Thank you @zeripath . Let me know if I can do anything for you that might help you diagnose the root cause.

Best,
Niklas

@NiklasRosenstein commented on GitHub (Sep 12, 2021): Nice, that worked! (I did the doctor command) Thank you @zeripath . Let me know if I can do anything for you that might help you diagnose the root cause. Best, Niklas
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7829