harbr 0.1.82 → 0.1.84

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: '028ba5825b5e4969fb9652aa83c380c31c25666f618da2c86a5d93613b209bc4'
4
- data.tar.gz: 2f02b269e41fd999bc16ad0520d76f9ea772d7de1f256e0628da66c4f73e45a2
3
+ metadata.gz: 0eeb93a8a44b33d81585d43043fc3e87d8af4ca2b86b58b84e395edd9fdcc486
4
+ data.tar.gz: 4ab4e30f7811be94fa7d4c8ccd6a2f00b8ac441bfec0a33426c3f00dfde972f4
5
5
  SHA512:
6
- metadata.gz: d9bb90fa673d5001a2ae395791c7a8ca2384a1ab90fb70b0ca8cf70a80ab0edd9b937459f68b5d3b7f1aac60dd2b72e8c083ecf3455c17763d1b86e136204db2
7
- data.tar.gz: 55bc8fb8f271de72d974e7e2f45f66b7fd937652a5fc5c1018adcdc85c9a640b8092027005b41e3145adceb1264f51e886fb4844f6458e3edfde6c991ed8cb7f
6
+ metadata.gz: a2079550747b2693fdfbb9df75fb59044b9455cf66b422493d75de5255d3d274696ed345cc0ba5fee99b6865f0642507a17868d6319dbe9826c3977c44733e12
7
+ data.tar.gz: f80160a004bb2b406b9e21f4f20171b432181ee434b7bbaef3a3492b2996ec156d7858540e28cdfa942c72fe999344c199ac7b792a859d7050ee4b9d2862f56b
data/exe/harbr CHANGED
@@ -133,7 +133,8 @@ class HarbrCLI < Thor
133
133
 
134
134
  container_repo = Harbr::Container::Repository.new
135
135
 
136
- [name, "next.#{name}"].each do |container_name|
136
+ ["live.#{name}", "next.#{name}"].each do |container_name|
137
+
137
138
  container_repo.get_by_name(container_name).each do |container|
138
139
  `port release #{container.port}`
139
140
  puts "released port #{container.port} successfully."
@@ -164,7 +165,7 @@ class HarbrCLI < Thor
164
165
  container_repo = Harbr::Container::Repository.new
165
166
  container = container_repo.find_by_name(container)
166
167
  if container
167
- exec "tail -f /var/log/harbr/#{container.name}/current" if options[:live]
168
+ exec "tail -f /var/log/harbr/#{container.name}/live/current" if options[:live]
168
169
  exec "tail -f /var/log/harbr/#{container.name}/next/current" if options[:next]
169
170
  else
170
171
  puts "Container not recognized"
@@ -217,12 +218,12 @@ class HarbrCLI < Thor
217
218
  version = $1
218
219
  raise "Ooops! next version not found!" if version.nil?
219
220
 
220
- /versions\/(?<version>\d*)/ =~ `ls -l /var/harbr/containers/#{name}/current`
221
+ /versions\/(?<version>\d*)/ =~ `ls -l /var/harbr/containers/#{name}/live`
221
222
  `ln -sf /var/harbr/containers/#{name}/version/#{$1} /var/harbr/containers/#{name}/rollback`
222
223
 
223
- Harbr::Job.perform_async(name, version, "current")
224
+ Harbr::Job.perform_async(name, version, "live")
224
225
 
225
- puts "deploy current version #{version} of #{name}"
226
+ puts "deploy version #{version} of #{name} to live environment"
226
227
  end
227
228
 
228
229
  desc "rollback", "rollback last deploy"
@@ -231,9 +232,9 @@ class HarbrCLI < Thor
231
232
  if File.exist?("rollback")
232
233
  Dir.chdir("/var/harbr/containers/#{name}/") do
233
234
  /(?:. * -> (?:.*))/ =~ `ls -l /var/harbr/containers/#{name}/rollback`
234
- `rm -r current`
235
- `ln -sf #{$2} current`
236
- `sv restart #{name}`
235
+ `rm -r live`
236
+ `ln -sf #{$2} live`
237
+ `sv restart live.#{name}`
237
238
  end
238
239
  puts "rollback successful"
239
240
  end
data/lib/harbr/job.rb CHANGED
@@ -138,15 +138,13 @@ module Harbr
138
138
  link_directories(name, version, env)
139
139
  sync_live_data_if_next(name) if env == "next"
140
140
 
141
- containers = collate_containers("#{name}", "#{manifest.host}", port, manifest.host_aliases) if env == "current"
142
- containers = collate_containers("#{env}.#{name}", "#{env}.#{manifest.host}", port, manifest.host_aliases&.map { |host| "#{env}.#{host}" }) if env == "next"
141
+ containers = collate_containers("#{env}.#{name}", "#{env}.#{manifest.host}", port, manifest.host_aliases&.map { |host| "#{env}.#{host}" })
143
142
 
