smartcloud 0.0.206 → 0.0.207
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 788fa21a06c014435ff7d5d4d169f752b961bfb3234ceb876c80d1bb7700f9d2
|
4
|
+
data.tar.gz: 7450248485760c25c60b81d1ba6b2bf9a50ceee46f31f1b27a32138f33db00ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf091b8aa54686f175192781a50dd0c1376a64198f80d5bafddc376005229f1b4f1ee87df7a2d357a455aead002666fef92d64935b729337172fab43247c0503
|
7
|
+
data.tar.gz: f1be22ea9bc9d938b90fdaf1c3bbb29933c00f40e5044768061ca5fb5df83c5b0ad76db4cf9a391803b27a4cc56f9ebbe463d163697bb271b29b70e11d313602
|
@@ -113,7 +113,7 @@ module Smartcloud
|
|
113
113
|
--build-arg USER_NAME=`id -un` \
|
114
114
|
--build-arg USER_UID=`id -u` \
|
115
115
|
--build-arg DOCKER_GID=`getent group docker | cut -d: -f3` \
|
116
|
-
#{Smartcloud.config.root_path}/lib/smartcloud/grids/grid-runner")
|
116
|
+
#{Smartcloud.config.root_path}/lib/smartcloud/grids/grid-runner", out: File::NULL)
|
117
117
|
puts "done"
|
118
118
|
end
|
119
119
|
end
|
@@ -123,7 +123,7 @@ module Smartcloud
|
|
123
123
|
if system("docker image build -t smartcloud/buildpacks/rails \
|
124
124
|
--build-arg USER_UID=`id -u` \
|
125
125
|
--build-arg USER_NAME=`id -un` \
|
126
|
-
#{Smartcloud.config.root_path}/lib/smartcloud/grids/grid-runner/buildpacks/rails")
|
126
|
+
#{Smartcloud.config.root_path}/lib/smartcloud/grids/grid-runner/buildpacks/rails", out: File::NULL)
|
127
127
|
puts "done"
|
128
128
|
end
|
129
129
|
end
|
@@ -322,9 +322,12 @@ module Smartcloud
|
|
322
322
|
end
|
323
323
|
|
324
324
|
# Creating & Starting container
|
325
|
-
|
325
|
+
container_id = `docker ps -a -q --filter='name=^#{appname}_1$' --filter='status=running'`.chomp
|
326
|
+
new_container, old_container = container_id.empty? ? "#{appname}_1", "#{appname}_2" : "#{appname}_2", "#{appname}_1"
|
327
|
+
|
328
|
+
self.stop_app("#{new_container}")
|
326
329
|
if system("docker create \
|
327
|
-
--name='#{
|
330
|
+
--name='#{new_container}' \
|
328
331
|
--env-file='#{container_path}/env' \
|
329
332
|
--expose='5000' \
|
330
333
|
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
|
@@ -336,17 +339,16 @@ module Smartcloud
|
|
336
339
|
--network='nginx-network' \
|
337
340
|
smartcloud/buildpacks/rails", out: File::NULL)
|
338
341
|
|
339
|
-
system("docker network connect solr-network #{
|
340
|
-
system("docker network connect mysql-network #{
|
342
|
+
system("docker network connect solr-network #{new_container}")
|
343
|
+
system("docker network connect mysql-network #{new_container}")
|
341
344
|
|
342
|
-
if system("docker start --attach #{
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
end
|
345
|
+
if system("docker start --attach #{new_container}")
|
346
|
+
self.stop_app(old_container)
|
347
|
+
self.clean_up(container_path)
|
348
|
+
logger.info "Launched Application ... Success."
|
349
|
+
exit 10
|
348
350
|
else
|
349
|
-
self.stop_app("#{
|
351
|
+
self.stop_app("#{new_container}")
|
350
352
|
end
|
351
353
|
end
|
352
354
|
end
|
@@ -367,29 +369,6 @@ module Smartcloud
|
|
367
369
|
end
|
368
370
|
end
|
369
371
|
|
370
|
-
# Hot reloading app containers and removing old app container
|
371
|
-
def self.hot_reloaded_app?(appname)
|
372
|
-
logger.debug "Hot reloading '#{appname}' containers ..."
|
373
|
-
|
374
|
-
container_id = `docker ps -a -q --filter='name=^#{appname}$'`.chomp
|
375
|
-
unless container_id.empty?
|
376
|
-
if system("docker container rename #{appname} #{appname}_old", [:out, :err] => File::NULL)
|
377
|
-
logger.debug "Container renamed from #{appname} #{appname}_old"
|
378
|
-
if system("docker container rename #{appname}_new #{appname}", [:out, :err] => File::NULL)
|
379
|
-
logger.debug "Container renamed from #{appname}_new #{appname}"
|
380
|
-
self.stop_app("#{appname}_old")
|
381
|
-
return true
|
382
|
-
end
|
383
|
-
end
|
384
|
-
else
|
385
|
-
if system("docker container rename #{appname}_new #{appname}", [:out, :err] => File::NULL)
|
386
|
-
logger.debug "Container renamed from #{appname}_new #{appname}"
|
387
|
-
return true
|
388
|
-
end
|
389
|
-
end
|
390
|
-
return false
|
391
|
-
end
|
392
|
-
|
393
372
|
def self.load_container_env_vars(container_path)
|
394
373
|
unless File.exist? "#{container_path}/env"
|
395
374
|
logger.fatal "Environment could not be loaded ... Failed."
|
@@ -406,6 +385,7 @@ module Smartcloud
|
|
406
385
|
true
|
407
386
|
end
|
408
387
|
|
388
|
+
# Stop Container
|
409
389
|
def self.stop_container(container_name)
|
410
390
|
if Smartcloud::Docker.running?
|
411
391
|
container_id = `docker ps -a -q --filter='name=^#{container_name}$'`.chomp
|
@@ -10,7 +10,7 @@ while read oldrev newrev refname; do
|
|
10
10
|
REPOSITORY_BASENAME=$(basename $(readlink -nf "$PWD"/..))
|
11
11
|
fi
|
12
12
|
script --quiet --return --flush --command "runner prereceive $REPOSITORY_BASENAME $REMOTE_USER $oldrev $newrev $refname" /home/$(whoami)/.smartcloud/grids/grid-runner/apps/containers/$REPOSITORY_BASENAME/typescript
|
13
|
-
if [ "$?" -eq
|
13
|
+
if [ "$?" -eq 10 ]; then
|
14
14
|
exit 0
|
15
15
|
fi
|
16
16
|
exit 1
|