{"id":19156994,"url":"https://github.com/bertrandmartel/gitlab-backup","last_synced_at":"2025-05-07T07:46:46.964Z","repository":{"id":94808420,"uuid":"77246191","full_name":"bertrandmartel/gitlab-backup","owner":"bertrandmartel","description":":file_folder: Backup script for Gitlab with CRON and docker support","archived":false,"fork":false,"pushed_at":"2018-11-06T23:35:53.000Z","size":5,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T20:17:41.842Z","etag":null,"topics":["backup-script","bash","docker","gitlab"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bertrandmartel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-23T19:21:21.000Z","updated_at":"2024-07-16T12:46:45.000Z","dependencies_parsed_at":"2023-03-13T16:56:51.020Z","dependency_job_id":null,"html_url":"https://github.com/bertrandmartel/gitlab-backup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fgitlab-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fgitlab-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fgitlab-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fgitlab-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bertrandmartel","download_url":"https://codeload.github.com/bertrandmartel/gitlab-backup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252838765,"owners_count":21812082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup-script","bash","docker","gitlab"],"created_at":"2024-11-09T08:36:52.873Z","updated_at":"2025-05-07T07:46:46.956Z","avatar_url":"https://github.com/bertrandmartel.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gitlab Backup script\n\n[![Build Status](https://travis-ci.org/bertrandmartel/gitlab-backup.svg?branch=master)](https://travis-ci.org/bertrandmartel/gitlab-backup) [![](https://images.microbadger.com/badges/version/bertrandmartel/gitlab-backup.svg)](https://microbadger.com/images/bertrandmartel/gitlab-backup) [![](https://images.microbadger.com/badges/image/bertrandmartel/gitlab-backup.svg)](https://microbadger.com/images/bertrandmartel/gitlab-backup)\n\nA dockerized Gitlab backup script to :\n* retrieve all projects for a specific user in a CRON every day\n* backup it\n* remove too old backup (\u003e retaining time)\n\n## Configuration\n\nEdit `vars-template` (environment variables) : \n\n\n| Variable name                    |  description       | default value                                      |\n|----------------------------------|---------------------------------|---------------------------------------|\n| KEY_SSH_RSA                      | SSH RSA key |   |\n| KEY_ECDSA                        | SSH ECDSA key |     |\n| KEY_ED25519                      | SSH ED25519 key  |  |\n| PRIVATE_TOKEN                    | token used to call Gitlab API (personnal access token) | |\n| GITLAB_USERNAME                  | gitlab username for retrieving individual repository | |\n| GITLAB_PASSWORD                  | gitlab password for retrieving individual repository | |\n| GITLAB_DOMAIN                    | Gitlab server domain name   | gitlab.com |\n| GITLAB_PORT                      | port to be used for Gitlab API  | 443 |\n| GITLAB_SSH_PORT                  | ssh port | 22 |\n| PROJECT_MAX_NUMBER               | max number of repos to be backed up | 300 |\n| BACKUP_DIR                       | directory when backup projects are transfered | /home/backup |\n| RETAIN_TIME                      | retaining time in days | 30 |\n\n`KEY_SSH_RSA`,`KEY_ECDSA` and `KEY_ED25519` should be specified to prevent man-in-the-middle attack, you can get those with :\n\n```\nssh-keyscan -p $GITLAB_SSH_PORT $GITLAB_DOMAIN\n```\n\n`PRIVATE_TOKEN` is a personnal access token\n\n## Standalone script\n\n```\nsource vars-template\n./backup.sh\n```\n\n## Docker\n\n```\ndocker run -e \"GITLAB_DOMAIN=my.gitlab.com\" \\\n           -e \"KEY_SSH_RSA=ssh-rsa XXXXXXX\" \\\n           -e \"KEY_ECDSA=ecdsa-sha2-nistp256 XXXXXX\" \\\n           -e \"KEY_ED25519=ssh-ed25519 XXXXXXXXXXXXXXx\" \\\n           -e \"PRIVATE_TOKEN=xZqsf-azsdllqmoaze\" \\\n           -e \"GITLAB_USERNAME=john\" \\\n           -e \"GITLAB_PASSWORD=changeme\" \\\n           -v /home/user/backup:/home/backup bertrandmartel/gitlab-backup\n```\n\n## Docker-compose\n\n```\nsource vars-template\nenvsubst \u003c docker-compose-template.yml \u003e docker-compose.yml\ndocker-compose up\n```\n\n## Docker-cloud\n\n```\nsource vars-template\nenvsubst \u003c stackfile-template.yml \u003e stackfile.yml\n```\n\n* create stack\n```\ndocker-cloud stack crate --name gitlab-backup -f stackfile.yml\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fgitlab-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbertrandmartel%2Fgitlab-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fgitlab-backup/lists"}