diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-11 11:28:42 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-11 11:28:42 +0300 |
commit | 9f10943c1a76576ac40d96189a28a4d6123a75d8 (patch) | |
tree | 88955d92ebc98a4165d66a36cb8a2cf92709981a /lib/tasks | |
parent | 84727fba96c6794874e1f94d581408b70e1842a7 (diff) |
Revert "Merge branch 'drop-satellites'"
This reverts commit 957e849f41d96fa9778fcdd06792d2f0274b29ab, reversing
changes made to 6b9dbe9f5a175a8162abf296367f561bab3eea1a.
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gitlab/check.rake | 56 | ||||
-rw-r--r-- | lib/tasks/gitlab/enable_automerge.rake | 39 |
2 files changed, 95 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 8acb6a7fd19..badb47c6779 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -25,6 +25,7 @@ namespace :gitlab do check_init_script_exists check_init_script_up_to_date check_projects_have_namespace + check_satellites_exist check_redis_version check_ruby_version check_git_version @@ -237,6 +238,37 @@ namespace :gitlab do end end + def check_satellites_exist + print "Projects have satellites? ... " + + unless Project.count > 0 + puts "can't check, you have no projects".magenta + return + end + puts "" + + Project.find_each(batch_size: 100) do |project| + print sanitized_message(project) + + if project.satellite.exists? + puts "yes".green + elsif project.empty_repo? + puts "can't create, repository is empty".magenta + else + puts "no".red + try_fixing_it( + sudo_gitlab("bundle exec rake gitlab:satellites:create RAILS_ENV=production"), + "If necessary, remove the tmp/repo_satellites directory ...", + "... and rerun the above command" + ) + for_more_information( + "doc/raketasks/maintenance.md " + ) + fix_and_rerun + end + end + end + def check_log_writable print "Log directory writable? ... " @@ -307,6 +339,7 @@ namespace :gitlab do check_repo_base_is_not_symlink check_repo_base_user_and_group check_repo_base_permissions + check_satellites_permissions check_repos_hooks_directory_is_link check_gitlab_shell_self_test @@ -384,6 +417,29 @@ namespace :gitlab do end end + def check_satellites_permissions + print "Satellites access is drwxr-x---? ... " + + satellites_path = Gitlab.config.satellites.path + unless File.exists?(satellites_path) + puts "can't check because of previous errors".magenta + return + end + + if File.stat(satellites_path).mode.to_s(8).ends_with?("0750") + puts "yes".green + else + puts "no".red + try_fixing_it( + "sudo chmod u+rwx,g=rx,o-rwx #{satellites_path}", + ) + for_more_information( + see_installation_guide_section "GitLab" + ) + fix_and_rerun + end + end + def check_repo_base_user_and_group gitlab_shell_ssh_user = Gitlab.config.gitlab_shell.ssh_user gitlab_shell_owner_group = Gitlab.config.gitlab_shell.owner_group diff --git a/lib/tasks/gitlab/enable_automerge.rake b/lib/tasks/gitlab/enable_automerge.rake new file mode 100644 index 00000000000..3dade9d75b8 --- /dev/null +++ b/lib/tasks/gitlab/enable_automerge.rake @@ -0,0 +1,39 @@ +namespace :gitlab do + namespace :satellites do + desc "GitLab | Create satellite repos" + task create: :environment do + create_satellites + end + end + + def create_satellites + warn_user_is_not_gitlab + + print "Creating satellites for ..." + unless Project.count > 0 + puts "skipping, because you have no projects".magenta + return + end + puts "" + + Project.find_each(batch_size: 100) do |project| + print "#{project.name_with_namespace.yellow} ... " + + unless project.repo_exists? + puts "skipping, because the repo is empty".magenta + next + end + + if project.satellite.exists? + puts "exists already".green + else + print "\n... " + if project.satellite.create + puts "created".green + else + puts "error".red + end + end + end + end +end |