harbr 0.0.78 → 0.0.80
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/harbr +3 -3
- data/lib/harbr/next/job.rb +38 -43
- data/lib/harbr/version.rb +1 -1
- 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: faf169d8747490a5212c404ba4ae0ccf82009544bb5d0b6b0e888d425cba64a4
|
4
|
+
data.tar.gz: 35b2f2767321282d31d24bd37b6e6d811c235dde939eed1c50e4ae2fad8e3f98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d61e0272279a4c362d282771e0b155022b47dc40ef514a760b51e4d5c90e1785891e02e806da5261c1845d411d5a5ab8abce4e2bf5af24ee6b7db6fc6aef8a3d
|
7
|
+
data.tar.gz: cedb23c1d39e632d24d4cfbeb377474a763b5bfdcc2d7430ee49c120c672fb70e6704d954f8bf724b506289f051fd3f30a842f887db326156f52712c083a1feb
|
data/exe/harbr
CHANGED
@@ -60,12 +60,12 @@ class HarbrCLI < Thor
|
|
60
60
|
puts "Container '#{container}', Version '#{version}' is already placed."
|
61
61
|
else
|
62
62
|
puts "Placing container: '#{container}', Version: '#{version}'"
|
63
|
-
|
63
|
+
run_jobs(container, version)
|
64
64
|
File.open(PLACED_FILE, "a") { |file| file.puts("#{container}/#{version}") }
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
def
|
68
|
+
def run_jobs(container, version)
|
69
69
|
puts "Running tasks for container: #{container}, version: #{version}"
|
70
70
|
puts "waiting for 3 seconds"
|
71
71
|
sleep 3
|
@@ -176,7 +176,7 @@ class HarbrCLI < Thor
|
|
176
176
|
|
177
177
|
loop do
|
178
178
|
current_state = scan_for_containers
|
179
|
-
new_versions = current_state.keys - last_known_state.
|
179
|
+
new_versions = current_state.keys - last_known_state.keys
|
180
180
|
|
181
181
|
new_versions.each do |container_version|
|
182
182
|
container, version = container_version.split("/versions/")
|
data/lib/harbr/next/job.rb
CHANGED
@@ -12,7 +12,7 @@ module Harbr
|
|
12
12
|
directories = Dir.glob("#{path}/*").select { |entry| File.directory?(entry) }
|
13
13
|
directories.max_by { |entry| entry[/\d+/].to_i }
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def get_container_name(path)
|
17
17
|
File.basename(path)
|
18
18
|
end
|
@@ -182,51 +182,46 @@ module Harbr
|
|
182
182
|
OpenStruct.new(manifest_data)
|
183
183
|
end
|
184
184
|
|
185
|
-
def perform
|
185
|
+
def perform(name, version)
|
186
186
|
`bundle config set --local path 'vendor/bundle'`
|
187
|
-
|
188
|
-
|
189
|
-
|
187
|
+
|
188
|
+
container_path = "/var/harbr/containers/#{name}/versions/#{version}"
|
189
|
+
latest_version = highest_numbered_directory("#{container_path}/versions")
|
190
190
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
containers = collate_containers("next.#{name}","next.#{manifest.host}",port)
|
223
|
-
create_traefik_config(containers)
|
224
|
-
end
|
225
|
-
|
226
|
-
puts "process #{version} of #{name}"
|
227
|
-
end
|
191
|
+
version = get_container_name(latest_version)
|
192
|
+
name = get_container_name(container_path)
|
193
|
+
manifest = load_manifest(name,version)
|
194
|
+
current_path = "/var/harbr/containers/#{name}/versions/#{version}"
|
195
|
+
|
196
|
+
port = `port assign next.#{manifest.port}`.strip
|
197
|
+
|
198
|
+
Dir.chdir current_path do
|
199
|
+
|
200
|
+
system "sv stop #{name}"
|
201
|
+
system "bundle install"
|
202
|
+
|
203
|
+
`mkdir -p /etc/sv/harbr/#{name}/next`
|
204
|
+
`mkdir -p /etc/sv/harbr/#{name}/next/log`
|
205
|
+
`mkdir -p /var/log/harbr/#{name}/next/log`
|
206
|
+
|
207
|
+
write_to_file "/etc/sv/harbr/#{name}/next/run", Runit::Next::Run.new(name,port).to_s
|
208
|
+
write_to_file "/etc/sv/harbr/#{name}/next/finish", Runit::Finish.new(port).to_s
|
209
|
+
write_to_file "/etc/sv/harbr/#{name}/next/log/run", Runit::Next::Log.new(name).to_s
|
210
|
+
|
211
|
+
`chmod +x /etc/sv/harbr/#{name}/next/run`
|
212
|
+
`chmod +x /etc/sv/harbr/#{name}/next/log/run`
|
213
|
+
`chmod +x /etc/sv/harbr/#{name}/next/finish`
|
214
|
+
|
215
|
+
|
216
|
+
system "ln -s /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/next"
|
217
|
+
system "ln -s /etc/sv/harbr/#{name}/next /etc/service/next.#{name}"
|
218
|
+
|
219
|
+
containers = collate_containers("next.#{name}","next.#{manifest.host}",port)
|
220
|
+
create_traefik_config(containers)
|
228
221
|
end
|
229
|
-
|
222
|
+
|
223
|
+
puts "process #{version} of #{name}"
|
224
|
+
|
230
225
|
end
|
231
226
|
|
232
227
|
end
|
data/lib/harbr/version.rb
CHANGED