Compare commits
27 commits
master
...
4-0-stable
Author | SHA1 | Date | |
---|---|---|---|
|
f4fafc4631 | ||
|
c84fcb265c | ||
|
042a561baf | ||
|
7b6cbebaad | ||
|
9cf993972a | ||
|
f254de7337 | ||
|
147dfd1656 | ||
|
f73dd4af5e | ||
|
ab12419633 | ||
|
c312a8d7d1 | ||
|
e523327355 | ||
|
c9ae412e88 | ||
|
6e067482dc | ||
|
d40215746e | ||
|
1abc70fbf6 | ||
|
3cccbf8a43 | ||
|
2e7e6e6ee1 | ||
|
0e2880b740 | ||
|
10b312abad | ||
|
260ab8d67a | ||
|
708a0d421e | ||
|
779e95b503 | ||
|
91405d1f98 | ||
|
2edb16612f | ||
|
c68540e9c9 | ||
|
19cb29e448 | ||
|
45b6103997 |
21 changed files with 433 additions and 212 deletions
2
Gemfile
2
Gemfile
|
@ -8,7 +8,7 @@ def linux_only(require_as)
|
||||||
RUBY_PLATFORM.include?('linux') && require_as
|
RUBY_PLATFORM.include?('linux') && require_as
|
||||||
end
|
end
|
||||||
|
|
||||||
gem "rails", "3.2.9"
|
gem "rails", "3.2.11"
|
||||||
|
|
||||||
# Supported DBs
|
# Supported DBs
|
||||||
gem "mysql2", group: :mysql
|
gem "mysql2", group: :mysql
|
||||||
|
|
60
Gemfile.lock
60
Gemfile.lock
|
@ -81,12 +81,12 @@ GIT
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actionmailer (3.2.9)
|
actionmailer (3.2.11)
|
||||||
actionpack (= 3.2.9)
|
actionpack (= 3.2.11)
|
||||||
mail (~> 2.4.4)
|
mail (~> 2.4.4)
|
||||||
actionpack (3.2.9)
|
actionpack (3.2.11)
|
||||||
activemodel (= 3.2.9)
|
activemodel (= 3.2.11)
|
||||||
activesupport (= 3.2.9)
|
activesupport (= 3.2.11)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
erubis (~> 2.7.0)
|
erubis (~> 2.7.0)
|
||||||
journey (~> 1.0.4)
|
journey (~> 1.0.4)
|
||||||
|
@ -94,18 +94,18 @@ GEM
|
||||||
rack-cache (~> 1.2)
|
rack-cache (~> 1.2)
|
||||||
rack-test (~> 0.6.1)
|
rack-test (~> 0.6.1)
|
||||||
sprockets (~> 2.2.1)
|
sprockets (~> 2.2.1)
|
||||||
activemodel (3.2.9)
|
activemodel (3.2.11)
|
||||||
activesupport (= 3.2.9)
|
activesupport (= 3.2.11)
|
||||||
builder (~> 3.0.0)
|
builder (~> 3.0.0)
|
||||||
activerecord (3.2.9)
|
activerecord (3.2.11)
|
||||||
activemodel (= 3.2.9)
|
activemodel (= 3.2.11)
|
||||||
activesupport (= 3.2.9)
|
activesupport (= 3.2.11)
|
||||||
arel (~> 3.0.2)
|
arel (~> 3.0.2)
|
||||||
tzinfo (~> 0.3.29)
|
tzinfo (~> 0.3.29)
|
||||||
activeresource (3.2.9)
|
activeresource (3.2.11)
|
||||||
activemodel (= 3.2.9)
|
activemodel (= 3.2.11)
|
||||||
activesupport (= 3.2.9)
|
activesupport (= 3.2.11)
|
||||||
activesupport (3.2.9)
|
activesupport (3.2.11)
|
||||||
i18n (~> 0.6)
|
i18n (~> 0.6)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
acts-as-taggable-on (2.3.3)
|
acts-as-taggable-on (2.3.3)
|
||||||
|
@ -240,7 +240,7 @@ GEM
|
||||||
jquery-ui-rails (2.0.2)
|
jquery-ui-rails (2.0.2)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
railties (>= 3.1.0)
|
railties (>= 3.1.0)
|
||||||
json (1.7.5)
|
json (1.7.6)
|
||||||
jwt (0.1.5)
|
jwt (0.1.5)
|
||||||
multi_json (>= 1.0)
|
multi_json (>= 1.0)
|
||||||
kaminari (0.14.1)
|
kaminari (0.14.1)
|
||||||
|
@ -264,7 +264,7 @@ GEM
|
||||||
mime-types (1.19)
|
mime-types (1.19)
|
||||||
modernizr (2.6.2)
|
modernizr (2.6.2)
|
||||||
sprockets (~> 2.0)
|
sprockets (~> 2.0)
|
||||||
multi_json (1.3.7)
|
multi_json (1.5.0)
|
||||||
multi_xml (0.5.1)
|
multi_xml (0.5.1)
|
||||||
multipart-post (1.1.5)
|
multipart-post (1.1.5)
|
||||||
mysql2 (0.3.11)
|
mysql2 (0.3.11)
|
||||||
|
@ -306,7 +306,7 @@ GEM
|
||||||
pyu-ruby-sasl (0.0.3.3)
|
pyu-ruby-sasl (0.0.3.3)
|
||||||
quiet_assets (1.0.1)
|
quiet_assets (1.0.1)
|
||||||
railties (~> 3.1)
|
railties (~> 3.1)
|
||||||
rack (1.4.1)
|
rack (1.4.3)
|
||||||
rack-accept (0.4.5)
|
rack-accept (0.4.5)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
|
@ -321,26 +321,26 @@ GEM
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (3.2.9)
|
rails (3.2.11)
|
||||||
actionmailer (= 3.2.9)
|
actionmailer (= 3.2.11)
|
||||||
actionpack (= 3.2.9)
|
actionpack (= 3.2.11)
|
||||||
activerecord (= 3.2.9)
|
activerecord (= 3.2.11)
|
||||||
activeresource (= 3.2.9)
|
activeresource (= 3.2.11)
|
||||||
activesupport (= 3.2.9)
|
activesupport (= 3.2.11)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.2.9)
|
railties (= 3.2.11)
|
||||||
rails-dev-tweaks (0.6.1)
|
rails-dev-tweaks (0.6.1)
|
||||||
actionpack (~> 3.1)
|
actionpack (~> 3.1)
|
||||||
railties (~> 3.1)
|
railties (~> 3.1)
|
||||||
railties (3.2.9)
|
railties (3.2.11)
|
||||||
actionpack (= 3.2.9)
|
actionpack (= 3.2.11)
|
||||||
activesupport (= 3.2.9)
|
activesupport (= 3.2.11)
|
||||||
rack-ssl (~> 1.3.2)
|
rack-ssl (~> 1.3.2)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
rdoc (~> 3.4)
|
rdoc (~> 3.4)
|
||||||
thor (>= 0.14.6, < 2.0)
|
thor (>= 0.14.6, < 2.0)
|
||||||
raindrops (0.10.0)
|
raindrops (0.10.0)
|
||||||
rake (10.0.1)
|
rake (10.0.3)
|
||||||
raphael-rails (1.5.2)
|
raphael-rails (1.5.2)
|
||||||
rb-fsevent (0.9.2)
|
rb-fsevent (0.9.2)
|
||||||
rb-inotify (0.8.8)
|
rb-inotify (0.8.8)
|
||||||
|
@ -411,7 +411,7 @@ GEM
|
||||||
capybara (~> 1)
|
capybara (~> 1)
|
||||||
railties (>= 3)
|
railties (>= 3)
|
||||||
spinach (>= 0.4)
|
spinach (>= 0.4)
|
||||||
sprockets (2.2.1)
|
sprockets (2.2.2)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
rack (~> 1.0)
|
rack (~> 1.0)
|
||||||
|
@ -506,7 +506,7 @@ DEPENDENCIES
|
||||||
pygments.rb!
|
pygments.rb!
|
||||||
quiet_assets (~> 1.0.1)
|
quiet_assets (~> 1.0.1)
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
rails (= 3.2.9)
|
rails (= 3.2.11)
|
||||||
rails-dev-tweaks
|
rails-dev-tweaks
|
||||||
raphael-rails (= 1.5.2)
|
raphael-rails (= 1.5.2)
|
||||||
rb-fsevent
|
rb-fsevent
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
4.0.0
|
4.0.1
|
||||||
|
|
|
@ -27,10 +27,13 @@ class Namespace < ActiveRecord::Base
|
||||||
|
|
||||||
after_create :ensure_dir_exist
|
after_create :ensure_dir_exist
|
||||||
after_update :move_dir
|
after_update :move_dir
|
||||||
|
after_commit :update_gitolite, on: :update, if: :require_update_gitolite
|
||||||
after_destroy :rm_dir
|
after_destroy :rm_dir
|
||||||
|
|
||||||
scope :root, where('type IS NULL')
|
scope :root, where('type IS NULL')
|
||||||
|
|
||||||
|
attr_accessor :require_update_gitolite
|
||||||
|
|
||||||
def self.search query
|
def self.search query
|
||||||
where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
|
where("name LIKE :query OR path LIKE :query", query: "%#{query}%")
|
||||||
end
|
end
|
||||||
|
@ -48,8 +51,17 @@ class Namespace < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_dir_exist
|
def ensure_dir_exist
|
||||||
namespace_dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
|
unless dir_exists?
|
||||||
system("mkdir -m 770 #{namespace_dir_path}") unless File.exists?(namespace_dir_path)
|
system("mkdir -m 770 #{namespace_full_path}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def dir_exists?
|
||||||
|
File.exists?(namespace_full_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
def namespace_full_path
|
||||||
|
@namespace_full_path ||= File.join(Gitlab.config.gitolite.repos_path, path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def move_dir
|
def move_dir
|
||||||
|
@ -62,10 +74,18 @@ class Namespace < ActiveRecord::Base
|
||||||
|
|
||||||
if system("mv #{old_path} #{new_path}")
|
if system("mv #{old_path} #{new_path}")
|
||||||
send_update_instructions
|
send_update_instructions
|
||||||
|
@require_update_gitolite = true
|
||||||
|
else
|
||||||
|
raise "Namespace move error #{old_path} #{new_path}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_gitolite
|
||||||
|
@require_update_gitolite = false
|
||||||
|
projects.each(&:update_repository)
|
||||||
|
end
|
||||||
|
|
||||||
def rm_dir
|
def rm_dir
|
||||||
dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
|
dir_path = File.join(Gitlab.config.gitolite.repos_path, path)
|
||||||
system("rm -rf #{dir_path}")
|
system("rm -rf #{dir_path}")
|
||||||
|
|
|
@ -14,7 +14,7 @@ class UserObserver < ActiveRecord::Observer
|
||||||
if user.namespace
|
if user.namespace
|
||||||
user.namespace.update_attributes(path: user.username)
|
user.namespace.update_attributes(path: user.username)
|
||||||
else
|
else
|
||||||
user.create_namespace!(path: user.username, name: user.name)
|
user.create_namespace!(path: user.username, name: user.username)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,7 @@ module NamespacedProject
|
||||||
save!
|
save!
|
||||||
end
|
end
|
||||||
rescue Gitlab::ProjectMover::ProjectMoveError => ex
|
rescue Gitlab::ProjectMover::ProjectMoveError => ex
|
||||||
raise TransferError.new(ex.message)
|
raise Project::TransferError.new(ex.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def name_with_namespace
|
def name_with_namespace
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
= @issue.created_at.stamp("Aug 21, 2011")
|
= @issue.created_at.stamp("Aug 21, 2011")
|
||||||
|
|
||||||
%span.right
|
%span.right
|
||||||
|
- if can? current_user, :write_issue, @project
|
||||||
|
= link_to new_project_issue_path(@project, issue: { assignee_id: params[:assignee_id], milestone_id: params[:milestone_id]}), class: "btn grouped" do
|
||||||
|
%i.icon-plus
|
||||||
|
New Issue
|
||||||
- if can?(current_user, :admin_project, @project) || @issue.author == current_user
|
- if can?(current_user, :admin_project, @project) || @issue.author == current_user
|
||||||
- if @issue.closed
|
- if @issue.closed
|
||||||
= link_to 'Reopen', project_issue_path(@project, @issue, issue: {closed: false }, status_only: true), method: :put, class: "btn grouped reopen_issue"
|
= link_to 'Reopen', project_issue_path(@project, @issue, issue: {closed: false }, status_only: true), method: :put, class: "btn grouped reopen_issue"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
= nav_link(path: 'groups#merge_requests') do
|
= nav_link(path: 'groups#merge_requests') do
|
||||||
= link_to merge_requests_group_path(@group) do
|
= link_to merge_requests_group_path(@group) do
|
||||||
Merge Requests
|
Merge Requests
|
||||||
%span.count= current_user.cared_merge_requests.of_group(@group).count
|
%span.count= current_user.cared_merge_requests.opened.of_group(@group).count
|
||||||
= nav_link(path: 'groups#search') do
|
= nav_link(path: 'groups#search') do
|
||||||
= link_to "Search", search_group_path(@group)
|
= link_to "Search", search_group_path(@group)
|
||||||
= nav_link(path: 'groups#people') do
|
= nav_link(path: 'groups#people') do
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
.span4.notify_opts
|
.span4.notify_opts
|
||||||
%h6.left Notify via email:
|
%h6.left Notify via email:
|
||||||
= label_tag :notify do
|
= label_tag :notify do
|
||||||
= check_box_tag :notify, 1, @note.noteable_type != "Commit"
|
= check_box_tag :notify, 1, false
|
||||||
%span Project team
|
%span Project team
|
||||||
|
|
||||||
- if @note.notify_only_author?(current_user)
|
- if @note.notify_only_author?(current_user)
|
||||||
= label_tag :notify_author do
|
= label_tag :notify_author do
|
||||||
= check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
|
= check_box_tag :notify_author, 1 , false
|
||||||
%span Commit author
|
%span Commit author
|
||||||
.span5.attachments
|
.span5.attachments
|
||||||
%h6.left Attachment:
|
%h6.left Attachment:
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
%h6.left Notify via email:
|
%h6.left Notify via email:
|
||||||
.labels
|
.labels
|
||||||
= label_tag :notify do
|
= label_tag :notify do
|
||||||
= check_box_tag :notify, 1, @note.noteable_type != "Commit"
|
= check_box_tag :notify, 1, false
|
||||||
%span Project team
|
%span Project team
|
||||||
|
|
||||||
- if @note.notify_only_author?(current_user)
|
- if @note.notify_only_author?(current_user)
|
||||||
= label_tag :notify_author do
|
= label_tag :notify_author do
|
||||||
= check_box_tag :notify_author, 1 , @note.noteable_type == "Commit"
|
= check_box_tag :notify_author, 1 , false
|
||||||
%span Commit author
|
%span Commit author
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
|
|
|
@ -89,6 +89,7 @@ backup:
|
||||||
## Gitolite settings
|
## Gitolite settings
|
||||||
gitolite:
|
gitolite:
|
||||||
admin_uri: git@localhost:gitolite-admin
|
admin_uri: git@localhost:gitolite-admin
|
||||||
|
# repos_path must not be a symlink
|
||||||
repos_path: /home/git/repositories/
|
repos_path: /home/git/repositories/
|
||||||
hooks_path: /home/git/.gitolite/hooks/
|
hooks_path: /home/git/.gitolite/hooks/
|
||||||
admin_key: gitlab
|
admin_key: gitlab
|
||||||
|
|
|
@ -324,7 +324,7 @@ Settings.gitlab['email_from'] ||= Settings.pre_40_config ? Settings.email_from :
|
||||||
Settings.gitlab['url'] ||= Settings.pre_40_config ? Settings.url : Settings.send(:build_gitlab_url)
|
Settings.gitlab['url'] ||= Settings.pre_40_config ? Settings.url : Settings.send(:build_gitlab_url)
|
||||||
|
|
||||||
Settings['gravatar'] ||= Settingslogic.new({})
|
Settings['gravatar'] ||= Settingslogic.new({})
|
||||||
Settings.gravatar['enabled'] ||= Settings.pre_40_config ? !Settings.disable_gravatar? : true
|
Settings.gravatar['enabled'] = Settings.pre_40_config ? !Settings.disable_gravatar? : true if Settings.gravatar['enabled'].nil?
|
||||||
Settings.gravatar['plain_url'] ||= Settings.pre_40_config ? Settings.gravatar_url : 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
Settings.gravatar['plain_url'] ||= Settings.pre_40_config ? Settings.gravatar_url : 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
||||||
Settings.gravatar['ssl_url'] ||= Settings.pre_40_config ? Settings.gravatar_ssl_url : 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
Settings.gravatar['ssl_url'] ||= Settings.pre_40_config ? Settings.gravatar_ssl_url : 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
|
||||||
|
|
||||||
|
|
|
@ -27,3 +27,5 @@ Resque::Server.use Authentication
|
||||||
|
|
||||||
# Mailer
|
# Mailer
|
||||||
Resque::Mailer.excluded_environments = []
|
Resque::Mailer.excluded_environments = []
|
||||||
|
|
||||||
|
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
|
||||||
|
|
|
@ -5,7 +5,7 @@ class MoveNoteableCommitToOwnField < ActiveRecord::Migration
|
||||||
Note.where(noteable_type: 'Commit').update_all('commit_id = noteable_id')
|
Note.where(noteable_type: 'Commit').update_all('commit_id = noteable_id')
|
||||||
|
|
||||||
if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
|
if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
|
||||||
Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = CAST (noteable_id AS INTEGER)')
|
Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = CAST (CASE noteable_id WHEN \'\' THEN NULL ELSE noteable_id END AS INTEGER)')
|
||||||
else
|
else
|
||||||
Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = noteable_id')
|
Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = noteable_id')
|
||||||
end
|
end
|
||||||
|
|
|
@ -270,6 +270,18 @@ used for the `email.from` setting in `config/gitlab.yml`)
|
||||||
sudo -u gitlab -H bundle exec rake gitlab:app:setup RAILS_ENV=production
|
sudo -u gitlab -H bundle exec rake gitlab:app:setup RAILS_ENV=production
|
||||||
|
|
||||||
|
|
||||||
|
## Install Init Script
|
||||||
|
|
||||||
|
Download the init script (will be /etc/init.d/gitlab):
|
||||||
|
|
||||||
|
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/4-0-stable/init.d/gitlab -P /etc/init.d/
|
||||||
|
sudo chmod +x /etc/init.d/gitlab
|
||||||
|
|
||||||
|
Make GitLab start on boot:
|
||||||
|
|
||||||
|
sudo update-rc.d gitlab defaults 21
|
||||||
|
|
||||||
|
|
||||||
## Check Application Status
|
## Check Application Status
|
||||||
|
|
||||||
Check if GitLab and its environment is configured correctly:
|
Check if GitLab and its environment is configured correctly:
|
||||||
|
@ -280,23 +292,11 @@ To make sure you didn't miss anything run a more thorough check with:
|
||||||
|
|
||||||
sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production
|
sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production
|
||||||
|
|
||||||
If you are all green: congratulations, you successfully installed GitLab!
|
If all items are green, then congratulations on successfully installing GitLab!
|
||||||
Although this is the case, there are still a few steps to go.
|
However there are still a few steps left.
|
||||||
|
|
||||||
|
|
||||||
## Install Init Script
|
## Start Your GitLab Instance
|
||||||
|
|
||||||
Download the init script (will be /etc/init.d/gitlab):
|
|
||||||
|
|
||||||
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab -P /etc/init.d/
|
|
||||||
sudo chmod +x /etc/init.d/gitlab
|
|
||||||
|
|
||||||
Make GitLab start on boot:
|
|
||||||
|
|
||||||
sudo update-rc.d gitlab defaults 21
|
|
||||||
|
|
||||||
|
|
||||||
Start your GitLab instance:
|
|
||||||
|
|
||||||
sudo service gitlab start
|
sudo service gitlab start
|
||||||
# or
|
# or
|
||||||
|
@ -316,7 +316,7 @@ If you can't or don't want to use Nginx as your web server, have a look at the
|
||||||
|
|
||||||
Download an example site config:
|
Download an example site config:
|
||||||
|
|
||||||
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab -P /etc/nginx/sites-available/
|
sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/4-0-stable/nginx/gitlab -P /etc/nginx/sites-available/
|
||||||
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
|
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
|
||||||
|
|
||||||
Make sure to edit the config file to match your setup:
|
Make sure to edit the config file to match your setup:
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace :gitlab do
|
||||||
see_database_guide,
|
see_database_guide,
|
||||||
"http://guides.rubyonrails.org/getting_started.html#configuring-a-database"
|
"http://guides.rubyonrails.org/getting_started.html#configuring-a-database"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ namespace :gitlab do
|
||||||
"https://github.com/gitlabhq/gitlabhq/wiki/Migrate-from-SQLite-to-MySQL",
|
"https://github.com/gitlabhq/gitlabhq/wiki/Migrate-from-SQLite-to-MySQL",
|
||||||
see_database_guide
|
see_database_guide
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "GitLab"
|
see_installation_guide_section "GitLab"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
# omniauth or ldap could have been deleted from the file
|
# omniauth or ldap could have been deleted from the file
|
||||||
unless Gitlab.config.pre_40_config
|
unless Gitlab.config['git_host']
|
||||||
puts "no".green
|
puts "no".green
|
||||||
else
|
else
|
||||||
puts "yes".red
|
puts "yes".red
|
||||||
|
@ -110,7 +110,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "GitLab"
|
see_installation_guide_section "GitLab"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Install Init Script"
|
see_installation_guide_section "Install Init Script"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ namespace :gitlab do
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
recipe_content = `curl https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab 2>/dev/null`
|
recipe_content = `curl https://raw.github.com/gitlabhq/gitlab-recipes/4-0-stable/init.d/gitlab 2>/dev/null`
|
||||||
script_content = File.read(script_path)
|
script_content = File.read(script_path)
|
||||||
|
|
||||||
if recipe_content == script_content
|
if recipe_content == script_content
|
||||||
|
@ -155,7 +155,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Install Init Script"
|
see_installation_guide_section "Install Init Script"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ namespace :gitlab do
|
||||||
try_fixing_it(
|
try_fixing_it(
|
||||||
"sudo -u gitlab -H bundle exec rake db:migrate"
|
"sudo -u gitlab -H bundle exec rake db:migrate"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
"doc/raketasks/maintenance.md "
|
"doc/raketasks/maintenance.md "
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -222,7 +222,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "GitLab"
|
see_installation_guide_section "GitLab"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "GitLab"
|
see_installation_guide_section "GitLab"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -256,7 +256,7 @@ namespace :gitlab do
|
||||||
start_checking "Environment"
|
start_checking "Environment"
|
||||||
|
|
||||||
check_gitlab_in_git_group
|
check_gitlab_in_git_group
|
||||||
check_issue_1056_shell_profile_error
|
check_issue_1059_shell_profile_error
|
||||||
check_gitlab_git_config
|
check_gitlab_git_config
|
||||||
check_python2_exists
|
check_python2_exists
|
||||||
check_python2_version
|
check_python2_version
|
||||||
|
@ -290,7 +290,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "GitLab"
|
see_installation_guide_section "GitLab"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -308,16 +308,16 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "System Users"
|
see_installation_guide_section "System Users"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# see https://github.com/gitlabhq/gitlabhq/issues/1059
|
# see https://github.com/gitlabhq/gitlabhq/issues/1059
|
||||||
def check_issue_1056_shell_profile_error
|
def check_issue_1059_shell_profile_error
|
||||||
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
||||||
print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
|
print "Has no \"-e\" in ~#{gitolite_ssh_user}/.profile ... "
|
||||||
|
|
||||||
profile_file = File.join(gitolite_home, ".profile")
|
profile_file = File.join(gitolite_user_home, ".profile")
|
||||||
|
|
||||||
unless File.read(profile_file) =~ /^-e PATH/
|
unless File.read(profile_file) =~ /^-e PATH/
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
|
@ -332,7 +332,7 @@ namespace :gitlab do
|
||||||
see_installation_guide_section("Gitolite"),
|
see_installation_guide_section("Gitolite"),
|
||||||
"https://github.com/gitlabhq/gitlabhq/issues/1059"
|
"https://github.com/gitlabhq/gitlabhq/issues/1059"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Packages / Dependencies"
|
see_installation_guide_section "Packages / Dependencies"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Packages / Dependencies"
|
see_installation_guide_section "Packages / Dependencies"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -398,6 +398,7 @@ namespace :gitlab do
|
||||||
check_dot_gitolite_user_and_group
|
check_dot_gitolite_user_and_group
|
||||||
check_dot_gitolite_permissions
|
check_dot_gitolite_permissions
|
||||||
check_repo_base_exists
|
check_repo_base_exists
|
||||||
|
check_repo_base_is_not_symlink
|
||||||
check_repo_base_user_and_group
|
check_repo_base_user_and_group
|
||||||
check_repo_base_permissions
|
check_repo_base_permissions
|
||||||
check_can_clone_gitolite_admin
|
check_can_clone_gitolite_admin
|
||||||
|
@ -434,7 +435,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
|
|
||||||
# assumes #check_can_clone_gitolite_admin has been run before
|
# assumes #check_can_clone_gitolite_admin has been run before
|
||||||
|
@ -466,7 +467,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
ensure
|
ensure
|
||||||
FileUtils.rm_rf("/tmp/gitolite_gitlab_test")
|
FileUtils.rm_rf("/tmp/gitolite_gitlab_test")
|
||||||
end
|
end
|
||||||
|
@ -474,7 +475,7 @@ namespace :gitlab do
|
||||||
def check_dot_gitolite_exists
|
def check_dot_gitolite_exists
|
||||||
print "Config directory exists? ... "
|
print "Config directory exists? ... "
|
||||||
|
|
||||||
gitolite_config_path = File.join(gitolite_home, ".gitolite")
|
gitolite_config_path = File.join(gitolite_user_home, ".gitolite")
|
||||||
|
|
||||||
if File.directory?(gitolite_config_path)
|
if File.directory?(gitolite_config_path)
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
|
@ -488,20 +489,20 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_dot_gitolite_permissions
|
def check_dot_gitolite_permissions
|
||||||
print "Config directory access is drwxr-x---? ... "
|
print "Config directory access is drwxr-x---? ... "
|
||||||
|
|
||||||
gitolite_config_path = File.join(gitolite_home, ".gitolite")
|
gitolite_config_path = File.join(gitolite_user_home, ".gitolite")
|
||||||
unless File.exists?(gitolite_config_path)
|
unless File.exists?(gitolite_config_path)
|
||||||
puts "can't check because of previous errors".magenta
|
puts "can't check because of previous errors".magenta
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if `stat --printf %a #{gitolite_config_path}` == "750"
|
if File.stat(gitolite_config_path).mode.to_s(8).ends_with?("750")
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
else
|
else
|
||||||
puts "no".red
|
puts "no".red
|
||||||
|
@ -511,7 +512,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -519,31 +520,30 @@ namespace :gitlab do
|
||||||
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
gitolite_ssh_user = Gitlab.config.gitolite.ssh_user
|
||||||
print "Config directory owned by #{gitolite_ssh_user}:#{gitolite_ssh_user} ... "
|
print "Config directory owned by #{gitolite_ssh_user}:#{gitolite_ssh_user} ... "
|
||||||
|
|
||||||
gitolite_config_path = File.join(gitolite_home, ".gitolite")
|
gitolite_config_path = File.join(gitolite_user_home, ".gitolite")
|
||||||
unless File.exists?(gitolite_config_path)
|
unless File.exists?(gitolite_config_path)
|
||||||
puts "can't check because of previous errors".magenta
|
puts "can't check because of previous errors".magenta
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if `stat --printf %U #{gitolite_config_path}` == gitolite_ssh_user && # user
|
if File.stat(gitolite_config_path).uid == uid_for(gitolite_ssh_user) &&
|
||||||
`stat --printf %G #{gitolite_config_path}` == gitolite_ssh_user #group
|
File.stat(gitolite_config_path).gid == gid_for(gitolite_ssh_user)
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
else
|
else
|
||||||
puts "no".red
|
puts "no".red
|
||||||
puts "#{gitolite_config_path} is not owned by #{gitolite_ssh_user}".red
|
|
||||||
try_fixing_it(
|
try_fixing_it(
|
||||||
"sudo chown -R #{gitolite_ssh_user}:#{gitolite_ssh_user} #{gitolite_config_path}"
|
"sudo chown -R #{gitolite_ssh_user}:#{gitolite_ssh_user} #{gitolite_config_path}"
|
||||||
)
|
)
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_gitolite_is_up_to_date
|
def check_gitolite_is_up_to_date
|
||||||
print "Using recommended version ... "
|
print "Using recommended version ... "
|
||||||
if gitolite_version.try(:start_with?, "v3.04")
|
if gitolite_version.try(:start_with?, "v3.2")
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
else
|
else
|
||||||
puts "no".red
|
puts "no".red
|
||||||
|
@ -558,7 +558,7 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_gitoliterc_git_config_keys
|
def check_gitoliterc_git_config_keys
|
||||||
gitoliterc_path = File.join(gitolite_home, ".gitolite.rc")
|
gitoliterc_path = File.join(gitolite_user_home, ".gitolite.rc")
|
||||||
|
|
||||||
print "Allow all Git config keys in .gitolite.rc ... "
|
print "Allow all Git config keys in .gitolite.rc ... "
|
||||||
option_name = if has_gitolite3?
|
option_name = if has_gitolite3?
|
||||||
|
@ -567,7 +567,7 @@ namespace :gitlab do
|
||||||
else
|
else
|
||||||
# assume older version
|
# assume older version
|
||||||
# see https://github.com/sitaramc/gitolite/blob/v2.3/conf/example.gitolite.rc#L49
|
# see https://github.com/sitaramc/gitolite/blob/v2.3/conf/example.gitolite.rc#L49
|
||||||
"$GL_GITCONFIG_KEYS"
|
"\\$GL_GITCONFIG_KEYS"
|
||||||
end
|
end
|
||||||
option_value = ".*"
|
option_value = ".*"
|
||||||
if open(gitoliterc_path).grep(/#{option_name}\s*=[>]?\s*["']#{option_value}["']/).any?
|
if open(gitoliterc_path).grep(/#{option_name}\s*=[>]?\s*["']#{option_value}["']/).any?
|
||||||
|
@ -582,12 +582,12 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_gitoliterc_repo_umask
|
def check_gitoliterc_repo_umask
|
||||||
gitoliterc_path = File.join(gitolite_home, ".gitolite.rc")
|
gitoliterc_path = File.join(gitolite_user_home, ".gitolite.rc")
|
||||||
|
|
||||||
print "Repo umask is 0007 in .gitolite.rc? ... "
|
print "Repo umask is 0007 in .gitolite.rc? ... "
|
||||||
option_name = if has_gitolite3?
|
option_name = if has_gitolite3?
|
||||||
|
@ -596,7 +596,7 @@ namespace :gitlab do
|
||||||
else
|
else
|
||||||
# assume older version
|
# assume older version
|
||||||
# see https://github.com/sitaramc/gitolite/blob/v2.3/conf/example.gitolite.rc#L32
|
# see https://github.com/sitaramc/gitolite/blob/v2.3/conf/example.gitolite.rc#L32
|
||||||
"$REPO_UMASK"
|
"\\$REPO_UMASK"
|
||||||
end
|
end
|
||||||
option_value = "0007"
|
option_value = "0007"
|
||||||
if open(gitoliterc_path).grep(/#{option_name}\s*=[>]?\s*#{option_value}/).any?
|
if open(gitoliterc_path).grep(/#{option_name}\s*=[>]?\s*#{option_value}/).any?
|
||||||
|
@ -611,7 +611,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Setup GitLab Hooks"
|
see_installation_guide_section "Setup GitLab Hooks"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Setup GitLab Hooks"
|
see_installation_guide_section "Setup GitLab Hooks"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -688,7 +688,27 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_repo_base_is_not_symlink
|
||||||
|
print "Repo base directory is a symlink? ... "
|
||||||
|
|
||||||
|
repo_base_path = Gitlab.config.gitolite.repos_path
|
||||||
|
unless File.exists?(repo_base_path)
|
||||||
|
puts "can't check because of previous errors".magenta
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
unless File.symlink?(repo_base_path)
|
||||||
|
puts "no".green
|
||||||
|
else
|
||||||
|
puts "yes".red
|
||||||
|
try_fixing_it(
|
||||||
|
"Make sure it's set to the real directory in config/gitlab.yml"
|
||||||
|
)
|
||||||
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -701,18 +721,17 @@ namespace :gitlab do
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if `stat --printf %a #{repo_base_path}` == "6770"
|
if File.stat(repo_base_path).mode.to_s(8).ends_with?("6770")
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
else
|
else
|
||||||
puts "no".red
|
puts "no".red
|
||||||
puts "#{repo_base_path} is not writable".red
|
|
||||||
try_fixing_it(
|
try_fixing_it(
|
||||||
"sudo chmod -R ug+rwXs,o-rwx #{repo_base_path}"
|
"sudo chmod -R ug+rwXs,o-rwx #{repo_base_path}"
|
||||||
)
|
)
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -726,19 +745,18 @@ namespace :gitlab do
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if `stat --printf %U #{repo_base_path}` == gitolite_ssh_user && # user
|
if File.stat(repo_base_path).uid == uid_for(gitolite_ssh_user) &&
|
||||||
`stat --printf %G #{repo_base_path}` == gitolite_ssh_user #group
|
File.stat(repo_base_path).gid == gid_for(gitolite_ssh_user)
|
||||||
puts "yes".green
|
puts "yes".green
|
||||||
else
|
else
|
||||||
puts "no".red
|
puts "no".red
|
||||||
puts "#{repo_base_path} is not owned by #{gitolite_ssh_user}".red
|
|
||||||
try_fixing_it(
|
try_fixing_it(
|
||||||
"sudo chown -R #{gitolite_ssh_user}:#{gitolite_ssh_user} #{repo_base_path}"
|
"sudo chown -R #{gitolite_ssh_user}:#{gitolite_ssh_user} #{repo_base_path}"
|
||||||
)
|
)
|
||||||
for_more_information(
|
for_more_information(
|
||||||
see_installation_guide_section "Gitolite"
|
see_installation_guide_section "Gitolite"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -772,7 +790,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
"doc/raketasks/maintenance.md"
|
"doc/raketasks/maintenance.md"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -808,11 +826,12 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
"lib/support/rewrite-hooks.sh"
|
"lib/support/rewrite-hooks.sh"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
if run_and_match("stat --format %N #{project_hook_file}", /#{hook_file}.+->.+#{gitolite_hook_file}/)
|
if File.lstat(project_hook_file).symlink? &&
|
||||||
|
File.realpath(project_hook_file) == File.realpath(gitolite_hook_file)
|
||||||
puts "ok".green
|
puts "ok".green
|
||||||
else
|
else
|
||||||
puts "not a link to Gitolite's hook".red
|
puts "not a link to Gitolite's hook".red
|
||||||
|
@ -822,7 +841,7 @@ namespace :gitlab do
|
||||||
for_more_information(
|
for_more_information(
|
||||||
"lib/support/rewrite-hooks.sh"
|
"lib/support/rewrite-hooks.sh"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -831,12 +850,12 @@ namespace :gitlab do
|
||||||
# Helper methods
|
# Helper methods
|
||||||
########################
|
########################
|
||||||
|
|
||||||
def gitolite_home
|
def gitolite_user_home
|
||||||
File.expand_path("~#{Gitlab.config.gitolite.ssh_user}")
|
File.expand_path("~#{Gitlab.config.gitolite.ssh_user}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def gitolite_version
|
def gitolite_version
|
||||||
gitolite_version_file = "#{gitolite_home}/gitolite/src/VERSION"
|
gitolite_version_file = "#{gitolite_user_home}/gitolite/src/VERSION"
|
||||||
if File.readable?(gitolite_version_file)
|
if File.readable?(gitolite_version_file)
|
||||||
File.read(gitolite_version_file)
|
File.read(gitolite_version_file)
|
||||||
end
|
end
|
||||||
|
@ -880,7 +899,7 @@ namespace :gitlab do
|
||||||
see_installation_guide_section("Install Init Script"),
|
see_installation_guide_section("Install Init Script"),
|
||||||
"see log/resque.log for possible errors"
|
"see log/resque.log for possible errors"
|
||||||
)
|
)
|
||||||
check_failed
|
fix_and_rerun
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -889,7 +908,7 @@ namespace :gitlab do
|
||||||
# Helper methods
|
# Helper methods
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
def check_failed
|
def fix_and_rerun
|
||||||
puts " Please #{"fix the error above"} and rerun the checks.".red
|
puts " Please #{"fix the error above"} and rerun the checks.".red
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -908,29 +927,6 @@ namespace :gitlab do
|
||||||
puts ""
|
puts ""
|
||||||
end
|
end
|
||||||
|
|
||||||
# Runs the given command
|
|
||||||
#
|
|
||||||
# Returns nil if the command was not found
|
|
||||||
# Returns the output of the command otherwise
|
|
||||||
#
|
|
||||||
# see also #run_and_match
|
|
||||||
def run(command)
|
|
||||||
unless `#{command} 2>/dev/null`.blank?
|
|
||||||
`#{command}`
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Runs the given command and matches the output agains the given pattern
|
|
||||||
#
|
|
||||||
# Returns nil if nothing matched
|
|
||||||
# Retunrs the MatchData if the pattern matched
|
|
||||||
#
|
|
||||||
# see also #run
|
|
||||||
# see also String#match
|
|
||||||
def run_and_match(command, pattern)
|
|
||||||
run(command).try(:match, pattern)
|
|
||||||
end
|
|
||||||
|
|
||||||
def see_database_guide
|
def see_database_guide
|
||||||
"doc/install/databases.md"
|
"doc/install/databases.md"
|
||||||
end
|
end
|
||||||
|
@ -952,18 +948,4 @@ namespace :gitlab do
|
||||||
puts " #{step}"
|
puts " #{step}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def warn_user_is_not_gitlab
|
|
||||||
unless @warned_user_not_gitlab
|
|
||||||
current_user = run("whoami").chomp
|
|
||||||
unless current_user == "gitlab"
|
|
||||||
puts "#{Colored.color(:black)+Colored.color(:on_yellow)} Warning #{Colored.extra(:clear)}"
|
|
||||||
puts " You are running as user #{current_user.magenta}, we hope you know what you are doing."
|
|
||||||
puts " Some tests may pass\/fail for the wrong reason."
|
|
||||||
puts " For meaningful results you should run this as user #{"gitlab".magenta}."
|
|
||||||
puts ""
|
|
||||||
end
|
|
||||||
@warned_user_not_gitlab = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
128
lib/tasks/gitlab/cleanup.rake
Normal file
128
lib/tasks/gitlab/cleanup.rake
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
namespace :gitlab do
|
||||||
|
namespace :cleanup do
|
||||||
|
desc "GITLAB | Cleanup | Clean gitolite config"
|
||||||
|
task :config => :environment do
|
||||||
|
warn_user_is_not_gitlab
|
||||||
|
|
||||||
|
real_repos = Project.all.map(&:path_with_namespace)
|
||||||
|
real_repos << "gitolite-admin"
|
||||||
|
real_repos << "@all"
|
||||||
|
|
||||||
|
remove_flag = ENV['REMOVE']
|
||||||
|
|
||||||
|
puts "Looking for repositories to remove... "
|
||||||
|
Gitlab::GitoliteConfig.new.apply do |config|
|
||||||
|
all_repos = []
|
||||||
|
garbage_repos = []
|
||||||
|
|
||||||
|
all_repos = config.conf.repos.keys
|
||||||
|
garbage_repos = all_repos - real_repos
|
||||||
|
|
||||||
|
garbage_repos.each do |repo_name|
|
||||||
|
if remove_flag
|
||||||
|
config.conf.rm_repo(repo_name)
|
||||||
|
print "to remove...".red
|
||||||
|
end
|
||||||
|
|
||||||
|
puts repo_name.red
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unless remove_flag
|
||||||
|
puts "To cleanup repositories run this command with REMOVE=true".yellow
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "GITLAB | Cleanup | Clean namespaces"
|
||||||
|
task :dirs => :environment do
|
||||||
|
warn_user_is_not_gitlab
|
||||||
|
remove_flag = ENV['REMOVE']
|
||||||
|
|
||||||
|
|
||||||
|
namespaces = Namespace.pluck(:path)
|
||||||
|
git_base_path = Gitlab.config.gitolite.repos_path
|
||||||
|
all_dirs = Dir.glob(git_base_path + '/*')
|
||||||
|
|
||||||
|
puts git_base_path.yellow
|
||||||
|
puts "Looking for directories to remove... "
|
||||||
|
|
||||||
|
all_dirs.reject! do |dir|
|
||||||
|
# skip if git repo
|
||||||
|
dir =~ /.git$/
|
||||||
|
end
|
||||||
|
|
||||||
|
all_dirs.reject! do |dir|
|
||||||
|
dir_name = File.basename dir
|
||||||
|
|
||||||
|
# skip if namespace present
|
||||||
|
namespaces.include?(dir_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
all_dirs.each do |dir_path|
|
||||||
|
|
||||||
|
if remove_flag
|
||||||
|
if FileUtils.rm_rf dir_path
|
||||||
|
puts "Removed...#{dir_path}".red
|
||||||
|
else
|
||||||
|
puts "Cannot remove #{dir_path}".red
|
||||||
|
end
|
||||||
|
else
|
||||||
|
puts "Can be removed: #{dir_path}".red
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unless remove_flag
|
||||||
|
puts "To cleanup this directories run this command with REMOVE=true".yellow
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "GITLAB | Cleanup | Clean respositories"
|
||||||
|
task :repos => :environment do
|
||||||
|
warn_user_is_not_gitlab
|
||||||
|
remove_flag = ENV['REMOVE']
|
||||||
|
|
||||||
|
git_base_path = Gitlab.config.gitolite.repos_path
|
||||||
|
all_dirs = Dir.glob(git_base_path + '/*')
|
||||||
|
|
||||||
|
global_projects = Project.where(namespace_id: nil).pluck(:path)
|
||||||
|
|
||||||
|
puts git_base_path.yellow
|
||||||
|
puts "Looking for global repos to remove... "
|
||||||
|
|
||||||
|
# skip non git repo
|
||||||
|
all_dirs.select! do |dir|
|
||||||
|
dir =~ /.git$/
|
||||||
|
end
|
||||||
|
|
||||||
|
# skip existing repos
|
||||||
|
all_dirs.reject! do |dir|
|
||||||
|
repo_name = File.basename dir
|
||||||
|
path = repo_name.gsub(/\.git$/, "")
|
||||||
|
global_projects.include?(path)
|
||||||
|
end
|
||||||
|
|
||||||
|
# skip gitolite admin
|
||||||
|
all_dirs.reject! do |dir|
|
||||||
|
repo_name = File.basename dir
|
||||||
|
repo_name == 'gitolite-admin.git'
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
all_dirs.each do |dir_path|
|
||||||
|
if remove_flag
|
||||||
|
if FileUtils.rm_rf dir_path
|
||||||
|
puts "Removed...#{dir_path}".red
|
||||||
|
else
|
||||||
|
puts "Cannot remove #{dir_path}".red
|
||||||
|
end
|
||||||
|
else
|
||||||
|
puts "Can be removed: #{dir_path}".red
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unless remove_flag
|
||||||
|
puts "To cleanup this directories run this command with REMOVE=true".yellow
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,34 +1,87 @@
|
||||||
namespace :gitlab do
|
namespace :gitlab do
|
||||||
desc "GITLAB | Enable usernames and namespaces for user projects"
|
desc "GITLAB | Enable usernames and namespaces for user projects"
|
||||||
task enable_namespaces: :environment do
|
task enable_namespaces: :environment do
|
||||||
print "\nUsernames for users:".yellow
|
warn_user_is_not_gitlab
|
||||||
|
|
||||||
|
migrate_user_namespaces
|
||||||
|
migrate_groups
|
||||||
|
migrate_projects
|
||||||
|
|
||||||
|
puts "Rebuild Gitolite ... "
|
||||||
|
gitolite = Gitlab::Gitolite.new
|
||||||
|
gitolite.update_repositories(Project.where('namespace_id IS NOT NULL'))
|
||||||
|
puts "... #{"done".green}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def migrate_user_namespaces
|
||||||
|
puts "\nGenerate usernames for users without one: ".blue
|
||||||
User.find_each(batch_size: 500) do |user|
|
User.find_each(batch_size: 500) do |user|
|
||||||
next if user.namespace
|
if user.namespace
|
||||||
|
print '-'.cyan
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
User.transaction do
|
username = if user.username.present?
|
||||||
username = user.email.match(/^[^@]*/)[0]
|
# if user already has username filled
|
||||||
if user.update_attributes!(username: username)
|
user.username
|
||||||
print '.'.green
|
|
||||||
else
|
else
|
||||||
|
build_username(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
User.transaction do
|
||||||
|
user.update_attributes!(username: username)
|
||||||
|
print '.'.green
|
||||||
|
end
|
||||||
|
rescue
|
||||||
print 'F'.red
|
print 'F'.red
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
puts "\nDone"
|
||||||
end
|
end
|
||||||
|
|
||||||
print "\n\nDirs for groups:".yellow
|
def build_username(user)
|
||||||
|
username = nil
|
||||||
|
|
||||||
|
# generate username
|
||||||
|
username = user.email.match(/^[^@]*/)[0]
|
||||||
|
username.gsub!("+", ".")
|
||||||
|
|
||||||
|
# return username if no mathes
|
||||||
|
return username unless User.find_by_username(username)
|
||||||
|
|
||||||
|
# look for same username
|
||||||
|
(1..10).each do |i|
|
||||||
|
suffixed_username = "#{username}#{i}"
|
||||||
|
|
||||||
|
return suffixed_username unless User.find_by_username(suffixed_username)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def migrate_groups
|
||||||
|
puts "\nCreate directories for groups: ".blue
|
||||||
|
|
||||||
Group.find_each(batch_size: 500) do |group|
|
Group.find_each(batch_size: 500) do |group|
|
||||||
|
begin
|
||||||
|
if group.dir_exists?
|
||||||
|
print '-'.cyan
|
||||||
|
else
|
||||||
if group.ensure_dir_exist
|
if group.ensure_dir_exist
|
||||||
print '.'.green
|
print '.'.green
|
||||||
else
|
else
|
||||||
print 'F'.red
|
print 'F'.red
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
rescue
|
||||||
|
print 'F'.red
|
||||||
|
end
|
||||||
|
end
|
||||||
|
puts "\nDone"
|
||||||
|
end
|
||||||
|
|
||||||
print "\n\nMove projects from groups under groups dirs:".yellow
|
def migrate_projects
|
||||||
git_path = Gitlab.config.gitolite.repos_path
|
git_path = Gitlab.config.gitolite.repos_path
|
||||||
|
puts "\nMove projects in groups into respective directories ... ".blue
|
||||||
Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project|
|
Project.where('namespace_id IS NOT NULL').find_each(batch_size: 500) do |project|
|
||||||
next unless project.group
|
next unless project.group
|
||||||
|
|
||||||
|
@ -59,9 +112,6 @@ namespace :gitlab do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print "\n\nRebuild gitolite:".yellow
|
puts "\nDone"
|
||||||
gitolite = Gitlab::Gitolite.new
|
|
||||||
gitolite.update_repositories(Project.where('namespace_id IS NOT NULL'))
|
|
||||||
puts "\n"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,17 +3,6 @@ namespace :gitlab do
|
||||||
desc "GITLAB | Show information about GitLab and its environment"
|
desc "GITLAB | Show information about GitLab and its environment"
|
||||||
task info: :environment do
|
task info: :environment do
|
||||||
|
|
||||||
# check which OS is running
|
|
||||||
os_name = run("lsb_release -irs")
|
|
||||||
os_name ||= if File.readable?('/etc/system-release')
|
|
||||||
File.read('/etc/system-release')
|
|
||||||
end
|
|
||||||
os_name ||= if File.readable?('/etc/debian_version')
|
|
||||||
debian_version = File.read('/etc/debian_version')
|
|
||||||
"Debian #{debian_version}"
|
|
||||||
end
|
|
||||||
os_name.squish!
|
|
||||||
|
|
||||||
# check if there is an RVM environment
|
# check if there is an RVM environment
|
||||||
rvm_version = run_and_match("rvm --version", /[\d\.]+/).try(:to_s)
|
rvm_version = run_and_match("rvm --version", /[\d\.]+/).try(:to_s)
|
||||||
# check Ruby version
|
# check Ruby version
|
||||||
|
@ -80,31 +69,5 @@ namespace :gitlab do
|
||||||
puts "Git:\t\t#{Gitlab.config.git.bin_path}"
|
puts "Git:\t\t#{Gitlab.config.git.bin_path}"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Helper methods
|
|
||||||
|
|
||||||
# Runs the given command and matches the output agains the given pattern
|
|
||||||
#
|
|
||||||
# Returns nil if nothing matched
|
|
||||||
# Retunrs the MatchData if the pattern matched
|
|
||||||
#
|
|
||||||
# see also #run
|
|
||||||
# see also String#match
|
|
||||||
def run_and_match(command, regexp)
|
|
||||||
run(command).try(:match, regexp)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Runs the given command
|
|
||||||
#
|
|
||||||
# Returns nil if the command was not found
|
|
||||||
# Returns the output of the command otherwise
|
|
||||||
#
|
|
||||||
# see also #run_and_match
|
|
||||||
def run(command)
|
|
||||||
unless `#{command} 2>/dev/null`.blank?
|
|
||||||
`#{command}`
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
70
lib/tasks/gitlab/task_helpers.rake
Normal file
70
lib/tasks/gitlab/task_helpers.rake
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
namespace :gitlab do
|
||||||
|
|
||||||
|
# Check which OS is running
|
||||||
|
#
|
||||||
|
# It will primarily use lsb_relase to determine the OS.
|
||||||
|
# It has fallbacks to Debian, SuSE and OS X.
|
||||||
|
def os_name
|
||||||
|
os_name = run("lsb_release -irs")
|
||||||
|
os_name ||= if File.readable?('/etc/system-release')
|
||||||
|
File.read('/etc/system-release')
|
||||||
|
end
|
||||||
|
os_name ||= if File.readable?('/etc/debian_version')
|
||||||
|
debian_version = File.read('/etc/debian_version')
|
||||||
|
"Debian #{debian_version}"
|
||||||
|
end
|
||||||
|
os_name ||= if File.readable?('/etc/SuSE-release')
|
||||||
|
File.read('/etc/SuSE-release')
|
||||||
|
end
|
||||||
|
os_name ||= if os_x_version = run("sw_vers -productVersion")
|
||||||
|
"Mac OS X #{os_x_version}"
|
||||||
|
end
|
||||||
|
os_name.try(:squish!)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Runs the given command and matches the output agains the given pattern
|
||||||
|
#
|
||||||
|
# Returns nil if nothing matched
|
||||||
|
# Retunrs the MatchData if the pattern matched
|
||||||
|
#
|
||||||
|
# see also #run
|
||||||
|
# see also String#match
|
||||||
|
def run_and_match(command, regexp)
|
||||||
|
run(command).try(:match, regexp)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Runs the given command
|
||||||
|
#
|
||||||
|
# Returns nil if the command was not found
|
||||||
|
# Returns the output of the command otherwise
|
||||||
|
#
|
||||||
|
# see also #run_and_match
|
||||||
|
def run(command)
|
||||||
|
unless `#{command} 2>/dev/null`.blank?
|
||||||
|
`#{command}`
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def uid_for(user_name)
|
||||||
|
run("id -u #{user_name}").chomp.to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
def gid_for(group_name)
|
||||||
|
group_line = File.read("/etc/group").lines.select{|l| l.start_with?("#{group_name}:")}.first
|
||||||
|
group_line.split(":")[2].to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
def warn_user_is_not_gitlab
|
||||||
|
unless @warned_user_not_gitlab
|
||||||
|
current_user = run("whoami").chomp
|
||||||
|
unless current_user == "gitlab"
|
||||||
|
puts "#{Colored.color(:black)+Colored.color(:on_yellow)} Warning #{Colored.extra(:clear)}"
|
||||||
|
puts " You are running as user #{current_user.magenta}, we hope you know what you are doing."
|
||||||
|
puts " Things may work\/fail for the wrong reasons."
|
||||||
|
puts " For correct results you should run this as user #{"gitlab".magenta}."
|
||||||
|
puts ""
|
||||||
|
end
|
||||||
|
@warned_user_not_gitlab = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -4,6 +4,7 @@ task "resque:setup" => :environment do
|
||||||
Resque.after_fork do
|
Resque.after_fork do
|
||||||
Resque.redis.client.reconnect
|
Resque.redis.client.reconnect
|
||||||
end
|
end
|
||||||
|
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Alias for resque:work (To run workers on Heroku)"
|
desc "Alias for resque:work (To run workers on Heroku)"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue