www-apps/gitlab-ce:

added ebuild for gitlab-8.12.7 and incorporated the following patches from Jakub:
- 0002-default-configs.patch
- 0005-fix-check-task.patch
- 0006-replace-sys-filesystem.patch

Package-Manager: portage-2.3.0
This commit is contained in:
Manuel Friedli 2016-10-21 08:09:18 +02:00
parent a024391bc7
commit 28707520aa
13 changed files with 243 additions and 67 deletions

View file

@ -0,0 +1,92 @@
diff --git a/config/database.yml.mysql b/config/database.yml.mysql
index a99c507..0f081c8 100644
--- a/config/database.yml.mysql
+++ b/config/database.yml.mysql
@@ -6,37 +6,9 @@ production:
encoding: utf8
collation: utf8_general_ci
reconnect: false
- database: gitlabhq_production
+ database: gitlab
pool: 10
username: git
password: "secure password"
# host: localhost
- # socket: /tmp/mysql.sock
-
-#
-# Development specific
-#
-development:
- adapter: mysql2
- encoding: utf8
- collation: utf8_general_ci
- reconnect: false
- database: gitlabhq_development
- pool: 5
- username: root
- password: "secure password"
- # socket: /tmp/mysql.sock
-
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
-test: &test
- adapter: mysql2
- encoding: utf8
- collation: utf8_general_ci
- reconnect: false
- database: gitlabhq_test
- pool: 5
- username: root
- password:
- # socket: /tmp/mysql.sock
+ # socket: /run/mysqld/mysqld.sock
diff --git a/config/database.yml.postgresql b/config/database.yml.postgresql
index 7067e0f..74af7df 100644
--- a/config/database.yml.postgresql
+++ b/config/database.yml.postgresql
@@ -4,42 +4,9 @@
production:
adapter: postgresql
encoding: unicode
- database: gitlabhq_production
+ database: gitlab
pool: 10
# username: git
# password:
# host: localhost
# port: 5432
-
-#
-# Development specific
-#
-development:
- adapter: postgresql
- encoding: unicode
- database: gitlabhq_development
- pool: 5
- username: postgres
- password:
-
-#
-# Staging specific
-#
-staging:
- adapter: postgresql
- encoding: unicode
- database: gitlabhq_staging
- pool: 5
- username: postgres
- password:
-
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
-test: &test
- adapter: postgresql
- encoding: unicode
- database: gitlabhq_test
- pool: 5
- username: postgres
- password:

View file

@ -0,0 +1,27 @@
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 5f4a6bb..8f75d2b 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -24,7 +24,7 @@ namespace :gitlab do
check_tmp_writable
check_uploads
check_init_script_exists
- check_init_script_up_to_date
+ #check_init_script_up_to_date Gentoo uses a different init script
check_projects_have_namespace
check_redis_version
check_ruby_version
@@ -590,13 +590,6 @@ namespace :gitlab do
puts "yes".color(:green)
else
puts "no".color(:red)
- try_fixing_it(
- sudo_gitlab("RAILS_ENV=production bin/background_jobs start")
- )
- for_more_information(
- see_installation_guide_section("Install Init Script"),
- "see log/sidekiq.log for possible errors"
- )
fix_and_rerun
end
end

View file

@ -0,0 +1,77 @@
diff --git a/Gemfile b/Gemfile
index 4a517b2..ed6fc2e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -352,4 +352,4 @@ gem 'health_check', '~> 2.1.0'
# System information
gem 'vmstat', '~> 2.2'
-gem 'sys-filesystem', '~> 1.1.6'
+gem 'sys-filesystem', '~> 1.1.6', group: :exclude
diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb
index ca04a17..0e36b12 100644
--- a/app/controllers/admin/system_info_controller.rb
+++ b/app/controllers/admin/system_info_controller.rb
@@ -1,3 +1,5 @@
+require 'open3'
+
class Admin::SystemInfoController < Admin::ApplicationController
EXCLUDED_MOUNT_OPTIONS = [
'nobrowse',
@@ -28,10 +30,14 @@ class Admin::SystemInfoController < Admin::ApplicationController
'vfat'
]
+ MOUNT_REGEX = /(\S+) on (\S+) type (\S+) \(([^)]+)\)/
+
+ Mount = Struct.new('Mount', :name, :mount_point, :mount_type, :options)
+ FsStat = Struct.new('FsStats', :path, :bytes_total, :bytes_used)
+
def show
@cpus = Vmstat.cpu rescue nil
@memory = Vmstat.memory rescue nil
- mounts = Sys::Filesystem.mounts
@disks = []
mounts.each do |mount|
@@ -41,15 +47,38 @@ class Admin::SystemInfoController < Admin::ApplicationController
next if (EXCLUDED_MOUNT_TYPES & [mount.mount_type]).any?
begin
- disk = Sys::Filesystem.stat(mount.mount_point)
+ disk = fs_stat(mount.mount_point)
@disks.push({
bytes_total: disk.bytes_total,
bytes_used: disk.bytes_used,
disk_name: mount.name,
mount_path: disk.path
})
- rescue Sys::Filesystem::Error
+ rescue IOError
end
end
end
+
+ def mounts
+ stdout, stderr, status = Open3.capture3('mount')
+ fail IOError, stderr unless status.success?
+
+ stdout.lines
+ .map { |line| MOUNT_REGEX.match(line) }
+ .compact
+ .map { |match| Mount.new(*match.captures) }
+ end
+
+ def fs_stat(mount_point)
+ stdout, status = Open3.capture2('stat', '-c', '%s %b %a', '-f', mount_point)
+ fail IOError unless status.success?
+
+ block_size, blocks_total, blocks_free = stdout.split(' ').map(&:to_i)
+
+ bytes_total = blocks_total * block_size
+ bytes_free = blocks_free * block_size
+ bytes_used = bytes_total - bytes_free
+
+ FsStat.new(mount_point, bytes_total, bytes_used)
+ end
end

View file

@ -1,44 +0,0 @@
diff --git a/database.yml b/database.yml
index a99c507..0f081c8 100644
--- a/database.yml
+++ b/database.yml
@@ -6,37 +6,9 @@ production:
encoding: utf8
collation: utf8_general_ci
reconnect: false
- database: gitlabhq_production
+ database: gitlab
pool: 10
username: git
password: "secure password"
# host: localhost
- # socket: /tmp/mysql.sock
-
-#
-# Development specific
-#
-development:
- adapter: mysql2
- encoding: utf8
- collation: utf8_general_ci
- reconnect: false
- database: gitlabhq_development
- pool: 5
- username: root
- password: "secure password"
- # socket: /tmp/mysql.sock
-
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
-test: &test
- adapter: mysql2
- encoding: utf8
- collation: utf8_general_ci
- reconnect: false
- database: gitlabhq_test
- pool: 5
- username: root
- password:
- # socket: /tmp/mysql.sock
+ # socket: /run/mysqld/mysqld.sock