Migrating Forgejo and Gitea
This section describes migrating Forgejo/Gitea data between two Momod servers.
Forgejo (Gitea) has backup and restore documentation. We can move our Forgejo data between Momod servers using that method.
- Stop Forgejo
- Switch to user running Forgejo
- Run gitea dump
This should generate a file in /tmp with a name like ‘forgejo-dump-1694445847.zip’. Chown the file to yourself and move it to your home directory ready for download. From your home directory on the server and substituting USER with your own user account name:
It is recommended not to trust the database dump in this file and instead generate one with database native tools.
To generate database dump with mariadb tools:
Enter the forgejo_db_password variable you have set on the old server.
Copy these two files, the forgejo-dump and forgejo-db, to the new server.
Restoring Forgejo
This very much a manual process of copying data to the correct location and restoring the database dump.
Before starting copy the forgejo-dump and forgejo-db to the new server, then stop Forgejo on that server too.
Unzip the dump and move the contents to the right locations:
Restore the database dump and restart Forgejo
This will also have copied the gitea.ini file containing the old servers FQDN, if your FQDN has changed you need to rerun the Forgejo role. Either by editing play/dev.yml and running that play or by running the update play:
You should now be able to log into Forgejo - you can check the base url is now set to the correct FQDN in Site Administration section of Forgejo.