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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 050c3c42cf01df78606768c019518d3b17a9f0347030a4e61e27223b83a81128
4
- data.tar.gz: 76b0c515f7776335a23acb59aaa5f4d59a69110b2e1b852107ae0e0dd234dfdf
3
+ metadata.gz: 26bc98fbce85f012d0d96cd9fd09a07f789afeb1cfffc9b5fde03fef786dd724
4
+ data.tar.gz: 20bc0c41aee016571fb0fced48d0c8889baab4b9ef323e0517582c83b6fba9a8
5
5
  SHA512:
6
- metadata.gz: ab9196d10b9f7ce9340237f533a186d5eb3a0f7e63fbb8e67a23a0d9897ad0863ec9083f964fe69f77a313808a8144f844cb3bd5d22addf05d8bdf0f56b7c4eb
7
- data.tar.gz: 7c0364fbf68e37ae75d09af70dcd0db6e61a2b6ae9189c5837f2eedfa9da3544d5d0024985f86a6366779c88dbd8d1d2f332055c8b93ca9c2bc7efe40ec46166
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", "Current Version", "Next Version", "Previous Version"]
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.to_s, container.current_version, container.next_version, container.previous_version]
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 #{name}`
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
- end
214
+ e97c9a8d5810ffad0d42894905b218a655e8732b7nd
213
215
 
214
216
  HarbrCLI.start(ARGV)
@@ -1,7 +1,7 @@
1
1
  module Harbr
2
2
  class Container
3
3
  include Dddr::Entity
4
- attr_accessor :name, :host_header, :ip, :port,:current_version, :next_version,:previous_version
4
+ attr_accessor :name, :host_header, :ip, :port
5
5
 
6
6
  queries do
7
7
  def find_by_header(host_header)
data/lib/harbr/job.rb CHANGED
@@ -56,7 +56,6 @@ module Harbr
56
56
  container.host_header =host
57
57
  container.ip = "127.0.0.1"
58
58
  container.port = port
59
- container.current_version = 0
60
59
  containers.create(container)
61
60
  else
62
61
  container.port = port
@@ -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, version)
53
+ def collate_containers(name,host,port)
54
54
 
55
55
  containers = Harbr::Container::Repository.new
56
- container = containers.find_by_name(name)
56
+ container = containers.find_by_header(host)
57
57
 
58
- container.port = port
59
- container.next_version = version
60
- container.previous_version = container.current_version
61
- containers.update(container)
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,version)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Harbr
4
- VERSION = "0.0.106"
4
+ VERSION = "0.1.0"
5
5
  end
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.106
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-14 00:00:00.000000000 Z
11
+ date: 2023-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: listen