How to "upgrade" from Gitea to Forgejo (not for the faint of heart!)

https://lemmy.world/post/44345452

How to "upgrade" from Gitea to Forgejo (not for the faint of heart!) - Lemmy.World

Here’s the background: I’d been using Gitea for open source project hosting for a quite a while. So when the Forgejo fork started up, I thought to myself: Eh, I’ll see how that all unfolds and maybe look into it at some point. After all, Forgejo is a soft fork, so I can just switch over whenever. But then Forgejo became a hard fork while I was busy with other stuff, and before I knew it, It seemed too late to switch unless I wanted to lose all my tickets and stuff. Then I saw this post [https://lemmy.world/post/44134491] and read this background [https://www.reddit.com/r/Gitea/comments/yj6ndx/gitea_controversy_timeline/] and decided it was time for me to switch to Forgejo, hard fork be damned. But I’m very stubborn, and I still wanted to keep all of my Gitea data intact. So here’s what I did, and what you could do too: Step one: Create a SQL “migration” that downgrades the Gitea database from the modern version you’re using to the last version that Forgejo supports upgrading [https://forgejo.org/docs/latest/admin/upgrade/from-gitea/], Gitea 1.22.6, from back when Forgejo was still a soft-ish fork. That means you’re effectively rolling back each migration from Gitea 1.25 [https://github.com/go-gitea/gitea/tree/main/models/migrations/v1_25] all the way through 1.24 [https://github.com/go-gitea/gitea/tree/main/models/migrations/v1_24] and 1.23 [https://github.com/go-gitea/gitea/tree/main/models/migrations/v1_23]. When I did this, I used an LLM (specifically MiniMax with OpenCode) to generate the reverse mega-migration, feeding it this very outdated starting point [https://gist.github.com/hinrikus/918a1d3ccb8daa22f5c2fa4b0ee0048f] as inspiration. But I totally understand if not everyone is comfortable with using AI. In fact, I really wasn’t either, but I figured this is a mostly mechanical one-off. If you don’t want to use AI, you can generate the reverse migration manually by combing through the migrations linked above. I did find three mistakes the LLM made: 1. An off-by-one error in UPDATE version ... because the value should be the last migration number (298 in this case) plus one, 2. Some of the steps it generated to back out an individual migration were out of order, e.g. dropping the issue_pin table before copying data out of it, and 3. It apparently missed making one particular column (type in the review table) into an int instead of a varchar. Once I fixed these issues (well, the ones I found ahead of time instead of after the fact), the mega-migration was ready to go. (I’m not including the mega-migration here, because even if it worked for me, I don’t want to be responsible for people fucking up their systems if it doesn’t work for them. I’d much rather people be responsible for fucking up their own systems.) Step two: Backup your Gitea database and files!!! Step three: Stop Gitea and run the mega-rollback-migration against your Gitea database. This effectively downgrades the database to Gitea 1.22.6. You can optionally then deploy the Gitea 1.22.6 binary or container and start it up to poke around the Gitea web UI and verify that the downgrade worked. Then stop Gitea again. Step four: Replace the Gitea binary or container with the last release of Forgejo to support upgrades from Gitea, Forgejo 10.0.3. Start Forgejo and try out the web UI to make sure it’s working. Step five: Upgrade your Forgejo binary or container to the latest release of Forgejo, 14.0.3 at the time of this writing. Restart Forgejo and hopefully enjoy your newly “upgraded” instance, complete with all of your repos and ticket history!

I’m staying with Gitea. They’ve created the Ltd. so they can sell professional support as most businesses will want a proper invoice. I don’t see anything wrong with that. Also, ForgeJo was promising federation which is still a WIP several years later. And, the one time I’ve tried ForgeJo it shit itself when I’ve added an emoji to my username. For some reason Gitea didn’t have any problem with that.
Personally, I think it’s great to have multiple options in this space. I think we can all agree that self-hosting (or using Forgejo/Gitea on a smaller platform, e.g. Codeberg) is preferable to centralizing absolutely everything on Microsoft GitHub.

If you are not a Gitea customer, you are not being informed of security updates in a timely manner:

Gitea repeatedly makes choices that leave Gitea admins exposed to known vulnerabilities during extended periods of time. For instance Gitea spent resources to undergo a SOC2 security audit for its SaaS offering while critical vulnerabilities demanded a new release. Advance notice of security releases is for customers only.

forgejo.org/compare-to-gitea/#security

Also, ForgeJo was promising federation which is still a WIP several years later.

Oh no, it doesn’t do the big feature™. I guess it’s unusable now.

I wish people would realize that software still works and is excellent even without the various flagship features. I use Kubernetes on a single node. I know there are people who use matrix without federation and e2ee because it’s actually a really good chat app, it just struggles with the performance demands of federation, and the e2ee ux isn’t quite there yet.

Comparison with Gitea | Forgejo – Beyond coding. We forge.

Exclusively free software

Has Gitea even given any indication that they want to work on federation themselves?

If you are not a Gitea customer, you are not being informed of security updates in a timely manner

I don’t need a notification of issues, I need a notification of when there’s a new version to roll out. And that can be solved by using things like WatchTower or setting up release notifications on GitHub.

And, of course, a comparison hosted on ForgeJo’s webpage will make it out that they’re “the better choice”.

Also, ForgeJo was promising federation which is still a WIP several years later.

Oh no, it doesn’t do the big feature™. I guess it’s unusable now.

Well, that was the one big distinguishing thing between the two, back when ForgeJo was the new kid on the block. ForgeJo wanted to make it a priority to implement federation.

And I never said it’s unusable - it’s just that I, personally, don’t see any reason to switch from Gitea to ForgeJo.