harness / gitness

Gitness is an Open Source developer platform with Source Control management, Continuous Integration and Continuous Delivery.
https://gitness.com
Apache License 2.0
31.96k stars 2.79k forks source link

How can I backup my repositories? #3436

Closed matheusoreis closed 7 months ago

matheusoreis commented 7 months ago

I work in a company that doesn't use any versioning services because they are web based, I discovered Gitness these days and I need to make backups of project files to an internal server, how can I get the folders where the repository files are?

I made a docker-compose.yaml so I could use gitness.

image

I tried using the docker cp command but it did basically what docker-compose.yaml did.

I'm new to docker.

htcosta commented 7 months ago

You should be able to backup your data by copying the contents of “/home/gitness/data” in your host (not the container).

Please read : https://docs.gitness.com/administration/configuration https://docs.docker.com/storage/bind-mounts/

I am not sure if gitness already has this functionality on the UI/CLI, but and export or import field under the Administration tab / CLI flag could be added to add this extra functionality, it’s a easy implementation.

matheusoreis commented 7 months ago

It's not there, I want to have access to the source code of the projects, is that possible?

bradrydzewski commented 7 months ago

Git repositories are stored on disk at /data inside the container. Based on the configuration you posted, you are mounting /data (inside the container) to /home/gitness/data (outside the container). So you would backup /home/gitness/data on your host to backup Gitness. To restore a Gitness backup, you would simply restore the contents of the disk back to /home/gitness/data

If you have any follow-up questions you can post to our Slack channel https://docs.gitness.com/support#slack

34code commented 2 months ago

I've been backing up /home/gitness nightly.. Now its the moment of truth to recover from backup.. gonna test today and report back if above worked.. I'm particularly curious since my backup medium (hetzner storage box) does not support symlinks for some reason..

mv: cannot create symbolic link '/root/backup/08-02-2024/repos/f1/in/chorootih83xv8es9ix26r2c74pq4w4b2x9cx3.git/hooks/pre-receive': Operation not supported
34code commented 2 months ago

I can confirm it works! Just needed to restart container after moving back up sqlite db and repos to /home/gitness!