Gitea: Auto updates for Gitea

Created on 27 Dec 2016  路  17Comments  路  Source: go-gitea/gitea

I would like to integrate an auto-updater for Gitea. This will only work for our prebuilt binaries and our Docker container of course, for everything else we are out of control and the admin is responsible for the update on his own.

The functionality should be added via an build flag so that the regular builds by admins don't get this functionality.

Options

I can think about various options how we can handle this functionality. Below is a list of the options i though about:

1) Provide a app.ini or CLI flag to opt-out from the update process, update the prebuilt binaries and docker containers automatically and do a graceful restart, optionally send a notification to the admins that an update have been applied
2) Provide a app.ini or CLI flag to opt-out from the update process, add a page to the admin view that shows the latest available version and add a button to trigger the upgrade and graceful restart, optionally send a notification to the admins that there is a new version available

Tools

A pretty mature library is already out there in the wild, I would suggest to use https://github.com/inconshreveable/go-update for this. For the hosting of the updates we got the option to use our CDN based https://dl.gitea.io page or the service https://equinox.io/ offered by @inconshreveable.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

kindeployment kinfeature kinproposal

Most helpful comment

We should probably start with a update-button in admin-view, that gives us basic functions like "Check version against server" (.sig-files as well :wink:) and "Update". At a later stage we can add auto-checking and auto-updating, since most likely people will not want to auto-update.

In any case, Auto-Update should be opt-in 馃槖

All 17 comments

Why not add a setting to app.ini? That way you don't have to recompile the binary when you decide to turn on auto updates.

this auto update will be for all installation options or only install by binary?

Why not add a setting to app.ini? That way you don't have to recompile the binary when you decide to turn on auto updates.

Because the functionality will be only available for our pre-compiled binaries and our docker image. Everything else can be built totally different and is not in our control. On top of the build flag there will be a setting to opt-out from this process.

this auto update will be for all installation options or only install by binary?

We can provide it only for our pre-compiled binaries, you never know which build tags and so on another install got.

@tboerger Fair point.
I prefer a third option: same behaviour as option 2 but with an option to automatically update when there's a security/critical (non breaking) update.

We should probably start with a update-button in admin-view, that gives us basic functions like "Check version against server" (.sig-files as well :wink:) and "Update". At a later stage we can add auto-checking and auto-updating, since most likely people will not want to auto-update.

In any case, Auto-Update should be opt-in 馃槖

What happens to the setcap permissions which I use to bind to port 80. When the binary is replaced, these needs to be set again, which needs root.

What happens to the setcap permissions which I use to bind to port 80. When the binary is replaced, these needs to be set again, which needs root.

That's something that needs to be tested, but AFAIK it doesn't replace the entire binary, it's doing a binary diff and merge.

So let's implment #1101 at first and move this to 1.x.x

I think notifications solve a lot of this...

Updating is pretty easy, but I currently have no idea if there is a new version of gitea unless I go and check myself.

There is a RSS feed for blog.gitea.io

I have written a python script to update gitea (but you may need to change the script for your system):

Blog Post: http://blog.m5e.de/gitea/update/upgrade/bash/script/2018/11/26/gitea-auto-update-script.html
GitHub Repo: https://github.com/CMiksche/gitea-auto-update

Maybe a solution until the direct go implementation is finally here - sadly it's nearly two years since this issue was created ...

I could try to implement it with https://github.com/rhysd/go-github-selfupdate

Here's the quick and dirty script I use for auto updates (it assumes that you have gitea as a systemd/init.d service):

https://gist.github.com/4oo4/a53affc5e977bfacfbfa2aed0172ed13

@sapk no, please don't... A github specific updater built into the binary won't be merged since it will anyway break after a migration to selfhosting.

A selfupdating application isn't that easy, and useful for the prebuilt binaries only. Beside that there are other things that also got to be integrated like optin or optout...

@tboerger It support enterprise version so it support custom url. I could try if it already work with gitea or if we need to fork/PR to be compatible.

Here's a script and setup notes on how I configure Gitea to auto-update on Ubuntu 18.04 for a binary install:

https://gist.github.com/peacepenguin/9482c248b3d99e6bd3ccab74826e6923

I would recommended to use @CMiksche python script for updating
https://github.com/CMiksche/gitea-auto-update

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fastidious picture Fastidious  路  3Comments

thehowl picture thehowl  路  3Comments

tuxfanou picture tuxfanou  路  3Comments

flozz picture flozz  路  3Comments

cookiengineer picture cookiengineer  路  3Comments