[SOLVED] How to backup Gitea installed on FreeBSD from ports?

The documentation is unclear here, but I would gladly help improving the docs!

Anyway, after I have installed gitea from ports, I see that the data is installed into the /var/db/gitea folder
Running the gitea dump command throws the following error message:

$ gitea dump  
2018/06/04 17:22:50 [W] Custom config '/usr/local/sbin/custom/conf/app.ini' not found, ignore this if you're running first time
2018/06/04 17:22:50 [...s/setting/setting.go:943 NewContext()] [E] Failed to create '/usr/local/sbin/custom/conf/app.ini': mkdir /usr/local/sbin/custom: permission denied

This error message is not important though, as my question is, can I just rsync the whole folder to another location? Or even better, is it possible to use a zfs snapshot of that folder? Are there any additional steps?

Hi @olavgg,

The dump command has an option to pass a path to where your config is ex. gitea dump -c /path/to/config/app.ini.

What the dump command does it is puts all the files from the Gitea directory into a zip including a dump of the DB. So to answer your question, yes you can rsync the whole folder to another location (you’ll need dump your DB in addition to rsync and copy it elsewhere as well).

Hope this helps,

1 Like

Great! Thank you for the information. As I use SQLite I see it would be unsafe to use rsync, but a ZFS snapshot is atomic and should work fine.

I guess for those who use MySQL or PostgreSQL, there are no consistency issues with having seperate data storage strategies as backup for either isn’t atomic? Example: If you take backup of the data folders now and 15 minutes later take a backup of the SQL database, that will never cause a problem?

Yes, please don’t rsync active DB files. You’ll need to dump the DB first.

In regards to your question if you backup datafolders & DB at different time there is a chance of inconsistency in the data (ex. If backup the DB and then a user pushes git data, then backup data. Then the push would be missing from your activity feed.)

1 Like

Thank you for yet another good answer! :slight_smile:

Glad to hear things worked out. I’m going to lock this topic now, but if you have any other questions please feel free to open another one.