https://github.com/sgaunet/gitlab-backup2s3
Backup your gitlab repository to S3
https://github.com/sgaunet/gitlab-backup2s3
backup gitlab golang s3
Last synced: 8 days ago
JSON representation
Backup your gitlab repository to S3
- Host: GitHub
- URL: https://github.com/sgaunet/gitlab-backup2s3
- Owner: sgaunet
- License: mit
- Created: 2022-07-09T14:08:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-09-01T19:37:57.000Z (about 1 month ago)
- Last Synced: 2025-09-01T21:25:29.804Z (about 1 month ago)
- Topics: backup, gitlab, golang, s3
- Language: Go
- Homepage:
- Size: 200 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://goreportcard.com/report/github.com/sgaunet/gitlab-backup2s3)
[](https://github.com/sgaunet/gitlab-backup2s3/releases/latest)


[](https://github.com/sgaunet/gitlab-backup2s3/actions/workflows/linter.yml)
[](https://github.com/sgaunet/gitlab-backup2s3/actions/workflows/coverage.yml)
[](https://github.com/sgaunet/gitlab-backup2s3/actions/workflows/snapshot.yml)
[](https://github.com/sgaunet/gitlab-backup2s3/actions/workflows/release.yml)
[](https://godoc.org/github.com/sgaunet/gitlab-backup2s3)
[](LICENSE)# gitlab-backup2s3
gitlab-backup2s3 is an enhanced docker image to export gitlab projects, encrypt the archive (optional) and save them in a S3.
You can use the binary but it will need some prerequisites :
* [gocrypt](https://github.com/sgaunet/gocrypt) >= v2.0.0 (if you like to encrypt archives with AES)
* [gitlab-backup](https://github.com/sgaunet/gitlab-backup) >= v1.0.0## Version Compatibility
⚠️ **Important Breaking Change** ⚠️
Version 2 of **gocrypt** (v2) introduced AES GCM (Galois/Counter Mode) encryption, which breaks compatibility with files encrypted using version 1 (v1).
- Files encrypted with v1 **cannot** be decrypted with v2
- Files encrypted with v2 **cannot** be decrypted with v1This incompatibility is due to the fundamental change in the encryption mode from v1 to v2. AES GCM provides better security with authenticated encryption but requires a different format that is not backwards compatible.
Version 2 of **gocrypt** is not compatible with version 1. If you have files encrypted with v1, you will need to decrypt them using the v1 version of **gocrypt** before you can use them with v2. Version 2 of gitlab-backup2s3 uses v2 of gocrypt.
Version 1 of **gitlab-backup2s3** is compatible with version 1 of **gocrypt**.## Configuration
It needs some environement variables to run:
* GOCRYPT_KEY (if you want to encrypt archives)
* POSTBACKUP (if you want to encrypt archives, set it to: gocrypt enc --i %INPUTFILE% )
* GITLAB_TOKEN
* GITALB_URI (if the endpoint differs from https://gitlab.com)
* GITLABPROJECTID: id of the project to export
* GITLABGROUPID: id of the group to export (will export all sub projects)
* DEBUGLEVEL: info by default
* TMPDIR: /tmp by default
* LOCALPATH: if you want to export archives locally (let empty if you prefer to copy archives to s3)
* S3ENDPOINT: Example https://s3.eu-west-3.amazonaws.com or http://localhost:9090 for a local minio instance
* S3REGION: region of s3
* S3BUCKETNAME
* S3BUCKETPATH
* AWS_SECRET_ACCESS_KEY: not mandatory if you associate an IAM role to the pod or ec2
* AWS_ACCESS_KEY_ID: not mandatory too
* EXPORT_TIMEOUT_MIN: default timeout export in minutes (default "10")# Development
This project is using :
* Golang
* [task for development](https://taskfile.dev/)
* docker
* [docker buildx](https://github.com/docker/buildx)
* docker manifest
* [goreleaser](https://goreleaser.com/)
* [pre-commit](https://pre-commit.com/)There are hooks executed in the precommit stage. Once the project cloned on your disk, please install pre-commit:
```
brew install pre-commit
```Install tools:
```
task dev:install-prereq
```And install the hooks:
```
task dev:install-pre-commit
```If you like to launch manually the pre-commmit hook:
```
task dev:pre-commit
```## Example of deployment
### raw kubernetes manifests
In the [deploy/k8s folder](deploy/k8s/), you will find manifests to deploy a cronjob in kubernetes.
### helm
Another github project contains the helm chart. This is [https://github.com/sgaunet/helm-gitlab-backup2s3](https://github.com/sgaunet/helm-gitlab-backup2s3), check the README.
[Configuration of the helm chart is available here.](https://github.com/sgaunet/helm-gitlab-backup2s3/blob/main/charts/gitlab-backup2s3/README.md)