Hi. I self-host gitea in docker and have a few repos, users, keys, etc. I installed forgejo in docker and it runs, so I stopped the container and copied /var/lib/docker/volumes/gitea_data/_data/* to /var/lib/docker/volumes/forgejo_data/_data/, but when I restart the forgejo container, forgejo doesn't show any of my repos, users, keys, etc.
My understanding was the the current version of forgejo is a drop-in replacement for gitea, so I was hoping all gitea resources were saved to its docker volume and would thus be instantly usable by forgejo. Guess not. :(
Does anyone have any experience migrating their gitea instance to forgejo?
21 Comments
neo@lemmy.hacktheplanet.be · 7 pts · 2y
I recently did a bare metal migration from Gitea to Forgejo using NixOS, maybe this info is useful if you use SQLite (which I believe is the default): the SQLite database filename for Gitea is gitea.db and for Forgejo it’s forgejo.db so I had to do a rename. Before renaming I ended up with an empty Forgejo instance. Either way I hope you figure it out in the end. Good luck!
mike_wooskey@lemmy.d.thewooskeys.com · 1 pts · 2y
Thanks, I'll try that.
mike_wooskey@lemmy.d.thewooskeys.com · 2 pts · 2y
Unfortunately that didn't work for me.
poVoq@slrpnk.net · 5 pts · 2y
Why this backwards way of migrating? The recommended way to to replace the Gitea docker image with the Forgejo one and leave everything else in place. Maybe make a backup before that you can revert to in case something goes wrong though.
catloaf@lemm.ee · 4 pts · 2y
That's essentially what they did.
poVoq@slrpnk.net · 4 pts · 2y
You have a very loose definition of "essentially". I can see easily see multiple ways of the OP's copy approach failing while swapping out the container in place would not.
mike_wooskey@lemmy.d.thewooskeys.com · 1 pts · 2y
Can you share some of them so I might have an idea what to try to do differently?
poVoq@slrpnk.net · 2 pts · 2y
You need to share more details about your setup, but as others have already mentioned, it could be an database issue, because usually Gitea is configured to use a Postgresql database.
Also make sure you don't combine an upgrade with a migration, the Gitea and Forgejo versions need to be roughly the same. Especially around the 1.20 version there was a need to change the folder structure before upgrading.
mike_wooskey@lemmy.d.thewooskeys.com · 1 pts · 2y
Thanks for that info. I did combine an upgrade (1.20 to 1.21) with the migrations, but I guess I lucked into it working. My problem was that the container's path to the migrated gitea volume was incorrect.
mike_wooskey@lemmy.d.thewooskeys.com · 3 pts · 2y
That is what I did. And it didn't work.
JASN_DE@lemmy.world · 4 pts · 2y
What are you using as a database? Also, from which Gitea version to which Forgejo version did you attempt the migration?
mike_wooskey@lemmy.d.thewooskeys.com · 1 pts · 2y
Both gitea and forgejo are using sqlite3. Gitea 1.20.0, Forgejo 1.21.
Oisteink@lemmy.world · 3 pts · 2y
Can you see the data you copied inside the container? I’m quite sure you either don’t have the volume mounted, or the config files refers to a different folder than the gitea one did. Did your gitea container store data in sqlite as you are copying raw files rather than migrating a database?
I’d go with lxc instead of containers if you don’t fully understand docker. Overhead isn’t much different and you get a “normal server” where you can drop in forgejo to replace gitea
mike_wooskey@lemmy.d.thewooskeys.com · 2 pts · 2y
That led me to my problem! I did have the volume mounted, but the container's path was incorrect: Forgejo was recreating it's resource files as a new install because where it was looking for them, they didn't exist.
Thanks!
justdoitlater@lemmy.world · 2 pts · 2y
Why migrate from gitea to forgejo?
neo@lemmy.hacktheplanet.be · 10 pts · 2y
https://forgejo.org/faq/#what-is-the-difference-between-forgejo-and-gitea more specifically https://forgejo.org/compare-to-gitea/
justdoitlater@lemmy.world · 2 pts · 2y
Thx! Will prob migrate as well!!
anzo@programming.dev · 0 pts · 2y
No experience, but saw gorgeous has a guide to migrate. Their latest Blogpost states to do that ASAP coz they're going to stop keeping the drop-in 1:1 replacement to advance in their cool feature set ;)
lal309@lemmy.world · -1 pts · 2y
Okay so your post inspired me to make the switch. All I had to do was switch out the image to the forgejo one. Everything worked right away. To try to make things as clean as possible, I went ahead and renamed my bind volume paths and app.ini stuff from gitea to forgejo but no matter what I tried, once I started the container, the container would create a gitea directory with a new app.ini. I even tried to run the forgejo compose on another host and the app still creates a gitea directory within the bind mount. Am I doing something wrong. I understand it’s a drop in replacement but I’m sure there’s a way to get a cleaner cut over.
compose.yml
volumes:
Host directories
~/forgejo
How do I keep forgejo from creating this gitea directory? Why doesn’t it create a forgejo directory???
Edit: gitea version was - 1.21.7 and forgejo replacement image is 1.21.7-0
mike_wooskey@lemmy.d.thewooskeys.com · 1 pts · 2y
I don't know if your problem is the same as mine was, but the symptom sounds the same.
The docker-compose.yaml file shown in the Forgejo documentation for docker installation shows this mount:
For me, Forgejo installed and created new resource files in
/dataand ignored the resource files gitea alread made.I changed the volume to:
Forgejo then recognized the gitea resources.
lal309@lemmy.world · 1 pts · 2y
Not quiet. I was running gitea before so my mount was ./gitea:/data but since switching over to forgejo, I renamed my ./gitea directory to ./forgejo. Adjusted my compose file to have a mount of ./forgejo:/data.
Now inside of that renamed forgejo directory, there are a bunch of gitea references and even one more directory called gitea. When I migrated everything worked right away but since I wanted a cleaner transition, I renamed and switched all gitea references to forgejo but went I brought the stack back online, it went belly up.
As a troubleshooting step, I recreated my compose file and created a new empty ./forgejo on a different machine just to see what a new and fresh install would look like and the forgejo stack itself created all kinds of gitea references and gitea directory once I brought it up. So to fix my original deployment, I reverted all the references back from forgejo to gitea and everything worked again.
For fun, I went out to codeberg to look at the Dockerfile and saw that they had a bunch of gitea things within their own Dockerfile so nothing I can do for now