harbr 0.0.106 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/harbr +8 -6
- data/lib/harbr/container.rb +1 -1
- data/lib/harbr/job.rb +0 -1
- data/lib/harbr/next/job.rb +15 -10
- 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: 26bc98fbce85f012d0d96cd9fd09a07f789afeb1cfffc9b5fde03fef786dd724
|
4
|
+
data.tar.gz: 20bc0c41aee016571fb0fced48d0c8889baab4b9ef323e0517582c83b6fba9a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be599ea5efe2b994281570511dc83b377210ec446f19fbebf672591e0a83be3b41d88a8bcf9305b6a391f671bf16ebd03c008c1ddbbc7a22444a1c0950917846
|
7
|
+
data.tar.gz: 1a0f17ba5f5a49794dd4f1e9e8bca4c32a90b5dd6338d18962e49596f69da38df6aca68f8271583f8c20132eb41b3741a05f5203dcf052adc6bdab3f20a4dcc7
|
data/exe/harbr
CHANGED
@@ -7,10 +7,10 @@ class HarbrCLI < Thor
|
|
7
7
|
return puts "No containers available." if containers.empty?
|
8
8
|
|
9
9
|
# Define headers based on Container attributes
|
10
|
-
headers = ["Name", "Host Header", "IP", "Port"
|
10
|
+
headers = ["Name", "Host Header", "IP", "Port"]
|
11
11
|
|
12
12
|
rows = containers.map do |container|
|
13
|
-
[container.name, container.host_header, container.ip.nil? ? "127.0.0.1" : container.ip, container.port
|
13
|
+
[container.name, container.host_header, container.ip.nil? ? "127.0.0.1" : container.ip, container.port]
|
14
14
|
end
|
15
15
|
|
16
16
|
table = ::Terminal::Table.new(headings: headers, rows: rows)
|
@@ -172,18 +172,20 @@ class HarbrCLI < Thor
|
|
172
172
|
desc "deploy", "deploy a container to production"
|
173
173
|
def deploy(name)
|
174
174
|
Dir.chdir("/var/harbr/containers/#{name}/") do
|
175
|
-
`mv current rollback`
|
176
175
|
`mv next current`
|
177
|
-
puts `sv restart
|
176
|
+
puts `sv restart next.#{name}`
|
178
177
|
end
|
179
|
-
|
180
178
|
end
|
181
179
|
|
182
180
|
desc "rollback", "rollback last deploy"
|
183
181
|
def rollback(name)
|
184
182
|
Dir.chdir("/var/harbr/containers/#{name}") do
|
185
183
|
if File.exist?("rollback")
|
184
|
+
`cp -r current current.bak`
|
186
185
|
`mv rollback current`
|
186
|
+
`cp -r current.bak next`
|
187
|
+
`rm -rf rollback`
|
188
|
+
`rm -rf current.bak`
|
187
189
|
`sv restart #{name}`
|
188
190
|
`sv restart next.#{name}`
|
189
191
|
puts "rollback successful"
|
@@ -209,6 +211,6 @@ class HarbrCLI < Thor
|
|
209
211
|
sleep 3 # Poll every 10 seconds
|
210
212
|
end
|
211
213
|
end
|
212
|
-
|
214
|
+
e97c9a8d5810ffad0d42894905b218a655e8732b7nd
|
213
215
|
|
214
216
|
HarbrCLI.start(ARGV)
|
data/lib/harbr/container.rb
CHANGED
data/lib/harbr/job.rb
CHANGED
data/lib/harbr/next/job.rb
CHANGED
@@ -50,16 +50,22 @@ module Harbr
|
|
50
50
|
puts "Traefik configuration written to /etc/traefik/harbr.toml"
|
51
51
|
end
|
52
52
|
|
53
|
-
def collate_containers(name,port
|
53
|
+
def collate_containers(name,host,port)
|
54
54
|
|
55
55
|
containers = Harbr::Container::Repository.new
|
56
|
-
container = containers.
|
56
|
+
container = containers.find_by_header(host)
|
57
57
|
|
58
|
-
container.
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
if container.nil?
|
59
|
+
container = Harbr::Container.new
|
60
|
+
container.name = name
|
61
|
+
container.host_header =host
|
62
|
+
container.ip = "127.0.0.1"
|
63
|
+
container.port = port
|
64
|
+
containers.create(container)
|
65
|
+
else
|
66
|
+
container.port = port
|
67
|
+
containers.update(container)
|
68
|
+
end
|
63
69
|
containers.all
|
64
70
|
end
|
65
71
|
|
@@ -166,8 +172,7 @@ module Harbr
|
|
166
172
|
`bundle config set --local path 'vendor/bundle'`
|
167
173
|
|
168
174
|
manifest = load_manifest(name,version)
|
169
|
-
|
170
|
-
current_path = "/var/harbr/containers/#{name}/current"
|
175
|
+
current_path = "/var/harbr/containers/#{name}/versions/#{version}"
|
171
176
|
|
172
177
|
port = `port assign next.#{manifest.port}`.strip
|
173
178
|
|
@@ -196,7 +201,7 @@ module Harbr
|
|
196
201
|
system "ln -sf /etc/sv/harbr/#{name}/next /etc/service/next.#{name}"
|
197
202
|
system "sv restart next.#{name}"
|
198
203
|
|
199
|
-
containers = collate_containers("next.#{name}",port
|
204
|
+
containers = collate_containers("next.#{name}","next.#{manifest.host}",port)
|
200
205
|
create_traefik_config(containers)
|
201
206
|
end
|
202
207
|
|
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.0
|
4
|
+
version: 0.1.0
|
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: 2023-12-
|
11
|
+
date: 2023-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: listen
|