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: 6c62081c62d76faea905c0502e283247123f433d020ae50d47f50dfb1416c293
4
- data.tar.gz: 91bc5b352f3f2c87c23aa7e6d65fdde68acb7994f7fad982374456556bf09689
3
+ metadata.gz: 788fa21a06c014435ff7d5d4d169f752b961bfb3234ceb876c80d1bb7700f9d2
4
+ data.tar.gz: 7450248485760c25c60b81d1ba6b2bf9a50ceee46f31f1b27a32138f33db00ef
5
5
  SHA512:
6
- metadata.gz: 6ec10636c50c3aa415047521e5e1e4712a21c4497f565d65f55cc3a9a34cb14990cf29067c0994dd3d51e67b32a01b48f4c60c96eaa2fa2f6c34536817c24282
7
- data.tar.gz: a140bbac432112aaf0e33020612238ff2f11a24242ecf22a17bb28930934af23eea383d15b5c88e9cce1d08d1fa3de5c4cf6d5a5dded857e7f1c66b63bcfe183
6
+ metadata.gz: cf091b8aa54686f175192781a50dd0c1376a64198f80d5bafddc376005229f1b4f1ee87df7a2d357a455aead002666fef92d64935b729337172fab43247c0503
7
+ data.tar.gz: f1be22ea9bc9d938b90fdaf1c3bbb29933c00f40e5044768061ca5fb5df83c5b0ad76db4cf9a391803b27a4cc56f9ebbe463d163697bb271b29b70e11d313602
@@ -1,5 +1,5 @@
1
1
  FROM ruby:2.6.4-alpine3.10
2
- MAINTAINER Timeboard <hello@timeboard.me>
2
+ LABEL maintainer="Timeboard <hello@timeboard.me>"
3
3
 
4
4
  # User
5
5
  # --- Fix to change gid of 999 to 99 so that addgroup is free to create a group with 999 as gid
@@ -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
- self.stop_app("#{appname}_new")
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='#{appname}_new' \
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 #{appname}_new")
340
- system("docker network connect mysql-network #{appname}_new")
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 #{appname}_new")
343
- if self.hot_reloaded_app?(appname)
344
- self.clean_up(container_path)
345
- logger.info "Launched Application ... Success."
346
- exit 0
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("#{appname}_new")
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 0 ]; then
13
+ if [ "$?" -eq 10 ]; then
14
14
  exit 0
15
15
  fi
16
16
  exit 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.206
4
+ version: 0.0.207
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timeboard