Automating Gitea Updates with Autoupdate

Date: Wed, Mar 8, 2023

Tag(s): Automating Gitea Updates Autoupdate Automatic

Gitea is a lightweight open source Git hosting solution that provides a web interface for managing repositories, user accounts, and access controls. It is written in Go and is designed to be easy to install and configure.

Chapati Systems Autoupdate is a tool that can automatically check for the latest release of Gitea (and other software) on GitHub and download and install it on your server. It requires a configuration file (INI format) that specifies the parameters for updating Gitea, such as:

[Gitea]
update=True
site=https://your-gitea-instance.com/api/v1/version
apiUrl=https://api.github.com/repos/go-gitea/gitea/releases/latest
system=linux-amd64
file=/usr/local/bin/gitea
buildFromSource=False
sourceDir=/home/git/go/src/code.gitea.io/gitea
serviceName=gitea
preUpdateHook=
postUpdateHook=

To use Chapati Systems Autoupdate with Gitea, you need to run it as root user on your server with a command like the following one:

root@server:/opt/config# ./autoupdate --config=/opt/config/gitea.ini

This will read the configuration file from /opt/config/gitea.ini and perform the following steps:

  1. Fetch the latest release information from https://api.github.com/repos/go-gitea/gitea/releases/latest
  2. Compare the current version of Gitea on your server with the latest version available on GitHub
  3. If there is a newer version, download it from GitHub and save it
  4. If specified, run of preUpdateHook before updating Gitea
  5. Stop the service that runs Gitea
  6. Replace the old binary with the new one (or build the binary from source if activated)
  7. Start the service that runs Gitea with the new binary
  8. If specified, run of postUpdateHook after updating Gitea

That’s it! You have successfully updated Gitea using Chapati Systems Autoupdate.

I hope this article helps you understand how Chapati Systems Autoupdate can benefit users who want to keep their Git hosting platform up-to-date.