smartcloud 0.0.183 → 0.0.188
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smartcloud/grids/buildpacker.rb +5 -8
- data/lib/smartcloud/grids/runner.rb +20 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c53fe02c5045ba4ecea4ff92cc9b3576d9cd23d820ac8c10fdac3e9b76e3c3b
|
4
|
+
data.tar.gz: ff8cbe7ca9d08a4e4150705d159291431746ddb748f93496fbf749b778055272
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd7ba77ecb3c4e62fec3d47314e1db6871c4df8f62a0d6c81d411caf21f9b74a243d1d555f6ff1a8cf17988de183273f6a02943189d8cf31a99b2c2f2ed68694
|
7
|
+
data.tar.gz: ed282e7ffd3a7f00d0e3721936b087126baeb324c9011f47cbb4476e9d84bfff1c11f4e508fc40fb9e02df7c5a7b06d50eb3f493548148a136818cf5beac9579
|
@@ -73,20 +73,17 @@ module Smartcloud
|
|
73
73
|
|
74
74
|
# if system("god -c Godfile -D")
|
75
75
|
logger.info "Launched Application ... Success."
|
76
|
-
|
76
|
+
return true
|
77
77
|
# end
|
78
|
-
return false
|
78
|
+
# return false
|
79
79
|
end
|
80
80
|
|
81
81
|
def set_logger_formatter_arrow
|
82
82
|
logger.formatter = proc do |severity, datetime, progname, message|
|
83
|
-
severity_text =
|
84
|
-
|
85
|
-
"WARN" => "\u{2757}", "ERROR" => "\u{2b55}", "FATAL" => "\u{274c}",
|
86
|
-
"UNKNOWN" => "\u{2753}"
|
83
|
+
severity_text = { "DEBUG" => "\u{1f527} #{severity}:", "INFO" => " \u{276f}", "WARN" => "\u{2757} #{severity}:",
|
84
|
+
"ERROR" => "\u{274c} #{severity}:", "FATAL" => "\u{2b55} #{severity}:", "UNKNOWN" => "\u{2753} #{severity}:"
|
87
85
|
}
|
88
|
-
|
89
|
-
"\t\t\t\t#{symbol_text} #{severity_text}#{message}\n"
|
86
|
+
"\t\t\t\t#{severity_text[severity]} #{message}\n"
|
90
87
|
end
|
91
88
|
end
|
92
89
|
|
@@ -220,13 +220,10 @@ module Smartcloud
|
|
220
220
|
|
221
221
|
def self.prereceive_app(appname, username, oldrev, newrev, refname)
|
222
222
|
logger.formatter = proc do |severity, datetime, progname, message|
|
223
|
-
severity_text =
|
224
|
-
|
225
|
-
"WARN" => "\u{2757}", "ERROR" => "\u{2b55}", "FATAL" => "\u{274c}",
|
226
|
-
"UNKNOWN" => "\u{2753}"
|
223
|
+
severity_text = { "DEBUG" => "\u{1f527} #{severity}:", "INFO" => " \u{276f}", "WARN" => "\u{2757} #{severity}:",
|
224
|
+
"ERROR" => "\u{274c} #{severity}:", "FATAL" => "\u{2b55} #{severity}:", "UNKNOWN" => "\u{2753} #{severity}:"
|
227
225
|
}
|
228
|
-
|
229
|
-
"\t\t\t\t#{symbol_text} #{severity_text}#{message}\n"
|
226
|
+
"\t\t\t\t#{severity_text[severity]} #{message}\n"
|
230
227
|
end
|
231
228
|
|
232
229
|
# Load vars and environment
|
@@ -253,7 +250,7 @@ module Smartcloud
|
|
253
250
|
FileUtils.mkdir_p(container_path_with_version)
|
254
251
|
if system("git archive #{newrev} | tar -x -C #{container_path_with_version}")
|
255
252
|
# Start App
|
256
|
-
self.start_app(appname)
|
253
|
+
return self.start_app(appname)
|
257
254
|
else
|
258
255
|
logger.fatal "Could not extract new app version ... Failed."
|
259
256
|
return
|
@@ -283,7 +280,7 @@ module Smartcloud
|
|
283
280
|
logger.info "Launching Application ..."
|
284
281
|
if File.exist? "#{container_path_with_version}/bin/rails"
|
285
282
|
# Starting Rails App
|
286
|
-
self.start_app_rails(appname, container_path, container_path_with_version)
|
283
|
+
return self.start_app_rails(appname, container_path, container_path_with_version)
|
287
284
|
end
|
288
285
|
end
|
289
286
|
end
|
@@ -307,9 +304,11 @@ module Smartcloud
|
|
307
304
|
system("grep -q '^RAILS_MASTER_KEY=' #{env_path} || echo 'RAILS_MASTER_KEY=yourmasterkey' >> #{env_path}")
|
308
305
|
logger.warn "Please set your RAILS_MASTER_KEY env var for this rails app." if system("grep -q '^RAILS_MASTER_KEY=yourmasterkey' #{env_path}")
|
309
306
|
|
310
|
-
# Setup
|
307
|
+
# Setup app folders. If this is not created then docker will create it while running the container,
|
311
308
|
# but the folder will have root user assigned instead of the current user.
|
312
|
-
FileUtils.mkdir_p("#{container_path}/
|
309
|
+
FileUtils.mkdir_p("#{container_path}/app/vendor/bundle")
|
310
|
+
FileUtils.mkdir_p("#{container_path}/app/public")
|
311
|
+
FileUtils.mkdir_p("#{container_path}/app/node_modules")
|
313
312
|
|
314
313
|
# Setup Godfile
|
315
314
|
unless File.exist? "#{container_path_with_version}/Godfile"
|
@@ -333,7 +332,9 @@ module Smartcloud
|
|
333
332
|
--expose='5000' \
|
334
333
|
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
|
335
334
|
--volume='#{container_path_with_version}:/app' \
|
336
|
-
--volume='#{container_path}/
|
335
|
+
--volume='#{container_path}/app/vendor/bundle:/app/vendor/bundle' \
|
336
|
+
--volume='#{container_path}/app/public:/app/public' \
|
337
|
+
--volume='#{container_path}/app/node_modules:/app/node_modules' \
|
337
338
|
--workdir='/app' \
|
338
339
|
--restart='always' \
|
339
340
|
--network='nginx-network' \
|
@@ -343,11 +344,11 @@ module Smartcloud
|
|
343
344
|
system("docker network connect mysql-network #{appname}_new")
|
344
345
|
|
345
346
|
if system("docker start --attach #{appname}_new")
|
346
|
-
|
347
|
-
|
348
|
-
|
347
|
+
if self.hot_reloaded_app?(appname)
|
348
|
+
self.clean_up(container_path)
|
349
|
+
exit 0
|
350
|
+
end
|
349
351
|
else
|
350
|
-
# Runs only if #{appname}_new starting has failed.
|
351
352
|
self.stop_app("#{appname}_new")
|
352
353
|
end
|
353
354
|
end
|
@@ -370,7 +371,7 @@ module Smartcloud
|
|
370
371
|
end
|
371
372
|
|
372
373
|
# Hot reloading app containers and removing old app container
|
373
|
-
def self.hot_reloaded_app(appname)
|
374
|
+
def self.hot_reloaded_app?(appname)
|
374
375
|
logger.debug "Hot reloading '#{appname}' containers ..."
|
375
376
|
|
376
377
|
container_id = `docker ps -a -q --filter='name=^#{appname}$'`.chomp
|
@@ -380,13 +381,16 @@ module Smartcloud
|
|
380
381
|
if system("docker container rename #{appname}_new #{appname}", [:out, :err] => File::NULL)
|
381
382
|
logger.debug "Container renamed from #{appname}_new #{appname}"
|
382
383
|
self.stop_app("#{appname}_old")
|
384
|
+
return true
|
383
385
|
end
|
384
386
|
end
|
385
387
|
else
|
386
388
|
if system("docker container rename #{appname}_new #{appname}", [:out, :err] => File::NULL)
|
387
389
|
logger.debug "Container renamed from #{appname}_new #{appname}"
|
390
|
+
return true
|
388
391
|
end
|
389
392
|
end
|
393
|
+
return false
|
390
394
|
end
|
391
395
|
|
392
396
|
def self.load_container_env_vars(container_path)
|