Skip to content
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

Updater Command #17405

Closed
Speiger opened this issue Oct 22, 2021 · 12 comments
Closed

Updater Command #17405

Speiger opened this issue Oct 22, 2021 · 12 comments
Labels
topic/ui-interaction Change the process how users use Gitea instead of the visual appearance type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@Speiger
Copy link

Speiger commented Oct 22, 2021

Feature Description

Hello,

I would love a small quality of life change to gitea.
Updating is a pain when you are not really sure of how to work with linux or command line.
As of right now, from what i was told/found, you have to download the binaries, replace it with the original and restart.

The annoying part is to find out what exactly you have to type in to get to that point, and hoping you are not breaking something in the process.

What I wish that would exists is a command called: "gitea update -####" (# => version number)
where it would download the desired gitea version and installing a new one. You still have to manually restart gitea that I have no problem with because that's quite easy.
(Maybe for extra security it throws the dump command before hand too.. but that is debateable)

But I wonder why this doesn't already exists?
It reduces the possibility of issues quite a bit, especially to people who are new to linux and rather stay on a existing version and not fix security flaws because they are scared to update or delay it because they don't want to deal with the extra steps.

Any opinion on this?

Screenshots

No response

@wxiaoguang
Copy link
Contributor

Is it really necessary? If you use some package managers, or use Docker, it's much easier to update, just one command.

Even if you write a script like wget "https://..../gitea-$version.tar.gz"; rm gitea; tar -xf ... it is still very easy.

@Speiger
Copy link
Author

Speiger commented Oct 22, 2021

@wxiaoguang
What package manager?
How do I even get that one?
I just want to make sure my gitea is up to date. It took me 30-50 minutes to achieve that on a small patch?
And I don't have a docker and my system most likely doesn't support it?

You are clearly very experienced linux user on the command line.
But someone who is new to linux and wants to try this light weight simple github replacing solution is going to have to get through a mess of information he/she has to try to understand and hopefully get it to update.

The likelyhood of people ragequitting or set and forget after the first update completed is pretty high...
Heck i am 5 versions at least behind because I know what I have to deal with and rather wait for a "bigger" patch that I am interested in so it is worth my time... So is it really necessary from that point of view?

Small after edit: For you it might be simple. But if it is easier to update the entire server then gitea itself then I think there is a problem. (apt update & apt upgrade vs what gitea requires...)

@noerw
Copy link
Member

noerw commented Oct 22, 2021

Due to the many different ways gitea can be deployed, adding a gitea upgrade subcommand isn't feasible.

What is doable is adding a script that simplifies this process into the contrib/ folder of this repo.

For example, here's a barebones script I use for updating plain no-package-manager installations on linux with systemd. (disclaimer: I personally won't provide further support for this.)
It should work without further knowledge when you adjust the variables near the top and have the necessary packages installed.
Still I highly recommend having deeper knowledge about the underlying system when operating a service like gitea on it :)

#!/bin/bash
set -e

# this is an upgrade script, for gitea deployed on linux as systemd service
# depends on: curl, xz, sha256sum, gpg
# assumes to be run by the gitea user.
# make changes to the variables below for your local setup

giteaversion=1.15.5
giteabin=/usr/local/bin/gitea
giteahome=/var/lib/gitea
giteauser="git"
giteacmd="sudo -u $giteauser $giteabin -c /etc/gitea/app.ini -w $giteahome"
binname=gitea-${giteaversion}-linux-amd64

# download new binary
binurl="https://dl.gitea.io/gitea/${giteaversion}/${binname}.xz"
echo downloading $binurl
cd $giteahome # needed for gitea dump later
curl -sSfL "$binurl" > ${binname}.xz
curl -sSfL "${binurl}.sha256" > ${binname}.xz.sha256
curl -sSfL "${binurl}.asc" > ${binname}.xz.asc

# validate checksum & gpg signature (exit script if error)
sha256sum -c ${binname}.xz.sha256
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --verify ${binname}.xz.asc ${binname}.xz
rm ${binname}.xz.{sha256,asc}

# unpack binary + make executable
xz -d ${binname}.xz
chmod +x $binname

# stop gitea, create backup, replace binary, restart gitea
$giteacmd manager flush-queues
systemctl stop gitea
$giteacmd --version
$giteacmd dump
mv -fb $binname $giteabin
systemctl start gitea

@Speiger
Copy link
Author

Speiger commented Oct 22, 2021

@noerw yeah that is a reason why it isn't supported.
But honestly even that could be addressed quite easily since Gitea has a setup userinterface and a config.
Allow the optional addition of a distribution URL with validation button that it works as expected.
If this field is not set then the command "update" wouldn't work and say "nothing configured to update"

About this script, yeah that is a nice script that at least can be worked with.

And ofc you should learn more or at least the essentials, but honestly, trying to blindly filter out all the information that is provided, blindly meaning no real knowledge, is kinda hard. But it should be done.
But if I had done it that way I wouldn't have a gitea server. So that's a point too.

I mean I could expand this much much further, but that is outside of the scope at this point.

Small edit: This is more of a user-friendliness request...

@wxiaoguang
Copy link
Contributor

For update checker, we already have it in the main branch: #17212 Add simple update checker to Gitea.

@noerw noerw added type/proposal The new feature has not been accepted yet but needs to be discussed first. topic/ui-interaction Change the process how users use Gitea instead of the visual appearance labels Oct 22, 2021
@Speiger
Copy link
Author

Speiger commented Oct 22, 2021

@wxiaoguang so can i hit a "update button" when i enable this "update checker" or use a "update command"?
Because then this could maybe be expanded if you already have a system in place that is already not feasible?
(I know these weren't your words. Just wanted to point this out...)

@wxiaoguang
Copy link
Contributor

As explained above, if you installed Gitea with some package managers like apt/yum/dnf/snap or Docker, you can not make the app update itself, it will break the package management badly.

And remember that Gitea runs in Windows, a running Windows app can not update itself easily, it needs some hacky method.

In a short word: gitea update is not feasible.

@Speiger
Copy link
Author

Speiger commented Oct 22, 2021

As explained above, if you installed Gitea with some package managers like apt/yum/dnf/snap or Docker, you can not make the app update itself, it will break the package management badly.

Since when is it possible to install gitea with "apt". When I installed it that wasn't possible... From asking and trying...

@Speiger
Copy link
Author

Speiger commented Oct 22, 2021

Then this whole issue is no longer needed if apt support is a thing...

@delvh
Copy link
Member

delvh commented Oct 22, 2021

I haven't heard of apt support either, what could instead be meant is snap support.
If you are running Ubuntu, the command provided here might help:
https://github.com/go-gitea/gitea/blob/main/docs/content/doc/installation/from-package.en-us.md#canonical-snap

@techknowlogick
Copy link
Member

Yeah, our snap is auto updating

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 29, 2021

More work had been done in this issue, so this issue can be closed I think.

PR and documents are welcome

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui-interaction Change the process how users use Gitea instead of the visual appearance type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

5 participants