2017-03-13 10:04:46 -04:00
|
|
|
namespace :gitlab do
|
|
|
|
namespace :gitaly do
|
|
|
|
desc "GitLab | Install or upgrade gitaly"
|
2018-01-24 03:12:33 -05:00
|
|
|
task :install, [:dir, :repo] => :gitlab_environment do |t, args|
|
2018-02-21 06:39:15 -05:00
|
|
|
require 'toml-rb'
|
2017-04-10 17:33:41 -04:00
|
|
|
|
2017-03-13 10:04:46 -04:00
|
|
|
warn_user_is_not_gitlab
|
2018-01-11 11:34:01 -05:00
|
|
|
|
2017-03-13 10:04:46 -04:00
|
|
|
unless args.dir.present?
|
|
|
|
abort %(Please specify the directory where you want to install gitaly:\n rake "gitlab:gitaly:install[/home/git/gitaly]")
|
|
|
|
end
|
2018-01-11 11:34:01 -05:00
|
|
|
|
2017-05-02 12:58:37 -04:00
|
|
|
args.with_defaults(repo: 'https://gitlab.com/gitlab-org/gitaly.git')
|
2017-03-13 10:04:46 -04:00
|
|
|
|
2017-04-10 19:15:48 -04:00
|
|
|
version = Gitlab::GitalyClient.expected_server_version
|
2017-03-13 10:04:46 -04:00
|
|
|
|
2017-05-02 12:58:37 -04:00
|
|
|
checkout_or_clone_version(version: version, repo: args.repo, target_dir: args.dir)
|
2017-03-13 10:04:46 -04:00
|
|
|
|
2017-11-21 12:45:36 -05:00
|
|
|
command = %w[/usr/bin/env -u RUBYOPT -u BUNDLE_GEMFILE]
|
|
|
|
|
2017-03-13 10:04:46 -04:00
|
|
|
_, status = Gitlab::Popen.popen(%w[which gmake])
|
2017-11-21 12:45:36 -05:00
|
|
|
command << (status.zero? ? 'gmake' : 'make')
|
2017-08-10 12:24:44 -04:00
|
|
|
|
2018-01-23 12:21:57 -05:00
|
|
|
if Rails.env.test?
|
|
|
|
command.push(
|
|
|
|
'BUNDLE_FLAGS=--no-deployment',
|
|
|
|
"BUNDLE_PATH=#{Bundler.bundle_path}")
|
|
|
|
end
|
2017-03-13 10:04:46 -04:00
|
|
|
|
2018-01-05 06:31:12 -05:00
|
|
|
Gitlab::SetupHelper.create_gitaly_configuration(args.dir)
|
2017-03-13 10:04:46 -04:00
|
|
|
Dir.chdir(args.dir) do
|
2017-07-31 09:17:14 -04:00
|
|
|
# In CI we run scripts/gitaly-test-build instead of this command
|
|
|
|
unless ENV['CI'].present?
|
2017-11-21 12:45:36 -05:00
|
|
|
Bundler.with_original_env { run_command!(command) }
|
2017-07-31 09:17:14 -04:00
|
|
|
end
|
2017-03-13 10:04:46 -04:00
|
|
|
end
|
|
|
|
end
|
2017-04-04 10:06:07 -04:00
|
|
|
|
|
|
|
desc "GitLab | Print storage configuration in TOML format"
|
|
|
|
task storage_config: :environment do
|
2018-02-21 06:39:15 -05:00
|
|
|
require 'toml-rb'
|
2017-04-04 10:06:07 -04:00
|
|
|
|
|
|
|
puts "# Gitaly storage configuration generated from #{Gitlab.config.source} on #{Time.current.to_s(:long)}"
|
|
|
|
puts "# This is in TOML format suitable for use in Gitaly's config.toml file."
|
|
|
|
|
2017-07-31 09:17:14 -04:00
|
|
|
# Exclude gitaly-ruby configuration because that depends on the gitaly
|
|
|
|
# installation directory.
|
2018-01-05 06:31:12 -05:00
|
|
|
puts Gitlab::SetupHelper.gitaly_configuration_toml('', gitaly_ruby: false)
|
2017-04-10 17:33:41 -04:00
|
|
|
end
|
2017-03-13 10:04:46 -04:00
|
|
|
end
|
|
|
|
end
|