Auto updates for Gitea #175

Closed
opened 2025-11-02 03:12:17 -06:00 by GiteaMirror · 18 comments
Owner

Originally created by @tboerger on GitHub (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.

Originally created by @tboerger on GitHub (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. <bountysource-plugin> --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40431998-auto-updates-for-gitea?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F47456670&utm_medium=issues&utm_source=github). </bountysource-plugin>
GiteaMirror added the type/proposaltype/featuretopic/deployment labels 2025-11-02 03:12:17 -06:00
Author
Owner

@Bwko commented on GitHub (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.

@Bwko commented on GitHub (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.
Author
Owner

@joubertredrat commented on GitHub (Dec 27, 2016):

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

@joubertredrat commented on GitHub (Dec 27, 2016): this auto update will be for all installation options or only install by binary?
Author
Owner

@tboerger commented on GitHub (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.

@tboerger commented on GitHub (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.
Author
Owner

@Bwko commented on GitHub (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.

@Bwko commented on GitHub (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.
Author
Owner

@bkcsoft commented on GitHub (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 😒

@bkcsoft commented on GitHub (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 :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** 😒
Author
Owner

@pgaskin commented on GitHub (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.

@pgaskin commented on GitHub (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.
Author
Owner

@tboerger commented on GitHub (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.

@tboerger commented on GitHub (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.
Author
Owner

@lunny commented on GitHub (Mar 3, 2017):

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

@lunny commented on GitHub (Mar 3, 2017): So let's implment #1101 at first and move this to 1.x.x
Author
Owner

@NotAFile commented on GitHub (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.

@NotAFile commented on GitHub (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.
Author
Owner

@SohnyBohny commented on GitHub (Nov 26, 2018):

There is a RSS feed for blog.gitea.io

@SohnyBohny commented on GitHub (Nov 26, 2018): There is a RSS feed for blog.gitea.io
Author
Owner

@CMiksche commented on GitHub (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 ...

@CMiksche commented on GitHub (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 ...
Author
Owner

@sapk commented on GitHub (Nov 26, 2018):

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

@sapk commented on GitHub (Nov 26, 2018): I could try to implement it with https://github.com/rhysd/go-github-selfupdate
Author
Owner

@4oo4 commented on GitHub (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

@4oo4 commented on GitHub (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
Author
Owner

@tboerger commented on GitHub (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...

@tboerger commented on GitHub (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...
Author
Owner

@sapk commented on GitHub (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.

@sapk commented on GitHub (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.
Author
Owner

@peacepenguin commented on GitHub (Jun 20, 2019):

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

@peacepenguin commented on GitHub (Jun 20, 2019): 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
Author
Owner

@Torstein-Eide commented on GitHub (Sep 27, 2020):

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

@Torstein-Eide commented on GitHub (Sep 27, 2020): I would recommended to use @CMiksche python script for updating https://github.com/CMiksche/gitea-auto-update
Author
Owner

@tboerger commented on GitHub (Dec 19, 2020):

I'm not really involved into Gitea anymore, so I'm closing this issue. If there ist still interest please open a new issue and maybe link to this one for initial discussion. I want to get my issues cleaned up.

@tboerger commented on GitHub (Dec 19, 2020): I'm not really involved into Gitea anymore, so I'm closing this issue. If there ist still interest please open a new issue and maybe link to this one for initial discussion. I want to get my issues cleaned up.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#175