harbr 0.1.78 → 0.1.79
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/harbr/job.rb +35 -34
- data/lib/harbr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37b87fce15b28fc1fcb24fb58991bbaa6fbba945e322547791eccf2208af9416
|
4
|
+
data.tar.gz: 6aa9c0d7e8206ef7bf2332548430b6f7d0f61d553ca2ff13dd403f9636b1d63b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca12a0b31514c3e67781db39286a9021451b0bc2e1160179f0b30069a17d69c972f75de6a0506038613e133e2ecaae54db363222055f944686d59525f982058
|
7
|
+
data.tar.gz: 851bdb11d33038299231fc654181dfc73c1eaac4fd374e7ef46077e58b2b6b3b9b98ea2d0e90684a4a42e94d32cec827c94cd96df8654d9575d8d7118bdd0e39
|
data/lib/harbr/job.rb
CHANGED
@@ -42,7 +42,7 @@ module Harbr
|
|
42
42
|
def collate_containers(name, host, port, host_header_aliases = [])
|
43
43
|
containers = Harbr::Container::Repository.new
|
44
44
|
container = containers.find_by_header(host)
|
45
|
-
|
45
|
+
|
46
46
|
if container.nil?
|
47
47
|
container = Harbr::Container.new
|
48
48
|
container.name = name
|
@@ -50,22 +50,23 @@ module Harbr
|
|
50
50
|
container.ip = "127.0.0.1"
|
51
51
|
container.port = port
|
52
52
|
containers.create(container)
|
53
|
-
|
53
|
+
|
54
54
|
else
|
55
55
|
container.port = port
|
56
56
|
containers.update(container)
|
57
57
|
end
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
if host_header_alias
|
60
|
+
host_header_aliases.each do |host_header_alias|
|
61
|
+
container = Harbr::Container.new
|
62
|
+
container.name = "#{name} -> #{host_header_alias}"
|
63
|
+
container.host_header = host_header_alias
|
64
|
+
container.ip = "127.0.0.1"
|
65
|
+
container.port = port
|
66
|
+
containers.create(container) unless containers.find_by_header(host_header_alias)
|
67
|
+
end
|
66
68
|
end
|
67
69
|
|
68
|
-
|
69
70
|
containers.all
|
70
71
|
end
|
71
72
|
|
@@ -146,14 +147,14 @@ module Harbr
|
|
146
147
|
|
147
148
|
system "sv restart #{env}.#{name}" if env == "next"
|
148
149
|
system "sv restart #{name}" if env == "current"
|
149
|
-
|
150
|
+
|
150
151
|
|
151
152
|
|
152
153
|
puts "harbr: #{version} of #{name} in #{env} environment"
|
153
154
|
end
|
154
155
|
|
155
156
|
def bundle_install_if_needed(path)
|
156
|
-
|
157
|
+
|
157
158
|
check_dir_exists(path)
|
158
159
|
|
159
160
|
Dir.chdir(path) do
|
@@ -190,26 +191,26 @@ module Harbr
|
|
190
191
|
|
191
192
|
end
|
192
193
|
|
193
|
-
|
194
|
+
|
194
195
|
end
|
195
196
|
|
196
197
|
def link_directories(name, version, env)
|
197
198
|
if env == "next"
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
199
|
+
`rm -f /etc/service/#{env}.#{name}`
|
200
|
+
`rm -f /var/harbr/containers/#{name}/#{env}`
|
201
|
+
`ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/#{env}`
|
202
|
+
`ln -sf /etc/sv/harbr/#{name}/#{env} /etc/service/#{env}.#{name}`
|
202
203
|
end
|
203
204
|
|
204
205
|
if env == "current"
|
205
|
-
|
206
|
-
`rm -f /etc/service/#{name}`
|
207
|
-
`rm -f /var/harbr/containers/#{name}/current`
|
208
206
|
|
209
|
-
|
210
|
-
|
207
|
+
`rm -f /etc/service/#{name}`
|
208
|
+
`rm -f /var/harbr/containers/#{name}/current`
|
209
|
+
|
210
|
+
`ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/current`
|
211
|
+
`ln -sf /etc/sv/harbr/#{name} /etc/service/#{name}`
|
211
212
|
end
|
212
|
-
|
213
|
+
|
213
214
|
end
|
214
215
|
|
215
216
|
def sync_live_data_if_next(name)
|
@@ -228,27 +229,27 @@ module Harbr
|
|
228
229
|
|
229
230
|
def run_script
|
230
231
|
<<~SCRIPT
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
232
|
+
#!/bin/sh
|
233
|
+
exec 2>&1
|
234
|
+
cd /var/harbr/containers/#{@container_name}/#{@env}
|
235
|
+
exec ./exe/run #{@port} #{@env}
|
236
|
+
echo "started #{@container_name} on port #{@port}"
|
236
237
|
SCRIPT
|
237
238
|
end
|
238
239
|
|
239
240
|
def finish_script
|
240
241
|
<<~SCRIPT
|
241
|
-
|
242
|
-
|
243
|
-
|
242
|
+
#!/bin/sh
|
243
|
+
lsof -i :#{@port} | awk 'NR!=1 {print $2}' | xargs kill
|
244
|
+
echo "killed #{@container_name} on port #{@port}"
|
244
245
|
SCRIPT
|
245
246
|
end
|
246
247
|
|
247
248
|
def log_script
|
248
249
|
<<~SCRIPT
|
249
|
-
|
250
|
-
|
251
|
-
|
250
|
+
#!/bin/sh
|
251
|
+
echo "starting log for #{@container_name} on port #{@port}"
|
252
|
+
exec svlogd -tt /var/log/harbr/#{@container_name}/#{@env}/
|
252
253
|
SCRIPT
|
253
254
|
end
|
254
255
|
end
|
data/lib/harbr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: harbr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.79
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delaney Kuldvee Burke
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: listen
|