144
143
  create_traefik_config(containers)
145
144
 
146
- system "sv restart #{env}.#{name}" if env == "next"
147
- system "sv restart #{name}" if env == "current"
145
+ system "sv restart #{env}.#{name}"
148
146
 
149
- puts "harbr: #{version} of #{name} in #{env} environment"
147
+ puts "harbr: #{version} of #{name} deployed to #{env} environment"
150
148
  end
151
149
 
152
150
  def bundle_install_if_needed(path)
@@ -165,44 +163,20 @@ module Harbr
165
163
  finish_script = Runit::Script.new(name, port, env).finish_script
166
164
  log_script = Runit::Script.new(name, port, env).log_script
167
165
 
168
- if env == "next"
169
- write_to_file "/etc/sv/harbr/#{name}/#{env}/run", run_script
170
- write_to_file "/etc/sv/harbr/#{name}/#{env}/log/run", log_script
171
- write_to_file "/etc/sv/harbr/#{name}/#{env}/finish", finish_script
172
- `chmod +x /etc/sv/harbr/#{name}/#{env}/run`
173
- `chmod +x /etc/sv/harbr/#{name}/#{env}/finish`
174
- `chmod +x /etc/sv/harbr/#{name}/#{env}/log/run`
175
- `mkdir -p /var/log/harbr/#{name}/#{env}`
176
- end
177
-
178
- if env == "current"
179
- write_to_file "/etc/sv/harbr/#{name}/run", run_script
180
- write_to_file "/etc/sv/harbr/#{name}/log/run", log_script
181
- write_to_file "/etc/sv/harbr/#{name}/finish", finish_script
182
- `chmod +x /etc/sv/harbr/#{name}/run`
183
- `chmod +x /etc/sv/harbr/#{name}/finish`
184
- `chmod +x /etc/sv/harbr/#{name}/log/run`
185
- `mkdir -p /var/log/harbr/#{name}`
186
-
187
- end
166
+ write_to_file "/etc/sv/harbr/#{name}/#{env}/run", run_script
167
+ write_to_file "/etc/sv/harbr/#{name}/#{env}/log/run", log_script
168
+ write_to_file "/etc/sv/harbr/#{name}/#{env}/finish", finish_script
169
+ `chmod +x /etc/sv/harbr/#{name}/#{env}/run`
170
+ `chmod +x /etc/sv/harbr/#{name}/#{env}/finish`
171
+ `chmod +x /etc/sv/harbr/#{name}/#{env}/log/run`
172
+ `mkdir -p /var/log/harbr/#{name}/#{env}`
188
173
  end
189
174
 
190
175
  def link_directories(name, version, env)
191
- if env == "next"
192
- `rm -f /etc/service/#{env}.#{name}`
193
- `rm -f /var/harbr/containers/#{name}/#{env}`
194
- `ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/#{env}`
195
- `ln -sf /etc/sv/harbr/#{name}/#{env} /etc/service/#{env}.#{name}`
196
- end
197
-
198
- if env == "current"
199
-
200
- `rm -f /etc/service/#{name}`
201
- `rm -f /var/harbr/containers/#{name}/current`
202
-
203
- `ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/current`
204
- `ln -sf /etc/sv/harbr/#{name} /etc/service/#{name}`
205
- end
176
+ `rm -f /etc/service/#{env}.#{name}`
177
+ `rm -f /var/harbr/containers/#{name}/#{env}`
178
+ `ln -sf /var/harbr/containers/#{name}/versions/#{version} /var/harbr/containers/#{name}/#{env}`
179
+ `ln -sf /etc/sv/harbr/#{name}/#{env} /etc/service/#{env}.#{name}`
206
180
  end
207
181
 
208
182
  def sync_live_data_if_next(name)
@@ -238,11 +212,10 @@ module Harbr
238
212
  end
239
213
 
240
214
  def log_script
241
- @env = env == 'current' ? nil : env
242
215
  <<~SCRIPT
243
216
  #!/bin/sh
244
217
  echo "starting log for #{@container_name} on port #{@port}"
245
- exec svlogd -tt /var/log/harbr/#{@container_name}/#{@env}
218
+ exec svlogd -tt /var/log/harbr/#{@container_name}/#{env}
246
219
  SCRIPT
247
220
  end
248
221
  end
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.1.82"
4
+ VERSION = "0.1.84"
5
5
  end
data/lib/harbr.rb CHANGED
@@ -41,7 +41,6 @@ module Harbr
41
41
 
42
42
  def self.notifiable(name, version, env)
43
43
  yield if block_given?
44
- env = "live" if env == "current"
45
44
  send_notification("Harbr: #{name} deployed to #{env} successfully", "<p>harbr: #{version} of #{name} deployed to #{env} successfully</p>")
46
45
  rescue => e
47
46
  html_content = <<~HTML
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.82
4
+ version: 0.1.84
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke