This repository has been archived by the owner on May 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
102 lines (82 loc) · 3.05 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
namespace :docker do
desc 'Start docker environment'
task :start do
system "sudo docker-compose -f /vagrant/docker-compose.yml up -d"
end
desc 'Stop docker environment'
task :stop do
system "sudo docker-compose -f /vagrant/docker-compose.yml stop"
end
desc 'Restart docker environment'
task :restart do
system "sudo docker-compose -f /vagrant/docker-compose.yml restart"
end
end
namespace :indexes do
desc 'Generate and import indexes'
task :generate do
system 'makelogs -c 1500 -localhost:9200 --indexPrefix customera- --verbose'
system 'makelogs -c 1500 -localhost:9200 --indexPrefix customerb- --verbose'
system 'makelogs -c 1500 -localhost:9200 --indexPrefix customerc- --verbose'
end
desc 'Generate and import lots more indexes'
task :generate_lots do
system 'makelogs -c 15000 -localhost:9200 --indexPrefix customera- --verbose'
system 'makelogs -c 15000 -localhost:9200 --indexPrefix customerb- --verbose'
system 'makelogs -c 15000 -localhost:9200 --indexPrefix customerc- --verbose'
end
desc 'Purge indexes'
task :purge do
system "curl -XDELETE 'http://localhost:9200/customera-*/'"
system "curl -XDELETE 'http://localhost:9200/customerb-*/'"
system "curl -XDELETE 'http://localhost:9200/customerc-*/'"
end
desc 'List indexes (full)'
task :listfull do
system "curl -XGET 'http://localhost:9200/_all?pretty'"
end
desc 'List indexes (short)'
task :listshort do
system "curator --host localhost show indices --timestring %Y.%m.%d"
end
desc 'List indexes older than 10 days'
task :listold do
system "curator --host localhost show indices --timestring %Y.%m.%d --time-unit days --older-than 10"
end
desc 'Close indexes older than 10 days'
task :close do
system "curator --host localhost close indices --timestring %Y.%m.%d --time-unit days --older-than 10"
end
desc 'Open all indexes'
task :open do
system "curator --host localhost open indices --all-indices"
end
desc 'Open indexes older than 10 days'
task :openold do
system "curator --host localhost open indices --timestring %Y.%m.%d --time-unit days --older-than 10"
end
end
namespace :buckler do
desc 'Build buckler'
task :build do
system "git clone https://github.com/kumina/Buckler-project.git src/buckler-project"
system "virtualenv --no-site-packages src/buckler-project/"
system "src/buckler-project/bin/pip install zc.buildout && src/buckler-project/bin/buildout -n -c src/buckler-project/development.cfg"
system "cp /vagrant/buckler_config.py src/buckler-project/Buckler/settings/config.py"
end
desc 'Start buckler'
task :start do
system "src/buckler-project/bin/django runserver 0.0.0.0:8000 > src/buckler_output.log 2>&1 &"
end
desc 'Stop buckler'
task :stop do
system "ps aux | grep django | grep -v grep | awk {'print $2'} | xargs kill"
end
end
task :default => :usage
desc 'Show usage'
task :usage do
system "rake -T"
end
desc 'Setup test environment'
task :setupenv => [ 'docker:start', 'indexes:generate', 'buckler:build', 'buckler:start']