forked from Banno/graphite-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
82 lines (69 loc) · 2.6 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
banno_version = "banno-0.1.0"
graphite_version = File.read("./carbon-base/Dockerfile").scan(/ENV GRAPHITE_VERSION ([0-9\.]+)/m)[0][0]
## Builders
desc "Builds all docker images"
task :build => ["build:base", "build:cache", "build:web", "build:relay", "build:haproxy"]
namespace :build do
desc "Build the base image"
task :base do
sh "docker build -t banno/carbon-base:#{graphite_version}-#{banno_version} carbon-base"
sh "docker tag banno/carbon-base:#{graphite_version}-#{banno_version} banno/carbon-base:latest"
end
desc "Build the cache image"
task :cache do
sh "docker build -t banno/carbon-cache:#{graphite_version}-#{banno_version} carbon-cache"
sh "docker tag banno/carbon-cache:#{graphite_version}-#{banno_version} banno/carbon-cache:latest"
end
desc "Build the web image"
task :web do
sh "docker build -t banno/graphite-web:#{graphite_version}-#{banno_version} web"
sh "docker tag banno/graphite-web:#{graphite_version}-#{banno_version} banno/graphite-web:latest"
end
desc "Build the relay image"
task :relay do
sh "docker build -t banno/carbon-relay:#{graphite_version}-#{banno_version} carbon-relay"
sh "docker tag banno/carbon-relay:#{graphite_version}-#{banno_version} banno/carbon-relay:latest"
end
desc "Build haproxy proxy"
task :haproxy do
sh "docker build -t banno/graphite-haproxy:#{graphite_version}-#{banno_version} haproxy"
sh "docker tag banno/graphite-haproxy:#{graphite_version}-#{banno_version} banno/graphite-haproxy:latest"
end
end
desc "Push all images to registry"
task :push do
sh "docker push banno/carbon-base:#{graphite_version}-#{banno_version}"
sh "docker push banno/carbon-cache:#{graphite_version}-#{banno_version}"
sh "docker push banno/carbon-relay:#{graphite_version}-#{banno_version}"
sh "docker push banno/graphite-web:#{graphite_version}-#{banno_version}"
sh "docker push banno/graphite-haproxy:#{graphite_version}-#{banno_version}"
end
## testing
desc "Start up the containers, daemonized"
task :up do
sh "docker-compose up -d"
end
desc "Kill the containers"
task :kill do
sh "docker-compose kill"
sh "docker-compose rm --force"
end
desc "Roll the containers"
task :roll do
sh "docker-compose kill"
sh "docker-compose rm --force"
sh "docker-compose up -d"
end
desc "Build test image and run rspec tests"
task :test do
sh "docker-compose build test"
sh "docker-compose run test"
end
desc "Write data to carbon"
task :write_data do
now = Time.now.to_i
(1..1000000).step(50).each do |offset|
stamp = now - offset
sh %<echo "test.d8 #{Random.rand(8)} #{stamp}" | nc -c 192.168.59.103 2003>
end
end