Gitlab routine backup and recovery

Source: Internet
Author: User

The/home/git directory structure after the installation is as follows:

| -- Home
| -- Git
| --. Ssh
| -- Gitlab
| -- Gitlab-satellites
| -- Gitlab-shell
| -- Repositories

* '/Home/git/. ssh'-the directory set by ssh. gitlab-shell manages the 'authorized _ keys '.
* '/Home/git/gitlab'-core part of GitLab
* '/Home/git/gitlab-satellites'-can be considered as a temporary directory. Submit the request file through the web ui and check the version library will be stored in this location
* '/Home/git/gitlab-shell'-Core plug-in components of gitlab, including ssh protocol cloning and other functions.
* '/Home/git/repositories'-the namespace of all project organizations in the original version Library, that is, the storage location of all repositories. Therefore, the data in this directory is very important, note that backing up ** is the key data of the project. keep a backup **

* Note: The gitlab-satellites and repositories paths are defined in 'config/gitlab. Yml' and 'config. Yml' in gitlab-shell'

The archive created for all versions of the database is backed up. The storage path is 'config/gitlab. Yml' in gitlab'
The file name is 'Your timestamp;_gitlab_backup.tar '.

'''
Bundle exec rake gitlab: backup: create RAILS_ENV = production
'''

For example:

'''
Dumping database tables:
-Dumping table events... [DONE]
-Dumping table issues... [DONE]
-Dumping table keys... [DONE]
-Dumping table merge_requests... [DONE]
-Dumping table milestones... [DONE]
-Dumping table namespaces... [DONE]
-Dumping table notes... [DONE]
-Dumping table projects... [DONE]
-Dumping table protected_branches... [DONE]
-Dumping table schema_migrations... [DONE]
-Dumping table services... [DONE]
-Dumping table snippets... [DONE]
-Dumping table taggings... [DONE]
-Dumping table tags... [DONE]
-Dumping table users... [DONE]
-Dumping table users_projects... [DONE]
-Dumping table web_hooks... [DONE]
-Dumping table wikis... [DONE]
Dumping repositories:
-Dumping repository abcd... [DONE]
Creating backup archive: Creating [DONE]
Deleting tmp directories... [DONE]
Deleting old backups... [SKIPPING]
'''

### Restore using backup files

'''
Bundle exec rake gitlab: backup: restore RAILS_ENV = production
'''

Option:

'''
BACKUP = timestamp_of_backup (required if more than one backup exists)
'''

Similar to this:

'''
Unpacking backup... [DONE]
Restoring database tables:
-- Create_table ("events", {: force => true })
-> 0.2231 s
[...]
-Loading fixture events... [DONE]
-Loading fixture issues... [DONE]
-Loading fixture keys... [SKIPPING]
-Loading fixture merge_requests... [DONE]
-Loading fixture milestones... [DONE]
-Loading fixture namespaces... [DONE]
-Loading fixture notes... [DONE]
-Loading fixture projects... [DONE]
-Loading fixture protected_branches... [SKIPPING]
-Loading fixture schema_migrations... [DONE]
-Loading fixture services... [SKIPPING]
-Loading fixture snippets... [SKIPPING]
-Loading fixture taggings... [SKIPPING]
-Loading fixture tags... [SKIPPING]
-Loading fixture users... [DONE]
-Loading fixture users_projects... [DONE]
-Loading fixture web_hooks... [SKIPPING]
-Loading fixture wikis... [SKIPPING]
Restoring repositories:
-Restoring repository abcd... [DONE]
Deleting tmp directories... [DONE]
'''

### Configure a scheduled task

'''
Cd/home/git/gitlab
Sudo-u git-H editor config/gitlab. yml # How long will automatic backup be enabled?
Sudo-u git crontab-e # scheduled tasks of git users
'''

Add the following entries:

'''
# Perform full backup at every day
0 2 *** cd/home/git/gitlab & PATH =/usr/local/bin:/usr/bin:/bin bundle exec rake gitlab: backup: create RAILS_ENV = production
'''

Gitlab routine backup and recovery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.