smartcloud 0.0.184 → 0.0.189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b036a69c41986c8bc466401694c5602292426a2aacf28bcdccb12ff60356d02
4
- data.tar.gz: 4be43d0d642cb6243372a2e9400ed58f9e5cf702dbfb1718388f031dbbd68227
3
+ metadata.gz: 8b33bd879a4af69d254a92c7e3805b93acf2e8a7b81865ec54a7c2858de36e60
4
+ data.tar.gz: 74c5aa93230e4687e667586d2f962a9590f7b3b5d2148354eab6fdd0bb4e5c84
5
5
  SHA512:
6
- metadata.gz: 2e8e26705bc738ce8e47e31915a76b8794be5195d8ddc1694b61ece548f39afa24c271aaf62f0a966e4bdad951207cc02e7ac211a7b87924915d67178838dbe0
7
- data.tar.gz: 98163e53f2528d250c880c7b418af7b9d44e58ce3b0237a0039f1325433388e4c638c3f7af3c6f17f600bd553fdf06f47af85ca4d57405dbdbe09725ebe74f9b
6
+ metadata.gz: 3afe318524b8f7257fa4a2fcf0bf8e987c41ab2d389204554205038bfc0e2fb93f38ea97011da02c44b1026af1db8a94cd7778e7e357bcafbd92fbe5cfdc2026
7
+ data.tar.gz: 8f3f9f882c999740ce6d7fe2962d12b1bc8895633545b8f6695a2c0716739ad0cce4e7fc9f73c84772f0522f5076fcbc71a44f5498d98f06c8404cf34f9050fa
@@ -72,10 +72,9 @@ module Smartcloud
72
72
  FileUtils.rm("tmp/pids/server.pid") if File.exist? "tmp/pids/server.pid"
73
73
 
74
74
  # if system("god -c Godfile -D")
75
- logger.info "Launched Application ... Success."
76
- # return true
75
+ return true
77
76
  # end
78
- return false
77
+ # return false
79
78
  end
80
79
 
81
80
  def set_logger_formatter_arrow
@@ -304,9 +304,11 @@ module Smartcloud
304
304
  system("grep -q '^RAILS_MASTER_KEY=' #{env_path} || echo 'RAILS_MASTER_KEY=yourmasterkey' >> #{env_path}")
305
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}")
306
306
 
307
- # Setup gems folder. If this is not created then docker will create it while running the container,
307
+ # Setup app folders. If this is not created then docker will create it while running the container,
308
308
  # but the folder will have root user assigned instead of the current user.
309
- FileUtils.mkdir_p("#{container_path}/gems")
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")
310
312
 
311
313
  # Setup Godfile
312
314
  unless File.exist? "#{container_path_with_version}/Godfile"
@@ -330,7 +332,9 @@ module Smartcloud
330
332
  --expose='5000' \
331
333
  --volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
332
334
  --volume='#{container_path_with_version}:/app' \
333
- --volume='#{container_path}/gems:/app/vendor/bundle' \
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' \
334
338
  --workdir='/app' \
335
339
  --restart='always' \
336
340
  --network='nginx-network' \
@@ -340,11 +344,12 @@ module Smartcloud
340
344
  system("docker network connect mysql-network #{appname}_new")
341
345
 
342
346
  if system("docker start --attach #{appname}_new")
343
- # Runs only if #{appname}_new has been started successfully and is reachable.
344
- self.hot_reloaded_app(appname)
345
- self.clean_up(container_path)
347
+ if self.hot_reloaded_app?(appname)
348
+ self.clean_up(container_path)
349
+ logger.info "Launched Application ... Success."
350
+ exit 0
351
+ end
346
352
  else
347
- # Runs only if #{appname}_new starting has failed.
348
353
  self.stop_app("#{appname}_new")
349
354
  end
350
355
  end
@@ -367,7 +372,7 @@ module Smartcloud
367
372
  end
368
373
 
369
374
  # Hot reloading app containers and removing old app container
370
- def self.hot_reloaded_app(appname)
375
+ def self.hot_reloaded_app?(appname)
371
376
  logger.debug "Hot reloading '#{appname}' containers ..."
372
377
 
373
378
  container_id = `docker ps -a -q --filter='name=^#{appname}$'`.chomp
@@ -377,13 +382,16 @@ module Smartcloud
377
382
  if system("docker container rename #{appname}_new #{appname}", [:out, :err] => File::NULL)
378
383
  logger.debug "Container renamed from #{appname}_new #{appname}"
379
384
  self.stop_app("#{appname}_old")
385
+ return true
380
386
  end
381
387
  end
382
388
  else
383
389
  if system("docker container rename #{appname}_new #{appname}", [:out, :err] => File::NULL)
384
390
  logger.debug "Container renamed from #{appname}_new #{appname}"
391
+ return true
385
392
  end
386
393
  end
394
+ return false
387
395
  end
388
396
 
389
397
  def self.load_container_env_vars(container_path)
@@ -9,6 +9,9 @@ while read oldrev newrev refname; do
9
9
  else
10
10
  REPOSITORY_BASENAME=$(basename $(readlink -nf "$PWD"/..))
11
11
  fi
12
- script -qfc "runner prereceive $REPOSITORY_BASENAME $REMOTE_USER $oldrev $newrev $refname" /home/$(whoami)/.smartcloud/grids/grid-runner/apps/containers/$REPOSITORY_BASENAME/typescript
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
14
+ exit 0
15
+ fi
13
16
  exit 1
14
17
  done
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.184
4
+ version: 0.0.189
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timeboard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-03 00:00:00.000000000 Z
11
+ date: 2019-09-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Smartcloud is a full-stack deployment framework for rails optimized for
14
14
  programmer happiness and peaceful administration. It encourages natural simplicity