this post was submitted on 18 Nov 2023
2 points (100.0% liked)

Self-Hosted Main

515 readers
1 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

For Example

We welcome posts that include suggestions for good self-hosted alternatives to popular online services, how they are better, or how they give back control of your data. Also include hints and tips for less technical readers.

Useful Lists

founded 1 year ago
MODERATORS
 

Hi All

I have a selfhosted Gitea server, and I use it for a lot more than coding. I even do management of document history for my business. I love it.

What I would like to do, is use it backup specific folders on other servers in my homelab.

Say for example my webdev test server: I would like to daily back up /etc/ /var/www/one.example.com/ /var/www/two.example.com/ etc etc

Now my knowledge on Gitea, and Git as a whole, is relatively limited to clone, add, commit, push and pull.

If I setup a user for the server, then insert the ssh pub key. I would like to know, how from the terminal (via SSH to the server), I can create a new repo for folder /var/www/one.example.com/ and then do an initial commit, so that the .git folder is created locally in /var/www/one.example.com/.git/

Then I can set a cronjob to do my daily backups, but still have the magic of full file history.

Also, can you configure a Repo to only keep changes back for say 90 days? (Space saving in the long run).

I know there are a lot of ways to do this, but I have a very good reason for using Git, mainly, it streamlines restoring files at any point in history, and also if I need to fork a website I am developing, I can do it in Git with ease.

Plus it allows me to add other users to a repo for example, and allows us to do branches etc.

Currently I am backing everything up using a script I wrote, and I have a dedicated bare metal that is handling that. I get a .tar.gz for the last 7 days, the last 5 sundays and the last 3 months (1st). But this is starting to take up a lot of harddrive space.

Any advice would kindly be appreciated.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago

I set up a git repo in AWS Code Commit and then I setup a script on a backup VM that I have an external HDD mounted to. I have a cron job which pulls from gitea and then pushes to CodeCommit via a remote server in git.

That gives me a backup of git on the external hdd and externally via aws plus my gitea is backed up twice a week to my truenas.