Enable gitea dump on tent with custom rotating backups #234
Reference in New Issue
Block a user
Delete Branch "abonerib/jungle:gitea-dump"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
closes #233
I opted for copying the systemd units with different names instead of overriding the ones from the NixOS module in case upstream changes in NixOS silently break our overrides (e.g. they rename the systemd-unit)
I tested it in weasel, and it seems to work (although I did not have any repos or users):
Caveats:
Thanks for taking a look into this! I also think is a good idea to use our custom service.
We can use an atomic
mvcommand like this (notice date only runs once):If gitea dump fails, you only end up with garbage in the .tmp file, but the mv doesn't run due to the
set -e.Gitea performs the upgrade automatically of the DB from previous versions on start. We cannot restore a previous backup into a new Gitea version, but I think this will be okay for our cases.
I would need to test the restore process in a real scenario. If you already have a working Gitea instance on weasel perhaps that would be the easiest place to test:
05403dbd9btobdf7e16c0dRan these checks in weasel and all seems to work. Feel free to poke around in
weasel:3000. Here is the nuke script:Maybe we could try to restore the
hut/tentGitea instance intoweasel(here is the config: weasel-gitea-test)(My Gitea does not have CI logs / artifacts, so I did not test anything regarding that)
The
gitea doctor checkcommand has found no issues (also passed with--all):Quirks of the backup
In the nix module, the sql database is saved in
/var/lib/gitea/data/gitea.dbwhich is then backed up inside the zip file. This is the whole db, instead of the sql commands that gitea saves in the root of the zip atgitea-db.sql. By copyingdatawe already have the database for free, so we can skip the import of the db from the restore process.I think keeping it this way is fine, since our production db is probably not that big, but I might be wrong.
The same happens with
app.iniwhich is duplicated in thecustomfolder.bdf7e16c0dto83579c729a83579c729atoef0268b87aThanks for taking a look. I renamed the service to just "gitea-backup" and placed it inside a subdirectory so it follows the already existing backups.
I ran this on tent with the current Gitea data and added an extra step to also store the backup in Ceph, so we have:
I think this would be enough. Here is how it looks like after two backups:
I think we have enough space to keep the 7 backups without problems.
Regarding the DB, I would leave it as-is for now.
WIP: Enable gitea dump on tent with custom rotating backupsto Enable gitea dump on tent with custom rotating backupsef0268b87ato8728095799@@ -29,0 +74,4 @@description = "Update timer for gitea-backup";partOf = [ "gitea-backup.service" ];wantedBy = [ "timers.target" ];timerConfig.OnCalendar = config.services.gitea.dump.interval;config.services.gitea->cfg8728095799to5c30975b8b