harbr 0.1.34 → 0.1.36

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: 3d18bb11eb763f6b9ebd02f4cf707e798b1614362a718e2fc5d4aa3a8714dacc
4
- data.tar.gz: 4d393921baddbee40f815d4821f81822d5282bf0d6aa6147c68394c88642a017
3
+ metadata.gz: 5762c6a052b16be2ea5e87ed5ee7bbfd7b596b6956f1891cd1312d1aaeec215e
4
+ data.tar.gz: 0c84419e9fc169e4fc1f31447bce2011b0d2d676f6106a26d5e09e10de1ea23c
5
5
  SHA512:
6
- metadata.gz: 2f0d979c6328591abad69510944e6b8f76403cec48e14049f030ee550e675bec8e7a721e62acaa3d94c8aea3feeff55afb04f716217b32fef6bb91bcb5e9c739
7
- data.tar.gz: ae098eff09b1a4df3b058ecad33ad8c74f472ef927589b36de65d2113a2b66b717541ee13af09042d283975dcc59c03db5e1a7c5610c0b18fac5981bedeaeb4c
6
+ metadata.gz: 320532e3e19ad46172e7c5329c81ec3619984de5b3434747a58f4a14d70156be25b29375f1e96d232bd45a7dd56d1dd62932717086b5d0355a1bcf2dff394863
7
+ data.tar.gz: 8ddcdb22469dadd5192a01d4e2504f93f4177bc638d484d7687268f7969bd5a027444b5f3a4510c1f6a5fd6bca9f54d3038bbbd2c630adbf4acb03f124154646
data/exe/harbr CHANGED
@@ -67,13 +67,15 @@ class HarbrCLI < Thor
67
67
 
68
68
  def run_jobs(container, version)
69
69
  puts "Running tasks for container: #{container}, version: #{version}"
70
+
70
71
  sleep 1
71
- if version.to_i == 0
72
+
73
+ if !File.exist?("/var/harbr/containers/#{container}/current")
72
74
  Harbr::Job.perform_async(container, version)
73
- else
74
- Harbr::Next::Job.perform_async(container, version)
75
75
  end
76
76
 
77
+ Harbr::Next::Job.perform_async(container, version)
78
+
77
79
  puts "deploy next version #{version} of #{container}"
78
80
  end
79
81
 
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.36"
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.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke