sund / auto-gitlab-backup

A simple script to backup your Gitlab data. This script will copy the backup archives of your gitlab installation via rsync, or scp. Also, you can copy backups to Backblaze’s B2 Cloud Storage service.
http://sund.github.io/auto-gitlab-backup/
GNU General Public License v2.0
315 stars 73 forks source link

Permission issue when raking ci backups #27

Closed sund closed 8 years ago

sund commented 8 years ago
root ᐅ varina → /var/opt/gitlab/ci-backups ᐉ  gitlab-ci-rake backup:create
Applying final database migrations ... 
done
Dumping database ... 
Dumping PostgreSQL database gitlab_ci_production ... [DONE]
done
Dumping builds ... 
tar: /var/opt/gitlab/gitlab-ci/builds: Cannot chdir: Permission denied
tar: Error is not recoverable: exiting now
done
Creating backup archive: 1453914753_gitlab_ci_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
Deleting old backups ... done. (0 removed)

Your final CI export is in the following file:

-rw-r--r-- 1 gitlab-ci gitlab-ci 90K Jan 27 12:12 /var/opt/gitlab/ci-backups/1453914753_gitlab_ci_backup.tar

Directory permissions to restrictive for root to access:

ll /var/opt/gitlab/gitlab-ci
total 32
drwx------ 4 git       git        4096 Oct  1 15:18 builds

Manually fix:

sudo chown -R git:root /var/opt/gitlab/gitlab-ci/builds/
sudo chmod -R g+rwx /var/opt/gitlab/gitlab-ci/builds/

Wait and see if the next upgrade fixes/breaks things.

sund commented 8 years ago

Had wrong owner (not root!) http://doc.gitlab.com/ce/migrate_ci_to_ce/README.html#permission-denied-when-accessing-varoptgitlabgitlab-cibuilds