harbr 0.1.47 → 0.1.49
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/harbr/job.rb +25 -13
- 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: afa50fa2d13cb27fe66aac3529c34dca995c6793c47ffab0c0ad49f48b3afbed
|
4
|
+
data.tar.gz: 5b8c161f835b4d86479f2282376cd3cb04cd5fd7b8c9d4e99a6bdb27502a8dae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b68f72d961341d55439471b40f2ef033565450f8762c0195cb9e2746e818956c9a2d5d4f3f0686277ea29bb7b14dfb3c54f43e03549bcc936cdfb4504ec150b
|
7
|
+
data.tar.gz: 78c8792d6b110d4617f468df52db82c09be14cb7c23eb0e8aebedc3d8b176e3e2b8679bd8e72486a156e581117b917455813203b72e0de2399803c56ef711d6d
|
data/lib/harbr/job.rb
CHANGED
@@ -58,12 +58,17 @@ module Harbr
|
|
58
58
|
containers.all
|
59
59
|
end
|
60
60
|
|
61
|
+
|
61
62
|
def write_to_file(path, contents)
|
63
|
+
dirname = File.dirname(path)
|
64
|
+
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
65
|
+
|
62
66
|
File.write(path, contents)
|
63
67
|
end
|
64
68
|
|
65
|
-
def load_manifest(
|
66
|
-
manifest_path = "/var/harbr/containers/#{
|
69
|
+
def load_manifest(name, version)
|
70
|
+
manifest_path = "/var/harbr/containers/#{name}/versions/#{version}/config/manifest.yml"
|
71
|
+
check_file_exists(manifest_path)
|
67
72
|
raise "Manifest not found at #{manifest_path}" unless File.exist?(manifest_path)
|
68
73
|
|
69
74
|
manifest_data = YAML.load_file(manifest_path)
|
@@ -74,21 +79,21 @@ module Harbr
|
|
74
79
|
Harbr.notifiable(name, version) do
|
75
80
|
manifest = load_manifest(name, version)
|
76
81
|
port = `port assign #{env}.#{manifest.port}`.strip
|
77
|
-
|
78
|
-
current_path = "/var/harbr/containers/#{name}/versions/#{version}"
|
79
|
-
check_dir_exists(current_path)
|
80
|
-
|
81
|
-
process_container(name, version, port, env, manifest)
|
82
|
+
process_container(name,version,port,env,manifest)
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
85
86
|
private
|
86
87
|
|
87
|
-
def
|
88
|
+
def check_file_exists(path)
|
88
89
|
sleep_times = [1, 3, 5, 8, 23]
|
89
90
|
begin
|
90
91
|
sleep_times.each do |time|
|
91
|
-
|
92
|
+
puts "checking #{path}...."
|
93
|
+
if File.exist?(path)
|
94
|
+
puts "found #{path}"
|
95
|
+
return
|
96
|
+
end
|
92
97
|
sleep(time)
|
93
98
|
end
|
94
99
|
raise "Directory not found: #{path}"
|
@@ -98,16 +103,25 @@ module Harbr
|
|
98
103
|
end
|
99
104
|
|
100
105
|
def process_container(name, version, port, env, manifest)
|
101
|
-
|
106
|
+
|
107
|
+
version_path = "/var/harbr/containers/#{name}/versions/#{version}"
|
108
|
+
|
102
109
|
system "sv stop #{env}.#{name}" if env == "next"
|
110
|
+
system "sv stop #{name}" if env == "current"
|
111
|
+
|
112
|
+
bundle_install_if_needed(version_path)
|
103
113
|
|
104
|
-
bundle_install_if_needed(env_path)
|
105
114
|
create_runit_scripts(name, port, env)
|
106
115
|
link_directories(name, version, env)
|
107
116
|
sync_live_data_if_next(name) if env == "next"
|
108
117
|
|
109
118
|
containers = collate_containers("#{env}.#{name}", "#{env}.#{manifest.host}", port)
|
110
119
|
create_traefik_config(containers)
|
120
|
+
|
121
|
+
system "sv start #{env}.#{name}" if env == "next"
|
122
|
+
system "sv start #{name}" if env == "current"
|
123
|
+
|
124
|
+
|
111
125
|
puts "harbr: #{version} of #{name} in #{env} environment"
|
112
126
|
end
|
113
127
|
|
@@ -126,12 +140,10 @@ module Harbr
|
|
126
140
|
log_script = Runit::Script.new(name, port, env).log_script
|
127
141
|
|
128
142
|
write_to_file "/etc/sv/harbr/#{name}/#{env}/run", run_script
|
129
|
-
write_to_file "/etc/sv/harbr/#{name}/#{env}/finish", finish_script
|
130
143
|
write_to_file "/etc/sv/harbr/#{name}/#{env}/log/run", log_script
|
131
144
|
|
132
145
|
`chmod +x /etc/sv/harbr/#{name}/#{env}/run`
|
133
146
|
`chmod +x /etc/sv/harbr/#{name}/#{env}/log/run`
|
134
|
-
`chmod +x /etc/sv/harbr/#{name}/#{env}/finish`
|
135
147
|
end
|
136
148
|
|
137
149
|
def link_directories(name, version, 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.49
|
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-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: listen
|