Commit 23a8e59938477be9938ed96176e8f9220ca78471

Authored by Riyad Preukschas
1 parent 552c2d66

Improve gitlab:env:info task

Renamed from gitlab:app:info
Add several extra info points
doc/raketasks/maintenance.md
... ... @@ -11,42 +11,55 @@ bundle exec rake gitlab:app:setup
11 11 ```
12 12  
13 13  
14   -### Gather Information about GitLab Installation
  14 +### Gather information about GitLab and the system it runs on
15 15  
16   -This command gathers information about your GitLab installation. These can be used in issue reports.
  16 +This command gathers information about your GitLab installation and the System
  17 +it runs on. These may be useful when asking for help or reporting issues.
17 18  
18 19 ```
19   -bundle exec rake gitlab:app:info
  20 +bundle exec rake gitlab:env:info
20 21 ```
21 22  
22 23 Example output:
23 24  
24 25 ```
25   -Gitlab information
26   -Version: 4.0.0pre
27   -Resivion: 8022628
28   -
29 26 System information
30   -System: Debian6.0.6
31   -Home: /home/gitlab
32   -User: gitlab
33   -Ruby: ruby-1.9.3-p286
34   -Gems: 1.8.24
  27 +System: Debian 6.0.6
  28 +Current User: gitlab
  29 +Using RVM: yes
  30 +RVM Version: 1.17.2
  31 +Ruby Version: ruby-1.9.3-p327
  32 +Gem Version: 1.8.24
  33 +Bundler Version:1.2.3
  34 +Rake Version: 10.0.1
  35 +
  36 +GitLab information
  37 +Version: 3.1.0
  38 +Resivion: fd5141d
  39 +Directory: /home/gitlab/gitlab
  40 +DB Adapter: mysql2
  41 +URL: http://localhost:3000
  42 +HTTP Clone URL: http://localhost:3000/some-project.git
  43 +SSH Clone URL: git@localhost:some-project.git
  44 +Using LDAP: no
  45 +Using Omniauth: no
35 46  
36 47 Gitolite information
37   -Version: v3.04-4-g4524f01
38   -Admin URI: git@localhost:gitolite-admin
39   -Base Path: /home/git/repositories/
40   -Hook Path: /home/git/.gitolite/hooks/
41   -Git: /usr/bin/git
  48 +Version: v3.04-4-g4524f01
  49 +Admin URI: git@localhost:gitolite-admin
  50 +Admin Key: gitlab
  51 +Repositories: /home/git/repositories/
  52 +Hooks: /home/git/.gitolite/hooks/
  53 +Git: /usr/bin/git
42 54 ```
43 55  
  56 +
44 57 ### Check GitLab installation status
45 58  
46 59 [Trouble-Shooting-Guide](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide)
47 60  
48 61 ```
49   -bundle exec rake gitlab:app:status
  62 +bundle exec rake gitlab:check
