Skip to content

Instantly share code, notes, and snippets.

@samrocketman
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save samrocketman/8808315 to your computer and use it in GitHub Desktop.

Select an option

Save samrocketman/8808315 to your computer and use it in GitHub Desktop.
Backup gitlab from the CLI to a remote system when you're either out of space or the filesystem is readonly.

Backup from GitLab to remote machine

If you have a readonly system on your GitLab system then this method is recommended. Log into root user of your gitlab system.

cat ~git/gitlab/config/database.yml to get your database credentials and backup DB to remote system.

unset HISTFILE
/usr/bin/mysqldump -u GITLAB_DB_USER_CHANGEME -pGITLAB_DB_PASS_CHANGEME --skip-extended-insert --create-options --databases GITLAB_DATABASE_CHANGEME | gzip -c - | ssh user@remotehost.com 'cat > gitlab_backup_db.mysql.gz'

Backup repositories.

cd ~git/
/bin/tar -czO repositories | ssh user@remotehost.com 'cat > gitlab_backup_repositories.tar.gz'

Backup config.

cd ~git/
/bin/tar -czO gitlab/config gitlab-shell/config.yml | ssh user@remotehost.com 'cat > gitlab_backup_config.tar.gz'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment