====== Forgejo - Upgrade ======
Notes and instructions for upgrading [[https://forgejo.org|Forgejo]], the self-hosted lightweight software forge.
===== Upgrading Forgejo (binary) =====
Follow these steps to upgrade a binary (not Docker) Forgejo installation. These instructions are adapted from the [[https://forgejo.org/docs/latest/admin/upgrade/|Forgejo upgrade guide]] and [[https://forgejo.org/docs/latest/admin/installation/binary/|Forgejo installation guide]].
==== 0. Prerequisites ====
SSH to the server with a sudo-capable user account.
==== 1. Back up existing install ====
Switch to the Forgejo user (usually ''git''), and back up the existing Forgejo installation, then flush the queues. Note that you'll need to specify the config file location, which by default is located at ''/etc/forgejo/app.ini''. Once done, switch back to your sudo-capable user.
sudo -i -u git
forgejo dump --config /etc/forgejo/app.ini
forgejo manager flush-queues --config /etc/forgejo/app.ini
exit
==== 2. Download the latest Forgejo binary ====
Check https://forgejo.org/download/ for the latest version. Make sure to change the name depending on your processor architecture (most commonly this would be ''amd64'' or ''arm64'').
wget https://codeberg.org/forgejo/forgejo/releases/download/vXX.Y.Z/forgejo-XX.Y.Z-linux-XXX64
chmod +x forgejo-XX.Y.Z-linux-XXX64
==== 3. Stop Forgejo ====
Stop the running (existing) Forgejo binary.
sudo systemctl stop forgejo.service
==== 4. Copy in the new binary ====
Copy the newly downloaded Forgejo binary over the existing binary.
sudo cp forgejo-x.y.z-linux-xxx64 /usr/local/bin/forgejo
Update the new binary's file permissions.
sudo chmod 755 /usr/local/bin/forgejo
==== 5. Start Forgejo ====
Start the newly-replaced Forgejo binary.
sudo systemctl start forgejo.service
==== 6. Make sure it works ====
Make sure that everything works!