I have installed Gitea through Opalstack control panel and I have been using it for quite some time now. The version installed is 1.8.3+2. At some point I needed some feature that I realized was available in current version of Gitea but not in 1.8.3+2, but was reluctant to try an update as I have a lot of projects on it and don't want to mess it up. Hence the question:
What is the proper way to upgrade Gitea that was installed from Opalstack control panel? (besides the mandatory backup of course)

TIA
Panayotis

  • sean replied to this.

    pkouvarakis to upgrade Gitea:

    1. Make a backup of your app. 🙂

      cd ~/apps
      tar czf ~/appname_backup.tar.gz appname
    1. Rename the old Gitea binary:

      cd ~/apps/appname
      mv gitea gitea.old
    1. Download the new Gitea linux-amd64 binary. I recommend using the downloads on Github at https://github.com/go-gitea/gitea/releases as the speed is much better:

      wget -O gitea https://github.com/go-gitea/gitea/releases/download/v1.16.6/gitea-1.16.6-linux-amd64 
    1. Set execute permission on the new binary:

      chmod 700 gitea
    1. Restart the app:

      ./stop
      ./start

    The initial startup might take a little longer than usual if Gitea detects that a database migration is needed for the upgrade, but once it is up and running you're finished! 🏁

    Thank you for your quick reply.

    Upgrade worked like a charm.
    For anyone reading this, in Opalstack, Gitea is configured to use Sqlite database, so backing up application files also backs up the database. If for some reason you have manually switched to MariaDB or Postgres you should also backup your database as well (just in case migration goes wrong).

    Panayotis

    8 months later

    FYI: It looks like the latest version of Gitea (1.17.3) requires Git 2.x; after upgrading, running ./stop and ./start did not actually produce any errors, but I was getting a gateway error when browsing the website. I eventually found an error in the logs (~/logs/apps/{gitea-app-name}/gitea.log) saying as much about Git 2.x being required.

    So, I used @sean's guide for upgrading Git (I'm on one of the CentOS 7 servers mentioned in this post) to upgrade to the latest version (2.39.0), added $HOME/opt/bin to my .bash_profile, and ran ./stop and ./start again. The Gitea website was now working and checking the gitea.log file shows that a migration happened. Hooray!

    Not sure that this will work perpetually since only my .bash_profile has the new git binary available, so I'll just have to see if the website stops working after a long while. If it doesn't work, I've found that I should also be able to modify the path Gitea looks for Git by modifying ~/apps/{gitea-app-name}/custom/conf/app.ini and setting the following INI values to configure Git, then stopping/starting Gitea again:

    [git]
    PATH = "~/opt/bin/git"

      davidmiles

      Turns out, I don't think that the .bash_profile was working because I started receiving gateway errors shortly thereafter -- more than likely because the crontab installed will attempt to start Gitea every 10 minutes on the 7th minute. But, I did successfully update my app.ini file as I mentioned in my last post and that seems to be working as expected now! 🙂

      2 years later

      Hmm...I tried updating Gitea to the latest version (1.22.1) and found out that yep, I needed to update to a newer version of Git. So I followed @sean's guide that @davidmiles linked to, upgraded to 2.29.2, made the changes he recommended to .bash_profile and app.ini and I am still getting a "502 Bad Gateway" error. My log file is showing nothing useful. Any ideas as to where to look next/what to check next?

      Edit: I did wget the gitea-1.22.1-linux-amd64 version of Gitea.

      • sean replied to this.

        kjodle your app's gitea.log located under ~/logs/apps/NAME_OF_APP/ captures output from Gitea, look there for possible errors.

        I made a few mistakes and rectified them, now I'm down to this error:

        2024/07/25 22:34:52 routers/init.go:73:mustInitCtx() [F] code.gitea.io/gitea/modules/git.InitFull(ctx) failed: git not found: exec: "~/opt/bin/git": stat ~/opt/bin/git: no such file or directory

        So it seems to think that it can't find git? Am I reading that correctly?

        As far as I can tell, the new version of git is installed and running:

        $ git --version
        git version 2.29.2

        And it is present where it should be:

        ls ~/opt/bin -hl
        total 73M
        -rwxr-xr-x. 135 kjodle kjodle 16M Jul 25 22:20 git
        -rwxr-xr-x. 2 kjodle kjodle 160K Jul 25 22:20 git-cvsserver
        -rwxr-xr-x. 1 kjodle kjodle 392K Jul 25 22:20 gitk
        -rwxr-xr-x. 135 kjodle kjodle 16M Jul 25 22:20 git-receive-pack
        -rwxr-xr-x. 2 kjodle kjodle 8.5M Jul 25 22:20 git-shell
        -rwxr-xr-x. 135 kjodle kjodle 16M Jul 25 22:20 git-upload-archive
        -rwxr-xr-x. 135 kjodle kjodle 16M Jul 25 22:20 git-upload-pack

        and the end of my app.ini file contains the path:

        [git]
        PATH = "~/opt/bin/git"

        Running whereis git gives me the following:

        git: /usr/bin/git /home/kjodle/opt/bin/git /usr/share/man/man1/git.1.gz

        So everything seems it's where it should be, but nothing is clicking at this point, either for me or for Gitea.

        • nick replied to this.

          kjodle Hi, can you please try using only absolute paths in all config files (eg app.ini) here and then try again?

          Thanks @nick! That worked, for some odd reason. We are back in business!

          • nick replied to this.

            kjodle You're welcome! It's always a good idea to stick to absolute paths in config files.

            I'll keep that in mind and save myself some worry down the road.

            Mastodon