50 63 ```
51 64  
52 65 Example output:
... ...
lib/tasks/gitlab/info.rake
1 1 namespace :gitlab do
2   - namespace :app do
3   - desc "GITLAB | Get Information about this installation"
  2 + namespace :env do
  3 + desc "GITLAB | Show information about GitLab and its environment"
4 4 task :info => :environment do
5 5  
6   - puts ""
7   - puts "Gitlab information".yellow
8   - puts "Version:\t#{Gitlab::Version}"
9   - puts "Revision:\t#{Gitlab::Revision}"
10   -
11   - # check which os is running
  6 + # check which OS is running
12 7 if Kernel.system('lsb_release > /dev/null 2>&1')
13 8 os_name = `lsb_release -irs`
14 9 elsif File.exists?('/etc/system-release') && File.readable?('/etc/system-release')
... ... @@ -19,7 +14,50 @@ namespace :gitlab do
19 14 end
20 15 os_name = os_name.gsub(/\n/, '')
21 16  
22   - # check gitolite version
  17 + # check if there is an RVM environment
  18 + m, rvm_version = `rvm --version`.match(/rvm ([\d\.]+) /).to_a
  19 + # check Bundler version
  20 + m, bunder_version = `bundle --version`.match(/Bundler version ([\d\.]+)/).to_a
  21 + # check Bundler version
  22 + m, rake_version = `rake --version`.match(/rake, version ([\d\.]+)/).to_a
  23 +
  24 + puts ""
  25 + puts "System information".yellow
  26 + puts "System:\t\t#{os_name}"
  27 + puts "Current User:\t#{`whoami`}"
  28 + puts "Using RVM:\t#{rvm_version.present? ? "yes".green : "no"}"
  29 + puts "RVM Version:\t#{rvm_version}" if rvm_version.present?
  30 + puts "Ruby Version:\t#{ENV['RUBY_VERSION']}"
  31 + puts "Gem Version:\t#{`gem --version`}"
  32 + puts "Bundler Version:#{bunder_version}"
  33 + puts "Rake Version:\t#{rake_version}"
  34 +
  35 +
  36 + # check database adapter
  37 + database_adapter = ActiveRecord::Base.connection.adapter_name.downcase
  38 +
  39 + project = Project.new(path: "some-project")
  40 + project.path = "some-project"
  41 + # construct clone URLs
  42 + http_clone_url = project.http_url_to_repo
  43 + ssh_clone_url = project.ssh_url_to_repo
  44 +
  45 + puts ""
  46 + puts "GitLab information".yellow
  47 + puts "Version:\t#{Gitlab::Version}"
  48 + puts "Revision:\t#{Gitlab::Revision}"
  49 + puts "Directory:\t#{Rails.root}"
  50 + puts "DB Adapter:\t#{database_adapter}"
  51 + puts "URL:\t\t#{Gitlab.config.url}"
  52 + puts "HTTP Clone URL:\t#{http_clone_url}"
  53 + puts "SSH Clone URL:\t#{ssh_clone_url}"
  54 + puts "Using LDAP:\t#{Gitlab.config.ldap_enabled? ? "yes".green : "no"}"
  55 + puts "Using Omniauth:\t#{Gitlab.config.omniauth_enabled? ? "yes".green : "no"}"
  56 + puts "Omniauth Providers:\t#{Gitlab.config.omniauth_providers}" if Gitlab.config.omniauth_enabled?
  57 +
  58 +
  59 +
  60 + # check Gitolite version
23 61 gitolite_version_file = "#{Gitlab.config.git_base_path}/../gitolite/src/VERSION"
24 62 if File.exists?(gitolite_version_file) && File.readable?(gitolite_version_file)
25 63 gitolite_version = File.read(gitolite_version_file)
... ... @@ -28,19 +66,12 @@ namespace :gitlab do
28 66 end
29 67  
30 68 puts ""
31   - puts "System information".yellow
32   - puts "System:\t\t#{os_name}"
33   - puts "Home:\t\t#{ENV['HOME']}"
34   - puts "User:\t\t#{ENV['LOGNAME']}"
35   - puts "Ruby:\t\t#{ENV['RUBY_VERSION']}"
36   - puts "Gems:\t\t#{`gem --version`}"
37   -
38   - puts ""
39 69 puts "Gitolite information".yellow
40 70 puts "Version:\t#{gitolite_version}"
41   - puts "Admin URI:\t#{Gitlab.config.git_host.admin_uri}"
42   - puts "Base Path:\t#{Gitlab.config.git_base_path}"
43   - puts "Hook Path:\t#{Gitlab.config.git_hooks_path}"
  71 + puts "Admin URI:\t#{Gitlab.config.gitolite_admin_uri}"
  72 + puts "Admin Key:\t#{Gitlab.config.gitolite_admin_key}"
  73 + puts "Repositories:\t#{Gitlab.config.git_base_path}"
  74 + puts "Hooks:\t\t#{Gitlab.config.git_hooks_path}"
44 75 puts "Git:\t\t#{Gitlab.config.git.path}"
45 76  
46 77 end
... ...