smartcloud 0.0.205 → 0.0.209
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d03b804d5d75667fd48fe4be369d4ab3e2716b1ba3df87dcd77594fbb1f6f100
|
4
|
+
data.tar.gz: 6ed2dcc85c6a23678c6aa277f10d8af47f324ac364f6f8602695ab57d5a2f4e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ab7ce146c7193bf3f9c66c8b85ffebb294bdc2d9269a5030411ca2133166398f1599d3d776a8a31b047041078904f92c0216354132c9d7c092a9d5683c7308c
|
7
|
+
data.tar.gz: c5af39503b1f553fc70be960a51af6ab51729a96a0bc9f48039a9559f880236633de2954277fabd9e82e6c656431fc7166f76bd89c5f6eda899b8b2ced65ace6
|
@@ -1,5 +1,14 @@
|
|
1
1
|
FROM ruby:2.6.4-alpine3.10
|
2
|
-
|
2
|
+
LABEL maintainer="Timeboard <hello@timeboard.me>"
|
3
|
+
|
4
|
+
# User
|
5
|
+
# --- Fix to change gid of 999 to 99 so that addgroup is free to create a group with 999 as gid
|
6
|
+
ARG USER_NAME
|
7
|
+
ARG USER_UID
|
8
|
+
ARG DOCKER_GID
|
9
|
+
RUN sed -i "s/999/99/" /etc/group && \
|
10
|
+
adduser --disabled-password --gecos "" --uid "$USER_UID" "$USER_NAME" && \
|
11
|
+
addgroup --gid "$DOCKER_GID" "docker" && adduser "$USER_NAME" "docker"
|
3
12
|
|
4
13
|
# FCGI Essentials
|
5
14
|
# --- IMPORTANT NOTE: This is custom built fcgiwrap package for alpine linux to account for NO_BUFFERING option.
|
@@ -16,13 +25,7 @@ RUN apk add --update coreutils && \
|
|
16
25
|
apk add --update spawn-fcgi && \
|
17
26
|
rm -rf /var/cache/apk/*
|
18
27
|
|
19
|
-
#
|
20
|
-
# --- Fix to change gid of 999 to 99 so that addgroup is free to create a group with 999 as gid
|
21
|
-
ARG USER_NAME
|
22
|
-
ARG USER_UID
|
23
|
-
ARG DOCKER_GID
|
24
|
-
RUN sed -i "s/999/99/" /etc/group && \
|
25
|
-
adduser --disabled-password --gecos "" --uid "$USER_UID" "$USER_NAME"
|
28
|
+
# Privileges
|
26
29
|
USER "$USER_NAME"
|
27
30
|
WORKDIR "/home/$USER_NAME/.smartcloud/grids/grid-runner/apps"
|
28
31
|
|
@@ -1,6 +1,11 @@
|
|
1
1
|
FROM ruby:2.6.4-alpine3.10
|
2
2
|
LABEL maintainer="Timeboard <hello@timeboard.me>"
|
3
3
|
|
4
|
+
# User
|
5
|
+
ARG USER_UID
|
6
|
+
ARG USER_NAME
|
7
|
+
RUN adduser --disabled-password --gecos "" --uid "$USER_UID" "$USER_NAME"
|
8
|
+
|
4
9
|
# Ruby on Rails Essentials
|
5
10
|
RUN apk add --update build-base && \
|
6
11
|
apk add --update tzdata && \
|
@@ -13,10 +18,7 @@ RUN apk add --update build-base && \
|
|
13
18
|
apk add --update mupdf-tools && \
|
14
19
|
rm -rf /var/cache/apk/*
|
15
20
|
|
16
|
-
#
|
17
|
-
ARG USER_UID
|
18
|
-
ARG USER_NAME
|
19
|
-
RUN adduser --disabled-password --gecos "" --uid "$USER_UID" "$USER_NAME"
|
21
|
+
# Privileges
|
20
22
|
USER "$USER_NAME"
|
21
23
|
WORKDIR "/app"
|
22
24
|
|
@@ -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
|