setup.rake 966 Bytes
Newer Older
1
namespace :gitlab do
2
  desc "GitLab | Setup production application"
3
  task setup: :gitlab_environment do
4
    check_gitaly_connection
5
    setup_db
6
  end
7

8 9 10 11 12 13 14 15 16 17
  def check_gitaly_connection
    Gitlab.config.repositories.storages.each do |name, _details|
      Gitlab::GitalyClient::ServerService.new(name).info
    end
  rescue GRPC::Unavailable => ex
    puts "Failed to connect to Gitaly...".color(:red)
    puts "Error: #{ex}"
    exit 1
  end

18
  def setup_db
19
    warn_user_is_not_gitlab
20

21 22 23 24 25 26
    unless ENV['force'] == 'yes'
      puts "This will create the necessary database tables and seed the database."
      puts "You will lose any previous data stored in the database."
      ask_to_continue
      puts ""
    end
27

28
    Rake::Task["db:reset"].invoke
29
    Rake::Task["add_limits_mysql"].invoke
30
    Rake::Task["setup_postgresql"].invoke
31 32
    Rake::Task["db:seed_fu"].invoke
  rescue Gitlab::TaskAbortedByUserError
Connor Shea's avatar
Connor Shea committed
33
    puts "Quitting...".color(:red)
34
    exit 1
35 36
  end
end