Commit 110bb651 authored by Rémy Coutable's avatar Rémy Coutable

Revert "Merge branch 'patch-2' into 'master'"

This reverts merge request !3839
parent 6d9f1e0b
......@@ -295,55 +295,37 @@ Deleting tmp directories...[DONE]
### Omnibus installations
We will assume that you have installed GitLab from an Omnibus package and run
We will assume that you have installed GitLab from an omnibus package and run
`sudo gitlab-ctl reconfigure` at least once.
First make sure your backup tar file is in the directory specified by
`gitlab_rails['backup_path']`. The default is `/var/opt/gitlab/backups`:
First make sure your backup tar file is in `/var/opt/gitlab/backups` (or wherever `gitlab_rails['backup_path']` points to).
```shell
sudo cp 1393513186_gitlab_backup.tar /var/opt/gitlab/backups/
```
Stop the processes that are connected to the database. The rest of GitLab
should remain running:
Next, restore the backup by running the restore command. You need to specify the
timestamp of the backup you are restoring.
```shell
sudo gitlab-ctl start
# Stop processes that are connected to the database
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
```
Verify that only unicorn and sidekiq are stopped:
```shell
sudo gitlab-ctl status
```
Next, restore the backup by running the restore command. You need to specify the
timestamp of the backup you are restoring.
```shell
# This command will overwrite the contents of your GitLab database!
sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186
```
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.
Restart unicorn and sidekiq:
```shell
# Start GitLab
sudo gitlab-ctl start
```
Check GitLab:
```shell
# Check GitLab
sudo gitlab-rake gitlab:check SANITIZE=true
```
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.
## Configure cron to make daily backups
### For installation from source:
......@@ -363,32 +345,31 @@ Add the following lines at the bottom:
The `CRON=1` environment setting tells the backup script to suppress all progress output if there are no errors.
This is recommended to reduce cron spam.
### For Omnibus installations
### For omnibus installations
Edit the crontab for user `git`:
To schedule a cron job that backs up your repositories and GitLab metadata, use the root user:
```shell
sudo crontab -e -u git
```
sudo su -
crontab -e
```
Add the following line to schedule a backup of your repositories and GitLab
metadata every day at 2 AM. Note the empty line after the command:
There, add the following line to schedule the backup for everyday at 2 AM:
```
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
```
You may also want to set a limited lifetime for backups to prevent regular
backups from consuming too much disk space. To do this add the following lines to
backups using all your disk space. To do this add the following lines to
`/etc/gitlab/gitlab.rb` and reconfigure:
```ruby
```
# limit backup lifetime to 7 days - 604800 seconds
gitlab_rails['backup_keep_time'] = 604800
```
NOTE: This cron job does not [back up your omnibus-gitlab configuration](#backup-and-restore-omnibus-gitlab-configuration) or [SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079).
NOTE: This cron job does not [backup your omnibus-gitlab configuration](#backup-and-restore-omnibus-gitlab-configuration) or [SSH host keys](https://superuser.com/questions/532040/copy-ssh-keys-from-one-server-to-another-server/532079#532079).
## Alternative backup strategies
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment