Potential solution for current `rake gitlab:app:backup_restore` issues.
Created by: mrrooijen
Modified the repo_dump
and repo_restore
rake tasks to properly dump and restore repositories based on their path
rather than their (project) name
. The project name can be uppercase and may contain spaces. This caused the repository to be restored as a different path
that it was initially created as, thus, breaking the git remote
and the web interface can no longer detect the repository either because it searches by path
and not by name
. Also, when restoring the permissions are incorrect making it impossible to push new commits to the remote repository. So now on success it'll set the correct permissions (but requires that the gitlab
user has sudo
privileges, or this task must be executed as root).
Merge request reports
Activity
Created by: mrrooijen
@moregeek I will update it. However, there is seriously something wrong with the restore functionality in general. If you have time, could you please check it out? My shell knowledge isn't exactly at the highest level and I simply cannot figure it out. This pull request does solve some definite issues, however it doesn't fully fix the restore functionality.
For example, what you could try is:
- Create a dump using the backup_create rake task
- Try to restore it, sometimes the
gitolite-admin
repository randomly fails to restore, why? - After restoring, various things no longer work, like:
- sometimes I cannot add / remove SSH keys anymore (even after fixing permissions)
- sometimes I cannot add/remove repositories
- sometimes it adds the projects to the database, but then it doesn't actually create a physical git repository at
/home/git/repositories/<here>
which is normally does before you try to restore. - When I somehow, after tinkering with it for a while, manage to get the creation of repositories operational and I try to push code to it, I get errors like
W ACCESS DENIED for
my_email@gmail_com_48712329` or something. After that I cannot figure it out and just give up.
Would you mind (whenever you can/want to) try this for yourself to see if everything I mentioned still works for you after restoring a backup? I tried this on Ubuntu 10.04 and 11.04 and in both cases stuff breaks and I am unable to restore it without completely removing git/gitolite users and home directories.
Also, is there any procedure when you restore a backup that you should follow? I tried to just restore it regularly. Then I tried to first
rm -rf /home/git/repositories/*
anddb/production.sqlite3
and then restore (that fixed some issues I was having like that the gitolite-admin repo would finally properly restore). But regardless, any of the above errors would always occur and I just can't get it fixed. Or am I just doing it wrong when I restore, should I do it differently?Cheers, Michael
By Administrator on 2012-07-25T21:37:34 (imported from GitLab project)
By Administrator on 2012-07-25T21:37:34 (imported from GitLab)
Created by: mrrooijen
@moregeek ah btw, did you want me to replace:
Kernel.system("sudo chmod -R g+rwX /home/git/repositories/") Kernel.system("sudo chown -R git:git /home/git/repositories/")
with:
Kernel.system("sudo chmod -R g+rwX #{Gitlab.config.git_base_path}") Kernel.system("sudo chown -R #{Gitlab.config.ssh_user}:#{Gitlab.config.ssh_user} #{Gitlab.config.git_base_path}")
in the pull request?
By Administrator on 2012-07-25T21:45:27 (imported from GitLab project)
By Administrator on 2012-07-25T21:45:27 (imported from GitLab)
Created by: mrrooijen
https://github.com/gitlabhq/gitlabhq/pull/1149 opened a new pull request that contains a single fixed commit with the above changes.
By Administrator on 2012-07-26T19:35:16 (imported from GitLab project)
By Administrator on 2012-07-26T19:35:16 (imported from GitLab)
Created by: dzaporozhets
I'll accept this. But one more fix should be done - post-receive hook should be owned by gitlab user, not git. https://github.com/gitlabhq/gitlabhq/commit/18f83016b15a1ad388ccb85a6e0878e7f5f14527#diff-3
By Administrator on 2012-07-27T06:11:36 (imported from GitLab project)
By Administrator on 2012-07-27T06:11:36 (imported from GitLab)