smartcloud 0.0.206 → 0.1.0.beta5
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 +3 -3
- data/lib/smartcloud/grids/grid-runner/Dockerfile +2 -2
- data/lib/smartcloud/grids/grid-runner/buildpacks/rails/Dockerfile +2 -3
- data/lib/smartcloud/grids/runner.rb +18 -51
- data/lib/smartcloud/templates/dotsmartcloud/grids/grid-runner/pre-receive +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: 62498c1f68025b362a0887fe07ff16f8f43eeae99955e9ff60b2098c10d7b0da
|
4
|
+
data.tar.gz: a85f8a5ac34a078ab695a6ca91db41c5aa06692b2ab45b951cd7e81f31a741a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bc01a890b6cefe16b7aab7f6fce7901a73de54a22ff2eceb05999be9cfd31218a9e4e02670470f09992e513c6036ccb365b9563dfe22761e76fa7c1d03a5fc3
|
7
|
+
data.tar.gz: 502d8097742296cbc37ad72114904123d7d8f4bbcbf8d66fc8d5bc010e016aea0905bd6abb1d41c99f5e037f01c58cbd98c0db25088df8984e6e9c1873d4a7fc
|
@@ -71,10 +71,10 @@ module Smartcloud
|
|
71
71
|
# Remove server.pid if it exists
|
72
72
|
FileUtils.rm("tmp/pids/server.pid") if File.exist? "tmp/pids/server.pid"
|
73
73
|
|
74
|
-
|
74
|
+
if system("bundle", "exec", "puma", "-C", "config/puma.rb")
|
75
75
|
return true
|
76
|
-
|
77
|
-
|
76
|
+
end
|
77
|
+
return false
|
78
78
|
end
|
79
79
|
|
80
80
|
def set_logger_formatter_arrow
|
@@ -1,5 +1,5 @@
|
|
1
1
|
FROM ruby:2.6.4-alpine3.10
|
2
|
-
|
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
|
@@ -30,6 +30,6 @@ USER "$USER_NAME"
|
|
30
30
|
WORKDIR "/home/$USER_NAME/.smartcloud/grids/grid-runner/apps"
|
31
31
|
|
32
32
|
# Gems
|
33
|
-
RUN gem install smartcloud
|
33
|
+
RUN gem install smartcloud --pre
|
34
34
|
|
35
35
|
CMD ["spawn-fcgi", "-n", "-p", "9000", "/usr/bin/fcgiwrap", "-f"]
|
@@ -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
|
@@ -307,26 +307,16 @@ module Smartcloud
|
|
307
307
|
FileUtils.mkdir_p("#{container_path}/app/public")
|
308
308
|
FileUtils.mkdir_p("#{container_path}/app/node_modules")
|
309
309
|
|
310
|
-
# Setup Godfile
|
311
|
-
unless File.exist? "#{container_path_with_version}/Godfile"
|
312
|
-
logger.warn "Godfile not detected. Adding a default Godfile. It is recommended to add your own Godfile."
|
313
|
-
page = <<~"HEREDOC"
|
314
|
-
God.watch do |w|
|
315
|
-
w.name = "web"
|
316
|
-
w.start = "bundle exec puma -C config/puma.rb"
|
317
|
-
w.behavior(:clean_pid_file)
|
318
|
-
w.keepalive
|
319
|
-
end
|
320
|
-
HEREDOC
|
321
|
-
system("echo '#{page}' > #{container_path_with_version}/Godfile")
|
322
|
-
end
|
323
|
-
|
324
310
|
# Creating & Starting container
|
325
|
-
|
311
|
+
container_id = `docker ps -a -q --filter='name=^#{appname}_1$' --filter='status=running'`.chomp
|
312
|
+
new_container = container_id.empty? ? "#{appname}_1" : "#{appname}_2"
|
313
|
+
old_container = container_id.empty? ? "#{appname}_2" : "#{appname}_1"
|
314
|
+
|
315
|
+
self.stop_app("#{new_container}")
|
326
316
|
if system("docker create \
|
327
|
-
--name='#{
|
317
|
+
--name='#{new_container}' \
|
328
318
|
--env-file='#{container_path}/env' \
|
329
|
-
--expose='
|
319
|
+
--expose='3000' \
|
330
320
|
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
|
331
321
|
--volume='#{container_path_with_version}:/app' \
|
332
322
|
--volume='#{container_path}/app/vendor/bundle:/app/vendor/bundle' \
|
@@ -336,17 +326,16 @@ module Smartcloud
|
|
336
326
|
--network='nginx-network' \
|
337
327
|
smartcloud/buildpacks/rails", out: File::NULL)
|
338
328
|
|
339
|
-
system("docker network connect solr-network #{
|
340
|
-
system("docker network connect mysql-network #{
|
329
|
+
system("docker network connect solr-network #{new_container}")
|
330
|
+
system("docker network connect mysql-network #{new_container}")
|
341
331
|
|
342
|
-
if system("docker start --attach #{
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
end
|
332
|
+
if system("docker start --attach #{new_container}")
|
333
|
+
self.stop_app(old_container)
|
334
|
+
self.clean_up(container_path)
|
335
|
+
logger.info "Launched Application ... Success."
|
336
|
+
exit 10
|
348
337
|
else
|
349
|
-
self.stop_app("#{
|
338
|
+
self.stop_app("#{new_container}")
|
350
339
|
end
|
351
340
|
end
|
352
341
|
end
|
@@ -367,29 +356,6 @@ module Smartcloud
|
|
367
356
|
end
|
368
357
|
end
|
369
358
|
|
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
359
|
def self.load_container_env_vars(container_path)
|
394
360
|
unless File.exist? "#{container_path}/env"
|
395
361
|
logger.fatal "Environment could not be loaded ... Failed."
|
@@ -406,6 +372,7 @@ module Smartcloud
|
|
406
372
|
true
|
407
373
|
end
|
408
374
|
|
375
|
+
# Stop Container
|
409
376
|
def self.stop_container(container_name)
|
410
377
|
if Smartcloud::Docker.running?
|
411
378
|
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
|
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.
|
4
|
+
version: 0.1.0.beta5
|
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-
|
11
|
+
date: 2019-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|