forked from gramos/cf-vagrant-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
106 lines (86 loc) · 2.73 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
require 'rake'
namespace :host do
desc "Initialize repos and vagrant vm"
task :bootstrap => :create_vm
task :create_vm => :update_git_submodules do
puts "==> Create Vagrant base VM using dea_ng scripts"
system "cd dea_ng && bundle install"
system "cd dea_ng && rake test_vm"
end
desc "Init git submodules and clone required repos"
task :update_git_submodules do
puts "==> Init Git submodules"
system "git submodule update --init --recursive"
end
end
namespace :cf do
# -------------------------------------------------------------
# Guest tasks
def root_path
File.expand_path("../", __FILE__)
end
def path(component)
return '/warden/warden' if component == 'warden'
File.expand_path("../#{component}", __FILE__)
end
def bundle_install component_path
puts "==> Runing bundle install at #{component_path}"
Dir.chdir component_path
system "bundle install"
end
def cf_ruby_components
%w(warden cloud_controller_ng dea_ng health_manager)
end
desc "bootstrap all cf components"
task :bootstrap => [:copy_custom_conf_files,
:bundle_install, :init_uaa,
:init_cloud_controller_ng, :init_gorouter ]
desc "Install required gems for all ruby components"
task :bundle_install do
cf_ruby_components.each{|c| bundle_install path(c)}
system "gem install cf"
end
desc "Init cloud_controller_ng database"
task :init_cloud_controller_ng do
puts "Initializing cloud_controller_ng database."
Dir.chdir root_path + '/cloud_controller_ng'
system "sudo -E bundle exec rake db:migrate"
end
desc "Init gorouter"
task :init_gorouter do
Dir.chdir root_path + '/gorouter'
system "./bin/go install router/router"
end
desc "Init uaa"
task :init_uaa => [:clone_uua_repo, :install_uua_required_pkgs]
desc "Clone uaa repo"
task :clone_uua_repo do
Dir.chdir root_path
system "git clone git://github.com/cloudfoundry/uaa.git"
end
desc "Install uaa required packages"
task :install_uua_required_pkgs do
system "sudo apt-get install --yes maven"
end
def cf_components
cf_ruby_components + %w(uaa gorouter)
end
desc "copy custom config files"
task :copy_custom_conf_files do
cf_components.each do |c|
cmd = "cp #{root_path}/custom_config_files/#{c}/*.yml #{root_path}/#{c}/config/"
puts "==> Copying #{c} config file"
puts "==> #{cmd}"
system cmd
end
end
desc "Set target, login and create organization and spaces. CF must be up and running"
task :init_cf_cli do
puts "==> Initializing cf CLI"
system "#{root_path}/bin/init-cf-cli"
puts "\n\nNow you can try to push the example app, like this:"
puts ""
puts "> cd /vagrant/sinatra-test-app"
puts "> cf push"
end
end