Skip to content

Instantly share code, notes, and snippets.

@Kyborg2011
Created July 7, 2017 06:28
Show Gist options
  • Save Kyborg2011/26a03d8d04450fccb1793db00010783a to your computer and use it in GitHub Desktop.
Save Kyborg2011/26a03d8d04450fccb1793db00010783a to your computer and use it in GitHub Desktop.
Backup-restore process on Docker. Took from https://gitlab.com/gitlab-org/gitlab-ce/issues/14740
sudo docker-compose up -d
# docs say we should run reconfigure at least once
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-cal reconfigure
# lets check everything is working after first up
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-rake gitlab:check SANITIZE=true
# restore backup now
sudo docker cp 1460934678_gitlab_backup.tar dockerinfrastructure_gitlab_1:/var/opt/gitlab/backups
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-ctl stop unicorn
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-ctl stop sidekiq
sudo docker exec dockerinfrastructure_gitlab_1 chmod -R 775 /var/opt/gitlab/backups
# note -it flag so you can respond to questions that restore script asks!
sudo docker exec -it dockerinfrastructure_gitlab_1 gitlab-rake gitlab:backup:restore BACKUP=1460934678
# now lets check again
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-rake gitlab:check SANITIZE=true
# fix all the issues that check reports, for me it was:
sudo docker exec dockerinfrastructure_gitlab_1 chown -R git /var/opt/gitlab/gitlab-rails/uploads
sudo docker exec dockerinfrastructure_gitlab_1 find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
sudo docker exec dockerinfrastructure_gitlab_1 find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
sudo docker exec dockerinfrastructure_gitlab_1 chmod -R ug+rwX,o-rwx /var/opt/gitlab/git-data/repositories
sudo docker exec dockerinfrastructure_gitlab_1 chmod -R ug-s /var/opt/gitlab/git-data/repositories
sudo docker exec -it dockerinfrastructure_gitlab_1 sh -c "find /var/opt/gitlab/git-data/repositories -type d -print0 | xargs -0 chmod g+s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment