harbr 0.1.34 → 0.1.35

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d18bb11eb763f6b9ebd02f4cf707e798b1614362a718e2fc5d4aa3a8714dacc
4
- data.tar.gz: 4d393921baddbee40f815d4821f81822d5282bf0d6aa6147c68394c88642a017
3
+ metadata.gz: 137885e36f80ceb6598c6a094f26fdf68f534f9a68031339b98e34ddf2b98f3c
4
+ data.tar.gz: a4f1ced096337fb93027fd6e213b2b2648bfba1e27e862bc0cce220009183944
5
5
  SHA512:
6
- metadata.gz: 2f0d979c6328591abad69510944e6b8f76403cec48e14049f030ee550e675bec8e7a721e62acaa3d94c8aea3feeff55afb04f716217b32fef6bb91bcb5e9c739
7
- data.tar.gz: ae098eff09b1a4df3b058ecad33ad8c74f472ef927589b36de65d2113a2b66b717541ee13af09042d283975dcc59c03db5e1a7c5610c0b18fac5981bedeaeb4c
6
+ metadata.gz: 3c93928113fb08f973587adb87fb6f3f11dc60b9f928536ca99ba5c96780e26189a96a1c2056d758f00b43bbe82c16a650ada9e2df3609788b1871024828237c
7
+ data.tar.gz: 9c9181dbf1c649d25928e6c00b2be07625b731039f52f93f4ec706c0b2322ecaa016f333b3f16773a6850c065858b4598691ae31830a942dea65304b40a398dd
data/exe/harbr CHANGED
@@ -68,7 +68,7 @@ class HarbrCLI < Thor
68
68
  def run_jobs(container, version)
69
69
  puts "Running tasks for container: #{container}, version: #{version}"
70
70
  sleep 1
71
- if version.to_i == 0
71
+ if version.to_i == 0 or !File.exist?("/var/harbr/containers/#{container}/current")
72
72
  Harbr::Job.perform_async(container, version)
73
73
  else
74
74
  Harbr::Next::Job.perform_async(container, version)
data/lib/harbr/job.rb CHANGED
@@ -76,10 +76,10 @@ module Harbr
76
76
 
77
77
  def to_s
78
78
  <<~SCRIPT
79
- #!/bin/sh
80
- exec 2>&1
81
- cd /var/harbr/containers/#{@container_name}/current
82
- exec ./exe/run #{@port} live
79
+ #!/bin/sh
80
+ exec 2>&1
81
+ cd /var/harbr/containers/#{@container_name}/current
82
+ exec ./exe/run #{@port} live
83
83
  SCRIPT
84
84
  end
85
85
 
@@ -95,9 +95,9 @@ module Harbr
95
95
 
96
96
  def to_s
97
97
  <<~SCRIPT
98
- #!/bin/sh
99
- sleep 3
100
- `lsof -i :#{@port} | awk 'NR!=1 {print $2}' | xargs kill`
98
+ #!/bin/sh
99
+ sleep 3
100
+ `lsof -i :#{@port} | awk 'NR!=1 {print $2}' | xargs kill`
101
101
  SCRIPT
102
102
  end
103
103
  end
@@ -109,8 +109,8 @@ module Harbr
109
109
 
110
110
  def to_s
111
111
  <<~SCRIPT
112
- #!/bin/sh
113
- exec svlogd -tt /var/log/harbr/#{@container_name}
112
+ #!/bin/sh
113
+ exec svlogd -tt /var/log/harbr/#{@container_name}
114
114
  SCRIPT
115
115
  end
116
116
  end
@@ -128,9 +128,7 @@ module Harbr
128
128
  end
129
129
 
130
130
  def perform(name, version)
131
-
132
- Harbr.notifiable(name,version) do
133
-
131
+ Harbr.notifiable(name, version) do
134
132
  Dir.chdir "/var/harbr/containers/#{name}/versions/#{version}" do
135
133
  manifest = load_manifest(name, version)
136
134
  port = `port assign #{manifest.port}`.strip
@@ -159,7 +157,6 @@ module Harbr
159
157
  create_traefik_config(containers)
160
158
  puts "process #{version} of #{name}"
161
159
  end
162
-
163
160
  end
164
161
  end
165
162
  end
@@ -81,10 +81,10 @@ module Harbr
81
81
 
82
82
  def to_s
83
83
  <<~SCRIPT
84
- #!/bin/sh
85
- exec 2>&1
86
- cd /var/harbr/#{@container_name}/current
87
- exec ./exe/run #{@port} live
84
+ #!/bin/sh
85
+ exec 2>&1
86
+ cd /var/harbr/#{@container_name}/current
87
+ exec ./exe/run #{@port} live
88
88
  SCRIPT
89
89
  end
90
90
 
@@ -100,9 +100,9 @@ module Harbr
100
100
 
101
101
  def to_s
102
102
  <<~SCRIPT
