harbr 0.0.107 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/harbr +9 -8
- data/lib/harbr/container.rb +1 -1
- data/lib/harbr/job.rb +0 -1
- data/lib/harbr/next/job.rb +16 -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: f9c8544c1daf62daab459ca9f4d2953b5ad688b8856571326cea06fd486272b6
|
4
|
+
data.tar.gz: 2979d7301cd49b3477f38ab0293e37045027cb1d469731378132c2dc4cc59b3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ceaf8c984d22e2e7e8faf87519601eefbafc8a598caae1e817ce6db6900bc12e2e0b2f20138459f78eaec423eb0f587ba828cbef292586b9ab4835070e2bcbad
|
7
|
+
data.tar.gz: 469ccc69aa021a4f141596dad901c2af9f386f44b2c9724843c5cb79690b1301065b9ac015c34873445d4afdb6f1e4011f96625b6c0f94feef93ad90e9977800
|
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,20 +172,22 @@ 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")
|
186
|
-
`
|
184
|
+
`cp -r current current.bak`
|
187
185
|
`mv rollback current`
|
188
|
-
`
|
186
|
+
`cp -r current.bak next`
|
187
|
+
`rm -rf rollback`
|
188
|
+
`rm -rf current.bak`
|
189
|
+
`sv restart #{name}`
|
190
|
+
`sv restart next.#{name}`
|
189
191
|
puts "rollback successful"
|
190
192
|
end
|
191
193
|
end
|
@@ -210,5 +212,4 @@ class HarbrCLI < Thor
|
|
210
212
|
end
|
211
213
|
end
|
212
214
|
end
|
213
|
-
|
214
215
|
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
|
|
@@ -190,12 +195,13 @@ module Harbr
|
|
190
195
|
|
191
196
|
|
192
197
|
system "rm /etc/service/next.#{name}"
|
198
|
+
system "rm /var/harbr/containers/#{name}/next"
|
193
199
|
|
194
200
|
system "ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/next"
|
195
201
|
system "ln -sf /etc/sv/harbr/#{name}/next /etc/service/next.#{name}"
|
196
202
|
system "sv restart next.#{name}"
|
197
203
|
|
198
|
-
containers = collate_containers("next.#{name}",port
|
204
|
+
containers = collate_containers("next.#{name}","next.#{manifest.host}",port)
|
199
205
|
create_traefik_config(containers)
|
200
206
|
end
|
201
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.
|
4
|
+
version: 0.1.1
|
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
|