harbr 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/harbr/version.rb +1 -1
- data/lib/harbr.rb +42 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bf43c388ba400dbb6f749a1e5849b4b19caaf54c172a598bbe3abb6b009d0f9
|
4
|
+
data.tar.gz: 77853307c0b34b99e4d610cf8d55a9f3cc944d819022ddbf1183ae326895fcc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d97ad5384477376bd00dedff98e59a2e0bb8ea2cfe2529609b65e576a533a1ff2ec0a3f530209637245218a0e26233fac47b1214124ae766eb5812265300a908
|
7
|
+
data.tar.gz: 5c3c1e3cf128de073a8278c09a7ee376f5181ccb3c00c88ce07240d49fd87a6b8706a02b40e3296684451bbf70a8b39f97f1a7dac734faa8f257ffcb8c122578
|
data/lib/harbr/version.rb
CHANGED
data/lib/harbr.rb
CHANGED
@@ -19,29 +19,17 @@ module Harbr
|
|
19
19
|
class Error < StandardError; end
|
20
20
|
|
21
21
|
class Container
|
22
|
+
|
23
|
+
queries do
|
24
|
+
def find_by_header(host_header)
|
25
|
+
all.find { |container| container.host_header.downcase == host_header.downcase }
|
26
|
+
end
|
27
|
+
end
|
22
28
|
class Job
|
23
29
|
include SuckerPunch::Job
|
24
30
|
|
25
31
|
def perform(manifest)
|
26
|
-
|
27
|
-
puts "Starting container: #{manifest.name}"
|
28
|
-
|
29
|
-
Dddr.configure do |config|
|
30
|
-
config.data_dir = Harbr::DEFAULT_DIRECTORY_DATA_DIR
|
31
|
-
end
|
32
|
-
|
33
|
-
pool = Harbr::Port::Pool.new
|
34
|
-
port = pool.get_port(manifest.host)
|
35
|
-
|
36
|
-
create_a_service(manifest.name, port.number)
|
37
|
-
|
38
|
-
|
39
|
-
sleep 5
|
40
|
-
system("sv restart #{manifest.name}")
|
41
|
-
sleep 5
|
42
|
-
system("sv status #{manifest.name}")
|
43
|
-
puts "Started container: #{manifest.name}"
|
44
|
-
|
32
|
+
run_container(manifest)
|
45
33
|
end
|
46
34
|
|
47
35
|
|
@@ -97,6 +85,41 @@ module Harbr
|
|
97
85
|
system("ln -s /etc/sv/harbr/#{container_name} /etc/service/#{container_name}") unless File.exist?("/etc/service/#{container_name}")
|
98
86
|
end
|
99
87
|
|
88
|
+
def run_container(manifest)
|
89
|
+
|
90
|
+
puts "Starting container: #{manifest.name}"
|
91
|
+
|
92
|
+
Dddr.configure do |config|
|
93
|
+
config.data_dir = Harbr::DEFAULT_DIRECTORY_DATA_DIR
|
94
|
+
end
|
95
|
+
|
96
|
+
pool = Harbr::Port::Pool.new
|
97
|
+
port = pool.get_port(manifest.host)
|
98
|
+
|
99
|
+
create_a_service(manifest.name, port.number)
|
100
|
+
|
101
|
+
|
102
|
+
sleep 5
|
103
|
+
system("sv restart #{manifest.name}")
|
104
|
+
sleep 5
|
105
|
+
system("sv status #{manifest.name}")
|
106
|
+
puts "Started container: #{manifest.name}"
|
107
|
+
|
108
|
+
|
109
|
+
container = Container.new
|
110
|
+
containers = Container::Repository.new
|
111
|
+
|
112
|
+
container.name = manifest.name
|
113
|
+
container.host_header = manifest.host
|
114
|
+
container.ip = manifest.ip
|
115
|
+
container.port = port.number
|
116
|
+
containers.add(container) unless containers.find_by_header(manifest.host)
|
117
|
+
|
118
|
+
puts "Started container: #{manifest.name}"
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
|
100
123
|
|
101
124
|
end
|
102
125
|
|