Code Monkey home page Code Monkey logo

auto-gitlab-backup's Introduction

auto gitlab Backup

http://sund.la/glup


A script to use omnibus-gitlab's own backup gitlab-rake command on a cron schedule and rsync to another server, if wanted. There is also a restore script available (see below.)

It can backup and copy the Gitlab-CI DB, if configured.

This script is now more omnibus-gitlab centric. Compare your config file with the template! Usage with a source install is possible but not expressly shown here.

Clone

clone to your directory of choice. I usually use /usr/local/sbin

Set up gitlab to expire backups

Change /etc/gitlab/gitlab.rb to expire backups

# backup keep time
gitlab_rails['backup_keep_time'] = 604800

If you use the CI server, enable CI Backup expiration

## Backup settings
  backup:
    path: "tmp/backups"   # Relative paths are relative to Rails.root (default: tmp/backups/)
# limit CI backup lifetime to 7 days - 604800 seconds
gitlab_ci['backup_keep_time'] = 604800

Configure the script for remote copy

cp auto-gitlab-backup.conf.sample auto-gitlab-backup.conf

edit auto-gitlab-backup.conf

## user account on remote server
#  likely 'git' user
remoteUser=""

## remote host
#  a backup gitlab server?
remoteServer=""

## path to an alternate ssh key, if needed.
sshKeyPath=""

## $remoteServer path for gitlab backups
remoteDest=""

## Using the CI server?
#  change to true or 1 to enable CI backups
enableCIBackup="0"

## $remoteServer dest for CI backups on remote
ciRemoteDest="/var/opt/gitlab/ci-backups"

## ssh port or 873 for rsyncd port
remotePort=22

## git user home.
#  Only change the below setting if you have git's home in a different location
gitHome="/var/opt/gitlab"

## only set below if rvm is in use and you need to source the rvm env file
# echo $(rvm env --path)
RVM_envPath=""

## only use the below settings if your destination is using rsync in daemon mode
remoteModule=""
rsync_password_file=""

## Check remote quota
#  change to true or 1 to enable
checkQuota="0"

cron settings

Example for crontab to run at 5:05am everyday.

5 5 * * * /usr/local/sbin/auto-gitlab-backup/auto-gitlab-backup.sh

restore a backup

Still under development but useful

run ./restoreGitLab.sh -r and it will attempt to restore a backup. You may have to run some rake commands manually.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.