Skip to content

sgaunet/gitlab-backup

Repository files navigation

Go Report Card

gitlab-backup

This tool can be used to export project or every projects of a gitlab group. It uses the API of gitlab to get an archive of exported project.

Two options to save the exported projects:

  • local folder
  • s3

There is also the possibility to specify pre/post backup hooks.

Usage by configuration file

Example:

# debuglevel: "info"
gitlabGroupID: XXXX
gitlabProjectID: YYYY
localpath: "/backup"
gitlabtoken: 
# gitlaburi: https://gitlab.com
# tmpdir: /tmp
hooks:
    prebackup: ""
    postbackup: ""
s3cfg:
  endpoint: "http://localhost:9090"
  bucketName: "ephemeralfiles"
  bucketPath: "test"
  region: "us-east-1"
  accesskey: ""
  secretkey: ""

parameters of the configuration file can be override by environment variable

Launch the program: gitlab-backup -c configuration.yaml

Usage by environment variable

  AWS_ACCESS_KEY_ID string
  AWS_SECRET_ACCESS_KEY string
  GITLABGROUPID int
         (default "0")
  GITLABPROJECTID int
         (default "0")
  GITLAB_TOKEN string
  GITLAB_URI string
         (default "https://gitlab.com")
  LOCALPATH string
         (default "")
  POSTBACKUP string
         (default "")
  PREBACKUP string
         (default "")
  S3BUCKETNAME string
         (default "")
  S3BUCKETPATH string
         (default "")
  S3ENDPOINT string
         (default "")
  S3REGION string
         (default "")
  TMPDIR string
         (default "/tmp")

Extended project

Another project can be used to encrypt archives of exported project and send them to s3. It's gitlab-backup2s3 which is using two softwares:

  • gitlab-backup (this project)
  • gocrypt

Development

This project is using :

Use task to compile/create release...

$ task
task: [default] task -a
task: Available tasks for this project:
* build:            Build the binary
* default:          List tasks
* doc:              Start godoc server
* image:            Build/push the docker image
* release:          Create a release
* snapshot:         Create a snapshot release
* update-crt:       Update the crt file