I’m a gitea user for a long time now. Gitea is a nice application to build your own light and fast version of git hosting services like GitHub or GitLab.
Gitea has one problem thought. It doesn’t update automatically. A issue for that is open nearly 2 years: https://github.com/go-gitea/gitea/issues/518#issuecomment-441742904
If there is one thing that I really hate, it is that a security sensible web application doesn’t update automatically. Because of that I have begun to write a update script for gitea before 4 months.
That script has updated my gitea instance multiple times now and as I can see, that many users have the same problem (a german blog post from me is my most visited article from outside germany), I want to show you my solution.
As I mentioned - I am no fan of manual upgrades - because of that I write many auto update scripts for my own systems. This scripts often haven’t been tested on other systems and may contain ugly code. I am open for the creation of issues or pull requests which optimise my code. You should definitely check the code out and make sure to review it before using it.
Some creators - e.g. the person behind kanboard - have a strong option against auto updates. There are good reasons for that too - you may not want to crash your application because of a faulty upgrade. I recommend auto updates only if you create auto backups, too.
I have published the actual version to github: https://github.com/CMiksche/gitea-auto-update
The script was made for a Debian and Arch Linux Systems - I haven’t tested it on other systems but you will definitely encounter errors if you wan’t to use it on Windows, MacOS or a Linux System without systemd (i make bash calls to restart the gitea service). You may need to modify the script to work on your system.
If the gitea upgrade changes the template files the automatic update may will destroy your custom design because it is a really simple script and doesn’t check that.
How to use it⌗
The usage of my script is easy (please read the paragraphs over this first - it won’t work without modifying it if you have no gitea service or no systemd):
Install my script on the system:
pip install gitea-auto-update
Create a settings.ini file:
[Gitea] 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 tmpDir=/tmp/ buildFromSource= sourceDir= logFile=update.log
- Change the variables in the settings.ini file
- Enter the command
gite-auto-update --settings=/path/to/settings.iniin your commandline to test the first upgrade
- If you want to schedule your updates, edit your
/etc/crontabfile and add a call the the script
That’s it. Please write a issue if my script doesn’t works. I am caring if people want to use my script ;-)