harbr 0.1.95 → 0.1.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exe/harbr +21 -12
- data/lib/harbr/job.rb +9 -15
- 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: 3c08916d7fe5471c23cdfa15e0cdd3cd5837e9ea2707a9d2cd7f208d660b9bf0
|
4
|
+
data.tar.gz: b81709797c73e85cc6b81d8107a88897fc05cc958506e65363770ff775ef84b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e623c9751a79d4c706ffa0e467e4c4aab4e3178a739e1aae869a16fa9f375480907de3fd98c5f5d82db4c63f374ff2e7ee800f994d2b92dfbeb83431974d1e4
|
7
|
+
data.tar.gz: 30413ebd34547749790e3bb0158bbddb5093594b4b60d6dec791ad18ae9b645375ffc9735c8341dfc561f4bbce5606323f04071e58f4b4859975f694a75bf865
|
data/exe/harbr
CHANGED
@@ -88,9 +88,7 @@ class HarbrCLI < Thor
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def run_jobs(container, version)
|
91
|
-
|
92
|
-
Harbr::Job.perform_async(container, version, "next")
|
93
|
-
puts "deploy next version #{version} of #{container}"
|
91
|
+
`harbr deploy #{container} #{version} --next`
|
94
92
|
end
|
95
93
|
|
96
94
|
def create_traefik_config(containers)
|
@@ -134,7 +132,6 @@ class HarbrCLI < Thor
|
|
134
132
|
container_repo = Harbr::Container::Repository.new
|
135
133
|
|
136
134
|
["live.#{name}", "next.#{name}", name].each do |container_name|
|
137
|
-
|
138
135
|
container_repo.get_by_name(container_name).each do |container|
|
139
136
|
`port release #{container.port}`
|
140
137
|
puts "released port #{container.port} successfully."
|
@@ -213,17 +210,29 @@ class HarbrCLI < Thor
|
|
213
210
|
end
|
214
211
|
|
215
212
|
desc "deploy", "deploy a container to production"
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
213
|
+
method_option :live, type: :boolean, default: false, aliases: "-l", desc: "deploy to live environment"
|
214
|
+
method_option :next, type: :boolean, default: false, aliases: "-n", desc: "deploy to next environment"
|
215
|
+
def deploy(name,version=nil)
|
216
|
+
|
217
|
+
if options[:live]
|
218
|
+
/versions\/(?<version>\d*)/ =~ `ls -l /var/harbr/containers/#{name}/next`
|
219
|
+
version = $1
|
220
|
+
raise "Ooops! next version not found!" if version.nil?
|
221
|
+
|
222
|
+
Harbr::Job.perform_async(name, version, "live")
|
220
223
|
|
221
|
-
|
224
|
+
/versions\/(?<version>\d*)/ =~ `ls -l /var/harbr/containers/#{name}/live`
|
225
|
+
`ln -sf /var/harbr/containers/#{name}/version/#{$1} /var/harbr/containers/#{name}/rollback`
|
222
226
|
|
223
|
-
|
224
|
-
|
227
|
+
puts "deploy version #{version} of #{name} to live environment"
|
228
|
+
end
|
225
229
|
|
226
|
-
|
230
|
+
if options[:next]
|
231
|
+
`ln -sf /var/harbr/containers/#{name}/version/#{version} /var/harbr/containers/#{name}/next`
|
232
|
+
Harbr::Job.perform_async(name, version, "next")
|
233
|
+
puts "deploy version #{version} of #{name} to next environment"
|
234
|
+
end
|
235
|
+
|
227
236
|
end
|
228
237
|
|
229
238
|
desc "rollback", "rollback last deploy"
|
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
|
@@ -56,10 +56,8 @@ module Harbr
|
|
56
56
|
containers.update(container)
|
57
57
|
end
|
58
58
|
|
59
|
-
|
60
59
|
if host_header_aliases
|
61
60
|
host_header_aliases.each do |host_header_alias|
|
62
|
-
|
63
61
|
container = Harbr::Container.new
|
64
62
|
container.name = "#{name} -> #{host_header_alias}"
|
65
63
|
container.host_header = host_header_alias
|
@@ -67,30 +65,26 @@ module Harbr
|
|
67
65
|
container.port = port
|
68
66
|
containers.create(container) unless containers.find_by_header(host_header_alias)
|
69
67
|
|
70
|
-
if
|
68
|
+
if container.name.start_with?("live")
|
71
69
|
|
72
|
-
plain_name = host_header_alias.gsub("live.","")
|
70
|
+
plain_name = host_header_alias.gsub("live.", "")
|
73
71
|
container = Harbr::Container.new
|
74
72
|
container.name = "#{name} -> #{plain_name}"
|
75
73
|
container.host_header = plain_name
|
76
74
|
container.ip = "127.0.0.1"
|
77
|
-
container.port = port
|
78
|
-
|
75
|
+
container.port = port
|
79
76
|
|
80
77
|
unless containers.find_by_header(container.host_header)
|
81
78
|
containers.create(container)
|
82
79
|
end
|
83
80
|
|
84
81
|
end
|
85
|
-
|
86
82
|
end
|
87
83
|
end
|
88
84
|
|
89
85
|
containers.all
|
90
86
|
end
|
91
87
|
|
92
|
-
|
93
|
-
|
94
88
|
def write_to_file(path, contents)
|
95
89
|
dirname = File.dirname(path)
|
96
90
|
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
@@ -117,7 +111,7 @@ module Harbr
|
|
117
111
|
private
|
118
112
|
|
119
113
|
def remove_dot_from_string(str)
|
120
|
-
str.sub(
|
114
|
+
str.sub(".", "")
|
121
115
|
end
|
122
116
|
|
123
117
|
def check_file_exists(path)
|
@@ -159,14 +153,14 @@ module Harbr
|
|
159
153
|
|
160
154
|
if env == "live"
|
161
155
|
`rm -f /var/harbr/containers/#{name}/live` if Dir.exist?("/var/harbr/containers/#{name}/live")
|
162
|
-
`ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/live`
|
156
|
+
`ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/live`
|
163
157
|
end
|
164
|
-
|
158
|
+
|
165
159
|
if env == "next"
|
166
160
|
`rm -f /var/harbr/containers/#{name}/next` if Dir.exist?("/var/harbr/containers/#{name}/next")
|
167
|
-
`ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/next`
|
161
|
+
`ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/next`
|
168
162
|
end
|
169
|
-
|
163
|
+
|
170
164
|
bundle_install_if_needed(version_path)
|
171
165
|
|
172
166
|
create_runit_scripts(name, port, env)
|
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.96
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: listen
|