harbr 0.1.78 → 0.1.80
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: e5bae4f7152798fe858e6e289a4926f104c30c8af4aff5d75690ac0a88d5bfc2
|
4
|
+
data.tar.gz: de87394363bc31c641a36622760f134bbea83d27564e1fc079a1a641a1f7203d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: badfc4d8ded68caddd793f5e1e957da3f30e8cf1f7d1d907e961a8c130ef0c8a55a2488d9a40aff962fe480ecf5fbc6a1de20b3c3c3fd63bafb6a44aae11c4d9
|
7
|
+
data.tar.gz: e6d645f4bbdf4e7acdd7da6e7bd5765b088364f0031fc16b25b84aeaeb96e6ae1f4a9760e9e28e90a2b7456a5b047cd32ce91dcb4771fa1d1170b29895c7f81c
|
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
|
-
host_header_aliases
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
59
|
+
if host_header_aliases
|
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.80
|
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
|