I'll assist Raphaël in upgrading a Gitea instance running 1.11.0+rc1-23-g42663a687 to 1.16.8.
It is an ancient installation that was never upgraded. The plan is to try an upgrade using a backup so as to detect problems without disturbing the production instance.
Sandboxed upgrade
upload the backup to a virtual machine and restore the backup
Following the [HOWTO Gitea upgrades, a guide for admins](https://forum.hostea.org/t/howto-gitea-upgrades-a-guide-for-admins/39)
---
I'll assist Raphaël in upgrading a Gitea instance running 1.11.0+rc1-23-g42663a687 to 1.16.8.
It is an ancient installation that was never upgraded. The plan is to try an upgrade using a backup so as to detect problems without disturbing the production instance.
#### Sandboxed upgrade
- [x] upload the backup to a virtual machine and restore the backup
- [x] verify the [database version](https://forum.hostea.org/t/howto-gitea-upgrades-a-guide-for-admins/39#list-of-latest-major-versions-5) is v118
- [x] install gitea v1.11.8
- [x] `gitea migrate` verify it does no migration with select * from version == 118
- [x] follow the [upgrade steps](https://forum.hostea.org/t/howto-gitea-upgrades-a-guide-for-admins/39)
- [x] `gitea doctor --all`
- [x] manually verify it works
- [x] [summarize findings](https://gitea.hostea.org/dachary/hostea/issues/3#issuecomment-549)
#### Production upgrade
- [x] install 1.16.8
$ ./gitea --config /tmp/a/app.ini doctor --all
[1] Check paths and basic configuration
- [I] Configuration File Path: "/tmp/a/app.ini"
- [I] Repository Root Path: "/home/git/gitea-repositories"
- [I] Data Root Path: "/home/git/data"
- [I] Custom File Root Path: "/home/git/custom"
- [W] NOTICE: is not accessible (Error: stat /home/git/custom: no such file or directory)
- [I] Work directory: "/home/git"
- [I] Log Root Path: "/var/log/gitea/"
OK
[2] Check if there is garbage storage files
OK
[3] Check Database Version
OK
[4] Check consistency of database
- [C] Error: pq: syntax error at or near "." whilst counting Orphaned OAuth2Grant without existing User
ERROR
[5] Check if user with wrong type exist
OK
[6] Check if OpenSSH authorized_keys file is up-to-date
OK
[7] Check if SCRIPT_TYPE is available
- [I] ScriptType bash is on the current PATH at /bin/bash
OK
[8] Check if hook files are up-to-date and executable
OK
[9] Recalculate Stars number for all user
OK
[10] Check old archives
- [I] 8 old archives in repository need to be deleted
OK
[11] Enable push options
- [I] Checked 25 repositories, 0 need updates.
OK
[12] Check for incorrectly dumped repo_units (See #16961)
- [W] Found 0 broken repo_units
OK
[13] Recalculate merge bases
- [W] Unable to get merge base for PR ID 16, #102 onto feature-config_managment in <redacted>. Error: exit status 128 - fatal: Not a valid object name feature-config_managment
& exit status 128 - fatal: ambiguous argument 'refs/heads/feature-config_managment': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
- [W] Unable to get merge base for PR ID 30, #112 onto feature-ASCII_backward_compatibility in <redacted>. Error: exit status 128 - fatal: Not a valid object name feature-ASCII_backward_compatibility
& exit status 128 - fatal: ambiguous argument 'refs/heads/feature-ASCII_backward_compatibility': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
- [W] 0 PRs with incorrect mergebases of 36 PRs total in 25 repos
OK
[14] Check git-daemon-export-ok files
- [I] Checked 25 repositories, 0 need updates.
OK
It seems to work but the doctor found errors.
```
$ ./gitea --config /tmp/a/app.ini doctor --all
[1] Check paths and basic configuration
- [I] Configuration File Path: "/tmp/a/app.ini"
- [I] Repository Root Path: "/home/git/gitea-repositories"
- [I] Data Root Path: "/home/git/data"
- [I] Custom File Root Path: "/home/git/custom"
- [W] NOTICE: is not accessible (Error: stat /home/git/custom: no such file or directory)
- [I] Work directory: "/home/git"
- [I] Log Root Path: "/var/log/gitea/"
OK
[2] Check if there is garbage storage files
OK
[3] Check Database Version
OK
[4] Check consistency of database
- [C] Error: pq: syntax error at or near "." whilst counting Orphaned OAuth2Grant without existing User
ERROR
[5] Check if user with wrong type exist
OK
[6] Check if OpenSSH authorized_keys file is up-to-date
OK
[7] Check if SCRIPT_TYPE is available
- [I] ScriptType bash is on the current PATH at /bin/bash
OK
[8] Check if hook files are up-to-date and executable
OK
[9] Recalculate Stars number for all user
OK
[10] Check old archives
- [I] 8 old archives in repository need to be deleted
OK
[11] Enable push options
- [I] Checked 25 repositories, 0 need updates.
OK
[12] Check for incorrectly dumped repo_units (See #16961)
- [W] Found 0 broken repo_units
OK
[13] Recalculate merge bases
- [W] Unable to get merge base for PR ID 16, #102 onto feature-config_managment in <redacted>. Error: exit status 128 - fatal: Not a valid object name feature-config_managment
& exit status 128 - fatal: ambiguous argument 'refs/heads/feature-config_managment': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
- [W] Unable to get merge base for PR ID 30, #112 onto feature-ASCII_backward_compatibility in <redacted>. Error: exit status 128 - fatal: Not a valid object name feature-ASCII_backward_compatibility
& exit status 128 - fatal: ambiguous argument 'refs/heads/feature-ASCII_backward_compatibility': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
- [W] 0 PRs with incorrect mergebases of 36 PRs total in 25 repos
OK
[14] Check git-daemon-export-ok files
- [I] Checked 25 repositories, 0 need updates.
OK
```
- [C] Error: pq: syntax error at or near "." whilst counting Orphaned OAuth2Grant without existing User
bug in the doctor command (fixed here) will likely be backported. It fails three checks but the database has no oauth2 configured so it does not really matter.
Unable to get merge base for PR ID 16, #102 + Unable to get merge base for PR ID 30, #112
these are because the associated branches were removed but the PR contain the commits and otherwise look good. The doctor should not issue a warning in this case.
8 old archives in repository need to be deleted
they are empty, they can be left where they are: it is a cache
NOTICE: is not accessible (Error: stat /home/git/custom: no such file or directory)
The doctor should not issue a warning in this case.
- [x] - [C] Error: pq: syntax error at or near "." whilst counting Orphaned OAuth2Grant without existing User
bug in the doctor command (fixed [here](https://github.com/go-gitea/gitea/pull/19765/files)) will likely be backported. It fails [three checks](https://github.com/go-gitea/gitea/blob/main/modules/doctor/dbconsistency.go#L193-L200) but the database has no oauth2 configured so it does not really matter.
- [x] Unable to get merge base for PR ID 16, #102 + Unable to get merge base for PR ID 30, #112
these are because the associated branches were removed but the PR contain the commits and otherwise look good. The doctor should not issue a warning in this case.
- [x] 8 old archives in repository need to be deleted
they are empty, they can be left where they are: it is a cache
- [x] NOTICE: is not accessible (Error: stat /home/git/custom: no such file or directory)
The doctor should not issue a warning in this case.
add set -x at the beginning to see what is happenening (in case the GPG key server takes a long time to answer, for instance)
comment out the flush queue command that does not exist in 1.11.
the emails of all users were manually verified to not be subject to this regression
An attempt was made to run gitea doctor before the upgrade only to realize that it was not available in 1.11
The upgrade is completed using [the upgrade.sh script](https://github.com/go-gitea/gitea/blob/7948cb3149ab64484a8d4c6644f53f9f39accbef/contrib/upgrade.sh) with the following changes:
* add set -x at the beginning to see what is happenening (in case the GPG key server takes a long time to answer, for instance)
* comment out the [flush queue](https://github.com/go-gitea/gitea/blob/7948cb3149ab64484a8d4c6644f53f9f39accbef/contrib/upgrade.sh#L114) command that does not exist in 1.11.
* the emails of all users were manually verified to not be subject to [this regression](https://github.com/go-gitea/gitea/issues/19897)
An attempt was made to run gitea doctor before the upgrade only to realize that it was not available in 1.11
Following the HOWTO Gitea upgrades, a guide for admins
I'll assist Raphaël in upgrading a Gitea instance running 1.11.0+rc1-23-g42663a687 to 1.16.8.
It is an ancient installation that was never upgraded. The plan is to try an upgrade using a backup so as to detect problems without disturbing the production instance.
Sandboxed upgrade
gitea migrate
verify it does no migration with select * from version == 118gitea doctor --all
Production upgrade
Gitea upgrade from 1.11.x to 1.16.8to Gitea upgrade from 1.11.0+rc1-23-g42663a687 to 1.16.8 8 months agoIt seems to work but the doctor found errors.
bug in the doctor command (fixed here) will likely be backported. It fails three checks but the database has no oauth2 configured so it does not really matter.
these are because the associated branches were removed but the PR contain the commits and otherwise look good. The doctor should not issue a warning in this case.
they are empty, they can be left where they are: it is a cache
The doctor should not issue a warning in this case.
The upgrade is completed using the upgrade.sh script with the following changes:
An attempt was made to run gitea doctor before the upgrade only to realize that it was not available in 1.11