lbhrr 1.0.27 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/lbhrr +38 -36
- data/lib/lbhrr/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d227165ee1807a1d93fa79f40934df7b04738dd33ee5d1e052e15570862218af
|
4
|
+
data.tar.gz: 31ff59aadaa7d98b6a8e1e6a52496f444902bb87910a9f818d713efc8b7bfda4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7b52bdd9bfb3b0c0c492b621119a613407c5b5266289aa06246e1a86a2cf30f12eefb15693d718e1e0ccc5654f3235cd9aadfa63a7567c33b8a23ef916fd08f
|
7
|
+
data.tar.gz: 942c57b8f351cadff9ff01366122c53ab30e827b6ac00847fcfac498dbffc2d43e2195491265ccd4276dbade8c9172c98c50b153723299187575551e613ce5a9
|
data/exe/lbhrr
CHANGED
@@ -15,22 +15,23 @@ class LbhrrCLI < Thor
|
|
15
15
|
user = config["user"]
|
16
16
|
port = config["port"]
|
17
17
|
version = config["version"].to_i
|
18
|
-
raise "Configuration error: Host, User, or Version missing" unless host && port && user && version > 0
|
19
18
|
|
20
19
|
# Check for a git repository
|
21
20
|
unless `git rev-parse --is-inside-work-tree > /dev/null 2>&1`
|
22
21
|
raise "No Git repository found in the current directory"
|
23
22
|
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
if File.exist? "Gemfile"
|
25
|
+
vendor_path = File.join(Dir.pwd, "vendor")
|
26
|
+
FileUtils.rm_rf(vendor_path) if Dir.exist?(vendor_path)
|
27
|
+
`bundle config set --local path 'vendor/bundle'`
|
28
|
+
system "bundle install" or raise "Bundle install failed"
|
29
|
+
end
|
30
|
+
|
30
31
|
# Check if the repository is clean
|
31
32
|
puts "Git repository is dirty, committing changes..."
|
32
33
|
system("git add .") or raise "Failed to add changes to Git"
|
33
|
-
system("git commit -m 'packaged #{version}'")
|
34
|
+
system("git commit -m 'packaged #{version}'")
|
34
35
|
puts "Packaging completed successfully."
|
35
36
|
|
36
37
|
end
|
@@ -103,22 +104,22 @@ class LbhrrCLI < Thor
|
|
103
104
|
def create_run_file(type)
|
104
105
|
|
105
106
|
service_content = <<-RUBY
|
106
|
-
|
107
|
-
require 'bundler/inline'
|
107
|
+
#!/usr/bin/env ruby
|
108
108
|
|
109
|
-
|
110
|
-
source 'https://rubygems.org'
|
111
|
-
#gem 'kafkr', require: true
|
112
|
-
end
|
109
|
+
require 'bundler/inline'
|
113
110
|
|
114
|
-
|
111
|
+
gemfile do
|
112
|
+
source 'https://rubygems.org'
|
113
|
+
#gem 'kafkr', require: true
|
114
|
+
end
|
115
115
|
|
116
|
-
|
117
|
-
puts 'ok!'
|
118
|
-
sleep 1
|
119
|
-
end
|
116
|
+
puts 'Gems installed and loaded!'
|
120
117
|
|
121
|
-
|
118
|
+
loop do
|
119
|
+
puts 'ok!'
|
120
|
+
sleep 1
|
121
|
+
end
|
122
|
+
RUBY
|
122
123
|
|
123
124
|
if type == "web"
|
124
125
|
run_file_path = File.join(Dir.pwd, "exe", "run")
|
@@ -135,7 +136,7 @@ class LbhrrCLI < Thor
|
|
135
136
|
run_file_path = File.join(Dir.pwd, "exe", "run")
|
136
137
|
service_run_file_content = "#!/bin/sh\n HARBR_ENV=$2 ruby service"
|
137
138
|
exe_directory = File.join(Dir.pwd, "exe")
|
138
|
-
|
139
|
+
|
139
140
|
Dir.mkdir(exe_directory) unless Dir.exist?(exe_directory)
|
140
141
|
File.write(run_file_path, service_run_file_content)
|
141
142
|
File.chmod(0o755, run_file_path) # Set executable permission
|
@@ -144,10 +145,10 @@ class LbhrrCLI < Thor
|
|
144
145
|
File.write("service", service_content)
|
145
146
|
File.chmod(0o755, "service") # Set executable permission
|
146
147
|
puts "Created ./service file."
|
147
|
-
|
148
|
+
|
148
149
|
end
|
149
150
|
|
150
|
-
|
151
|
+
|
151
152
|
|
152
153
|
rescue => e
|
153
154
|
puts "Error creating ./exe/run file: #{e.message}"
|
@@ -159,7 +160,8 @@ class LbhrrCLI < Thor
|
|
159
160
|
"version" => "0",
|
160
161
|
"type" => type,
|
161
162
|
"port" => "#{File.basename(Dir.pwd)}.app",
|
162
|
-
"host" => "#{File.basename(Dir.pwd)}.harbr.zero2one.ee"
|
163
|
+
"host" => "#{File.basename(Dir.pwd)}.harbr.zero2one.ee",
|
164
|
+
"host_aliases" => []
|
163
165
|
}
|
164
166
|
|
165
167
|
YAML.dump(example_local_config)
|
@@ -167,7 +169,7 @@ class LbhrrCLI < Thor
|
|
167
169
|
|
168
170
|
def load_configuration
|
169
171
|
global_config_dir = File.expand_path("~/.config/harbr")
|
170
|
-
global_config_path = File.join(global_config_dir, "
|
172
|
+
global_config_path = File.join(global_config_dir, "manifest.yml")
|
171
173
|
local_config_path = File.join(Dir.pwd, "config", "manifest.yml")
|
172
174
|
|
173
175
|
# Ensure global configuration exists
|
@@ -185,7 +187,7 @@ class LbhrrCLI < Thor
|
|
185
187
|
|
186
188
|
if File.exist? local_config_path
|
187
189
|
local_config = YAML.load_file(local_config_path) || {}
|
188
|
-
global_config.merge(local_config)
|
190
|
+
global_config.merge!(local_config)
|
189
191
|
end
|
190
192
|
|
191
193
|
global_config
|
@@ -253,22 +255,22 @@ class LbhrrCLI < Thor
|
|
253
255
|
desc "lift", "Deploy an application using the configuration from config/manifest.yml to next"
|
254
256
|
def lift
|
255
257
|
if manifest?
|
256
|
-
|
258
|
+
|
257
259
|
package
|
258
|
-
|
260
|
+
|
259
261
|
|
260
262
|
config = load_configuration
|
261
263
|
host = config["host"]
|
262
264
|
user = config["user"]
|
263
265
|
raise "Host configuration missing" unless host
|
264
|
-
|
266
|
+
|
265
267
|
local_manifest_path = File.join(Dir.pwd, "config", "manifest.yml")
|
266
268
|
raise "Local manifest file not found at #{local_manifest_path}" unless File.exist?(local_manifest_path)
|
267
|
-
|
269
|
+
|
268
270
|
local_config = YAML.load_file(local_manifest_path) || {}
|
269
271
|
version = local_config["version"].to_i
|
270
272
|
raise "Version not specified in manifest.yml" unless version
|
271
|
-
|
273
|
+
|
272
274
|
basename = File.basename(Dir.pwd)
|
273
275
|
base_directory = "/var/harbr/containers/#{basename}"
|
274
276
|
versions_directory = "#{base_directory}/versions"
|
@@ -277,22 +279,22 @@ class LbhrrCLI < Thor
|
|
277
279
|
# Prepare the rsync exclude option using .gitignore
|
278
280
|
gitignore_path = File.join(Dir.pwd, ".gitignore")
|
279
281
|
exclude_option = File.exist?(gitignore_path) ? "--exclude='.git' --exclude-from='#{gitignore_path}'" : ""
|
280
|
-
|
281
|
-
|
282
|
+
|
283
|
+
|
282
284
|
# Check and create the versions directory on the server
|
283
285
|
`ssh #{user}@#{host} 'mkdir -p #{versions_directory}'`
|
284
286
|
`ssh #{user}@#{host} 'mkdir -p #{data_directory}'`
|
285
|
-
|
287
|
+
|
286
288
|
# Rsync files to the new version directory, excluding files as per .gitignore
|
287
289
|
rsync_command = "rsync -avz #{exclude_option} ./ #{user}@#{host}:#{destination_path}"
|
288
|
-
|
290
|
+
|
289
291
|
if `#{rsync_command}`
|
290
292
|
puts "Successfully deployed application version #{version} to #{host}"
|
291
293
|
deployed(local_manifest_path, version)
|
292
294
|
else
|
293
295
|
puts "Failed to deploy application version #{version} to #{host}"
|
294
296
|
end
|
295
|
-
|
297
|
+
|
296
298
|
else
|
297
299
|
puts "no manifest found!"
|
298
300
|
end
|
@@ -355,7 +357,7 @@ class LbhrrCLI < Thor
|
|
355
357
|
|
356
358
|
desc "rollback", "rollback an application using the configuration from config/manifest.yml"
|
357
359
|
def rollback(name=nil)
|
358
|
-
|
360
|
+
|
359
361
|
config = load_configuration
|
360
362
|
host = config["host"]
|
361
363
|
user = config["user"]
|
data/lib/lbhrr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lbhrr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
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:
|
11
|
+
date: 2024-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
rubygems_version: 3.
|
79
|
+
rubygems_version: 3.5.3
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: A CLI tool for deploying and managing Rack applications.
|