Skip to content
Snippets Groups Projects
Commit d5936039 authored by Valery Sizov's avatar Valery Sizov
Browse files

CI backup documentation

parent a2575769
No related branches found
No related tags found
1 merge request!345CI Scheduling backup documentation
Loading
Loading
@@ -55,4 +55,60 @@ gitlab_ci['gitlab_server'] = { 'url' => 'http://gitlab.example.com', 'app_id' =>
# Shut down GitLab services on the CI server
unicorn['enable'] = false
sidekiq['enable'] = false
```
\ No newline at end of file
```
## Scheduling a backup
To schedule a cron job that backs up your GitLab CI, use the root user:
```
sudo su -
crontab -e
```
There, add the following line to schedule the backup for everyday at 2 AM:
```
0 2 * * * /opt/gitlab/bin/gitlab-ci-rake backup:create CRON=1
```
You may also want to set a limited lifetime for backups to prevent regular
backups using all your disk space. To do this add the following lines to
`/etc/gitlab/gitlab.rb` and reconfigure:
```
# limit backup lifetime to 7 days - 604800 seconds
gitlab_ci['backup_keep_time'] = 604800
```
NOTE: This cron job does not [backup your omnibus-gitlab configuration](#backup-and-restore-omnibus-gitlab-configuration).
## Restoring an application backup
We will assume that you have installed GitLab CI from an omnibus package and run
`sudo gitlab-ctl reconfigure` at least once.
First make sure your backup tar file is in `/var/opt/gitlab/backups`.
```shell
sudo cp 1393513186_gitlab_ci_backup.tar.gz /var/opt/gitlab/backups/
```
Next, restore the backup by running the restore command. You need to specify the
timestamp of the backup you are restoring.
```shell
# Stop processes that are connected to the database
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# This command will overwrite the contents of your GitLab CI database!
sudo gitlab-ci-rake backup:restore BACKUP=1393513186
# Start GitLab
sudo gitlab-ctl start
If there is a GitLab version mismatch between your backup tar file and the installed
version of GitLab, the restore command will abort with an error. Install a package for
the [required version](https://www.gitlab.com/downloads/archives/) and try again.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment