New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto updates for Gitea #518

Open
tboerger opened this Issue Dec 27, 2016 · 15 comments

Comments

@tboerger
Member

tboerger commented Dec 27, 2016

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.

@Bwko

This comment has been minimized.

Contributor

Bwko commented Dec 27, 2016

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.

@joubertredrat

This comment has been minimized.

Contributor

joubertredrat commented Dec 27, 2016

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

@tboerger

This comment has been minimized.

Member

tboerger commented Dec 27, 2016

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.

@Bwko

This comment has been minimized.

Contributor

Bwko commented Dec 27, 2016

@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.

@bkcsoft

This comment has been minimized.

Member

bkcsoft commented Dec 27, 2016

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 😉) 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 😒

@lunny lunny modified the milestones: 1.2.0, 1.1.0 Feb 5, 2017

@geek1011

This comment has been minimized.

Member

geek1011 commented Mar 2, 2017

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.

@tboerger

This comment has been minimized.

Member

tboerger commented Mar 2, 2017

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.

@lunny

This comment has been minimized.

Member

lunny commented Mar 3, 2017

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

@NotAFile

This comment has been minimized.

NotAFile commented Nov 26, 2018

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.

@SohnyBohny

This comment has been minimized.

Contributor

SohnyBohny commented Nov 26, 2018

There is a RSS feed for blog.gitea.io

@CMiksche

This comment has been minimized.

CMiksche commented Nov 26, 2018

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 ...

@sapk

This comment has been minimized.

Member

sapk commented Nov 26, 2018

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

@4oo4

This comment has been minimized.

4oo4 commented Nov 26, 2018

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

@tboerger

This comment has been minimized.

Member

tboerger commented Nov 27, 2018

@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...

@sapk

This comment has been minimized.

Member

sapk commented Nov 27, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment