smartcloud 0.0.206 → 0.1.0.beta4
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 +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 +1 -1
- data/lib/smartcloud/grids/runner.rb +17 -36
- data/lib/smartcloud/templates/dotsmartcloud/grids/grid-runner/pre-receive +1 -1
- 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: c2193237edead97e61dd871f7ae5ae00af0a9005d40b0beeba2ab8ac3e010e68
|
4
|
+
data.tar.gz: bd48522fff882387e0d66713801e8f263a8140f572cf1fc3fdb83ba7fcf682e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d545a880e5e673c37d78c37a6ebf31234bf9f1d68f002a3535cd623e8b49ff84e6b6e7b028367a6657e963fe9606cbe388d0d096389d5c5c76858a2203f286ae
|
7
|
+
data.tar.gz: 762d37be0e30f250c140d7fd21d8a0f01a40810d06baa136fcd4f775bb607a17a37efdff433a6fc7a5dec4dfe925bfdf4305a86b95abee3951cd42a8c7b7cf63
|
@@ -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", out: File::NULL)
|
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
|
@@ -322,9 +322,13 @@ 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 = container_id.empty? ? "#{appname}_1" : "#{appname}_2"
|
327
|
+
old_container = container_id.empty? ? "#{appname}_2" : "#{appname}_1"
|
328
|
+
|
329
|
+
self.stop_app("#{new_container}")
|
326
330
|
if system("docker create \
|
327
|
-
--name='#{
|
331
|
+
--name='#{new_container}' \
|
328
332
|
--env-file='#{container_path}/env' \
|
329
333
|
--expose='5000' \
|
330
334
|
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
|
@@ -336,17 +340,16 @@ module Smartcloud
|
|
336
340
|
--network='nginx-network' \
|
337
341
|
smartcloud/buildpacks/rails", out: File::NULL)
|
338
342
|
|
339
|
-
system("docker network connect solr-network #{
|
340
|
-
system("docker network connect mysql-network #{
|
343
|
+
system("docker network connect solr-network #{new_container}")
|
344
|
+
system("docker network connect mysql-network #{new_container}")
|
341
345
|
|
342
|
-
if system("docker start --attach #{
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
end
|
346
|
+
if system("docker start --attach #{new_container}")
|
347
|
+
self.stop_app(old_container)
|
348
|
+
self.clean_up(container_path)
|
349
|
+
logger.info "Launched Application ... Success."
|
350
|
+
exit 10
|
348
351
|
else
|
349
|
-
self.stop_app("#{
|
352
|
+
self.stop_app("#{new_container}")
|
350
353
|
end
|
351
354
|
end
|
352
355
|
end
|
@@ -367,29 +370,6 @@ module Smartcloud
|
|
367
370
|
end
|
368
371
|
end
|
369
372
|
|
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
373
|
def self.load_container_env_vars(container_path)
|
394
374
|
unless File.exist? "#{container_path}/env"
|
395
375
|
logger.fatal "Environment could not be loaded ... Failed."
|
@@ -406,6 +386,7 @@ module Smartcloud
|
|
406
386
|
true
|
407
387
|
end
|
408
388
|
|
389
|
+
# Stop Container
|
409
390
|
def self.stop_container(container_name)
|
410
391
|
if Smartcloud::Docker.running?
|
411
392
|
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
|