103
- #!/bin/sh
104
- sleep 3
105
- `lsof -i :#{@port} | awk 'NR!=1 {print $2}' | xargs kill`
103
+ #!/bin/sh
104
+ sleep 3
105
+ `lsof -i :#{@port} | awk 'NR!=1 {print $2}' | xargs kill`
106
106
  SCRIPT
107
107
  end
108
108
  end
@@ -114,8 +114,8 @@ module Harbr
114
114
 
115
115
  def to_s
116
116
  <<~SCRIPT
117
- #!/bin/sh
118
- exec svlogd -tt /var/log/harbr/#{@container_name}/next/
117
+ #!/bin/sh
118
+ exec svlogd -tt /var/log/harbr/#{@container_name}/next/
119
119
  SCRIPT
120
120
  end
121
121
  end
@@ -129,10 +129,10 @@ module Harbr
129
129
 
130
130
  def to_s
131
131
  <<~SCRIPT
132
- #!/bin/sh
133
- exec 2>&1
134
- cd /var/harbr/containers/#{@container_name}/next
135
- exec ./exe/run #{@port} next
132
+ #!/bin/sh
133
+ exec 2>&1
134
+ cd /var/harbr/containers/#{@container_name}/next
135
+ exec ./exe/run #{@port} next
136
136
  SCRIPT
137
137
  end
138
138
  end
@@ -144,8 +144,8 @@ module Harbr
144
144
 
145
145
  def to_s
146
146
  <<~SCRIPT
147
- #!/bin/sh
148
- exec svlogd -tt /var/log/harbr/#{@container_name}/next/
147
+ #!/bin/sh
148
+ exec svlogd -tt /var/log/harbr/#{@container_name}/next/
149
149
  SCRIPT
150
150
  end
151
151
  end
@@ -164,8 +164,7 @@ module Harbr
164
164
  end
165
165
 
166
166
  def perform(name, version)
167
-
168
- Harbr.notifiable(name,version) do
167
+ Harbr.notifiable(name, version) do
169
168
  manifest = load_manifest(name, version)
170
169
  current_path = "/var/harbr/containers/#{name}/versions/#{version}"
171
170
 
@@ -206,7 +205,6 @@ module Harbr
206
205
  create_traefik_config(containers)
207
206
  puts "harbr: #{version} of #{name}"
208
207
  end
209
-
210
208
  end
211
209
  end
212
210
  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.34"
4
+ VERSION = "0.1.35"
5
5
  end
data/lib/harbr.rb CHANGED
@@ -6,7 +6,7 @@ require "toml-rb"
6
6
  require "fileutils"
7
7
  require "ostruct"
8
8
  require "sucker_punch"
9
- require 'resend'
9
+ require "resend"
10
10
 
11
11
  require_relative "harbr/version"
12
12
  require_relative "harbr/container"
@@ -20,36 +20,29 @@ module Harbr
20
20
  class Error < StandardError; end
21
21
 
22
22
  def self.send_notification(subject, body)
23
- begin
24
-
25
- Resend.api_key = ENV['RESEND_API_KEY']
23
+ Resend.api_key = ENV["RESEND_API_KEY"]
26
24
 
27
- params = {
28
- from: ENV['RESEND_FROM'],
29
- to: ENV['RESEND_TO'],
30
- subject: subject,
31
- html: body
32
- }
33
-
34
- Resend::Emails.send(params)
35
- rescue => e
36
- puts "Error sending notification: #{e.message}"
37
- end
38
-
25
+ params = {
26
+ from: ENV["RESEND_FROM"],
27
+ to: ENV["RESEND_TO"],
28
+ subject: subject,
29
+ html: body
30
+ }
31
+
32
+ Resend::Emails.send(params)
33
+ rescue => e
34
+ puts "Error sending notification: #{e.message}"
39
35
  end
40
36
 
41
- def self.notifiable(name,version)
42
- begin
43
- yield if block_given?
44
- send_notification("Harbr: #{name} deployed successfully","<p>harbr: #{version} of #{name} deployed successfully</p>")
45
- rescue => e
46
- html_content = "<p>Error: #{e.message}</p>
47
- <p>#{e.backtrace.join('<br>')}</p>
37
+ def self.notifiable(name, version)
38
+ yield if block_given?
39
+ send_notification("Harbr: #{name} deployed successfully", "<p>harbr: #{version} of #{name} deployed successfully</p>")
40
+ rescue => e
41
+ html_content = "<p>Error: #{e.message}</p>
42
+ <p>#{e.backtrace.join("<br>")}</p>
48
43
  <p>harbr: #{version} of #{name} failed to deploy</p>"
49
- send_notification("Harbr: #{name} failed to deploy",html_content)
50
- end
44
+ send_notification("Harbr: #{name} failed to deploy", html_content)
51
45
  end
52
-
53
46
  end
54
47
 
55
48
  Dddr.configure do |config|
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.34
4
+ version: 0.1.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke