code.gitea.io/gitea@v1.22.3/docs/content/installation/upgrade-from-gitea.en-us.md (about) 1 --- 2 date: "2021-09-02T16:00:00+08:00" 3 title: "Upgrade from an old Gitea" 4 slug: "upgrade-from-gitea" 5 sidebar_position: 100 6 toc: false 7 draft: false 8 aliases: 9 - /en-us/upgrade-from-gitea 10 menu: 11 sidebar: 12 parent: "installation" 13 name: "Upgrade From Old Gitea" 14 sidebar_position: 100 15 identifier: "upgrade-from-gitea" 16 --- 17 18 # Upgrade from an old Gitea 19 20 Follow below steps to ensure a smooth upgrade to a new Gitea version. 21 22 ## Check the Changelog for breaking changes 23 24 To make Gitea better, some breaking changes are unavoidable, especially for big milestone releases. 25 Before upgrading, please read the [Changelog on Gitea blog](https://blog.gitea.com/) 26 and check whether the breaking changes affect your Gitea instance. 27 28 ## Verify there are no deprecated configuration options 29 30 New versions of Gitea often come with changed configuration syntax or options which are usually displayed for 31 at least one release cycle inside at the top of the Site Administration panel. If these warnings are not 32 resolved, Gitea may refuse to start in the following version. 33 34 ## Backup for downgrade 35 36 Gitea keeps compatibility for patch versions whose first two fields are the same (`a.b.x` -> `a.b.y`), 37 these patch versions can be upgraded and downgraded with the same database structure. 38 Otherwise (`a.b.?` -> `a.c.?`), a newer Gitea version will upgrade the old database 39 to a new structure that may differ from the old version. 40 41 For example: 42 43 | From | To | Result | 44 | --- | --- | --- | 45 | 1.4.0 | 1.4.1 | ✅ | 46 | 1.4.1 | 1.4.0 | ⚠️ Not recommended, take your own risk! Although it may work if the database structure doesn't change, it's highly recommended to use a backup to downgrade. | 47 | 1.4.x | 1.5.y | ✅ Database gets upgraded. You can upgrade from 1.4.x to the latest 1.5.y directly. | 48 | 1.5.y | 1.4.x | ❌ Database already got upgraded and can not be used for an old Gitea, use a backup to downgrade. | 49 50 **Since you can not run an old Gitea with an upgraded database, 51 a backup should always be made before a database upgrade.** 52 53 If you use Gitea in production, it's always highly recommended to make a backup before upgrade, 54 even if the upgrade is between patch versions. 55 56 Backup steps: 57 58 * Stop Gitea instance 59 * Backup database 60 * Backup Gitea config 61 * Backup Gitea data files in `APP_DATA_PATH` 62 * Backup Gitea external storage (eg: S3/MinIO or other storages if used) 63 64 If you are using cloud services or filesystems with snapshot feature, 65 a snapshot for the Gitea data volume and related object storage is more convenient. 66 67 After all of steps have been prepared, download the new version, stop the application, perform a backup and 68 then start the new application. On each startup, Gitea verifies that the database is up to date and will automatically 69 perform any necessary migrations. Depending on the size of the database, this can take some additional time on the 70 first launch during which the application will be unavailable. 71 72 ## Upgrade with Docker 73 74 * `docker pull` the latest Gitea release. 75 * Stop the running instance, backup data. 76 * Use `docker` or `docker-compose` to start the newer Gitea Docker container. 77 78 ## Upgrade from package 79 80 * Stop the running instance, backup data. 81 * Use your package manager to upgrade Gitea to the latest version. 82 * Start the Gitea instance. 83 84 ## Upgrade from binary 85 86 * Download the latest Gitea binary to a temporary directory. 87 * Stop the running instance, backup data. 88 * Replace the installed Gitea binary with the downloaded one. 89 * Start the Gitea instance. 90 91 A script automating these steps for a deployment on Linux can be found at [`contrib/upgrade.sh` in Gitea's source tree](https://github.com/go-gitea/gitea/blob/main/contrib/upgrade.sh). 92 93 ## Take care about customized templates 94 95 Gitea's template structure and variables may change between releases, if you are using customized templates, 96 do pay attention if your templates are compatible with the Gitea you are using. 97 98 If the customized templates don't match Gitea version, you may experience: 99 `50x` server error, page components missing or malfunctioning, strange page layout, ... 100 Remove or update the incompatible templates and Gitea web will work again.