smartcloud 0.0.81 → 0.0.86
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/grid-runner/buildpacks/buildpacker.rb +2 -2
- data/lib/smartcloud/grids/grid-runner/buildpacks/rails/Dockerfile +2 -2
- data/lib/smartcloud/grids/runner.rb +39 -29
- metadata +2 -3
- data/lib/smartcloud/templates/dotsmartcloud/grids/grid-runner/buildpacks/rails/gems/.keep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 211f9df575810d1e2ecce55c218707e7fe3f5c531359596b7d9d5b58606e3e2f
|
4
|
+
data.tar.gz: '04827c4fba43e75c68ecdb8118ee35256678bf89e25e79bfff49867503ad49b9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a110a5e6cabd95b506dc8ebb7b2b27738e20a7b3e7a5974054fc1719fd4c5a8113236ba35b1710db5db0d8e7abbe6776ecc19744350a8f77a2c58e418b1dceee
|
7
|
+
data.tar.gz: aeb9eb96109fb2dfa84ca4b074c0872dc69b98b2bc0df0b189cc4fbe6b6374d128bace3d265ffd23e93f99c7c5faa1b22e147030191565af4e22c736c11ab55b
|
@@ -18,10 +18,10 @@ class Buildpacker
|
|
18
18
|
puts "done"
|
19
19
|
|
20
20
|
puts "-----> Running Web Server ... "
|
21
|
-
if system("
|
21
|
+
if system("god -c Godfile -D")
|
22
22
|
puts "-----> Launched Application ... Success."
|
23
23
|
end
|
24
|
-
exit 0
|
24
|
+
# exit 0
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -22,9 +22,9 @@ RUN apk add --update build-base && \
|
|
22
22
|
|
23
23
|
USER "$USER_NAME"
|
24
24
|
|
25
|
-
# Install bundler and
|
25
|
+
# Install bundler and god gems
|
26
26
|
RUN gem install bundler && \
|
27
|
-
gem install
|
27
|
+
gem install god
|
28
28
|
|
29
29
|
# Command to execute at container start
|
30
30
|
CMD ["ruby", "buildpacker.rb"]
|
@@ -186,7 +186,7 @@ module Smartcloud
|
|
186
186
|
end
|
187
187
|
unless File.exist? "#{container_path}/env"
|
188
188
|
print "-----> Creating App Environment ... "
|
189
|
-
|
189
|
+
page = <<~HEREDOC
|
190
190
|
## System
|
191
191
|
USERNAME=#{username}
|
192
192
|
KEEP_RELEASES=3
|
@@ -196,8 +196,8 @@ module Smartcloud
|
|
196
196
|
LETSENCRYPT_HOST=#{appname}.#{Smartcloud.config.apps_domain}
|
197
197
|
LETSENCRYPT_EMAIL=#{Smartcloud.config.sysadmin_email}
|
198
198
|
LETSENCRYPT_TEST=false
|
199
|
-
|
200
|
-
puts "done"
|
199
|
+
HEREDOC
|
200
|
+
puts "done" if system("echo '#{page}' > #{container_path}/env")
|
201
201
|
end
|
202
202
|
end
|
203
203
|
end
|
@@ -218,13 +218,10 @@ module Smartcloud
|
|
218
218
|
end
|
219
219
|
|
220
220
|
def self.prereceive_app(appname, username, oldrev, newrev, refname)
|
221
|
-
STDOUT.sync = true
|
222
|
-
logger = Logger.new(STDOUT)
|
223
|
-
|
224
221
|
container_path = "#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/containers/#{appname}"
|
225
222
|
|
226
223
|
## Verify the user and ensure the user is correct and has access to this repository
|
227
|
-
|
224
|
+
print "-----> Verifying User ... "
|
228
225
|
unless File.exist? "#{container_path}/env"
|
229
226
|
puts "Environment could not be loaded ... Failed."
|
230
227
|
exit 1
|
@@ -240,7 +237,7 @@ module Smartcloud
|
|
240
237
|
|
241
238
|
# Match Username
|
242
239
|
unless ENV['USERNAME'] == username
|
243
|
-
puts "
|
240
|
+
puts "Unauthorized."
|
244
241
|
exit 1
|
245
242
|
end
|
246
243
|
puts "done"
|
@@ -250,18 +247,18 @@ module Smartcloud
|
|
250
247
|
if refname == "refs/heads/master"
|
251
248
|
print "-----> Initializing Application ... "
|
252
249
|
|
253
|
-
# Note: There should be no space between + and " in
|
250
|
+
# Note: There should be no space between + and " in version.
|
254
251
|
# Note: date will be UTC date until timezone has been changed.
|
255
|
-
|
256
|
-
|
252
|
+
version = `date +"%Y%m%d%H%M%S"`.chomp!
|
253
|
+
container_path_with_version = "#{container_path}/releases/#{version}"
|
257
254
|
|
258
|
-
unless Dir.exist?
|
259
|
-
FileUtils.mkdir_p(
|
260
|
-
if system("git archive #{newrev} | tar -x -C #{
|
255
|
+
unless Dir.exist? container_path_with_version
|
256
|
+
FileUtils.mkdir_p(container_path_with_version)
|
257
|
+
if system("git archive #{newrev} | tar -x -C #{container_path_with_version}")
|
261
258
|
puts "done"
|
262
259
|
|
263
260
|
# Clean up very old versions
|
264
|
-
Dir.chdir(container_path) do
|
261
|
+
Dir.chdir("#{container_path}/releases") do
|
265
262
|
app_versions = Dir.glob('*').select { |f| File.directory? f }.sort
|
266
263
|
destroy_count = app_versions.count - ENV['KEEP_RELEASES'].to_i
|
267
264
|
if destroy_count > 0
|
@@ -279,6 +276,9 @@ module Smartcloud
|
|
279
276
|
puts "Could not extract new app version ... Failed."
|
280
277
|
exit 1
|
281
278
|
end
|
279
|
+
else
|
280
|
+
puts "This version name already exists ... Failed."
|
281
|
+
exit 1
|
282
282
|
end
|
283
283
|
end
|
284
284
|
end
|
@@ -287,26 +287,26 @@ module Smartcloud
|
|
287
287
|
if Smartcloud::Docker.running?
|
288
288
|
container_path = "#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/containers/#{appname}"
|
289
289
|
|
290
|
-
Dir.chdir(container_path) do
|
290
|
+
Dir.chdir("#{container_path}/releases") do
|
291
291
|
if app_version == 0
|
292
292
|
app_versions = Dir.glob('*').select { |f| File.directory? f }.sort
|
293
293
|
app_version = app_versions.last
|
294
294
|
end
|
295
295
|
|
296
|
-
|
296
|
+
container_path_with_version = "#{container_path}/releases/#{app_version}"
|
297
297
|
|
298
298
|
# Setup Buildpacker
|
299
299
|
buildpacker_path = "#{Smartcloud.config.root_path}/lib/smartcloud/grids/grid-runner/buildpacks/buildpacker.rb"
|
300
|
-
FileUtils.cp(buildpacker_path,
|
300
|
+
FileUtils.cp(buildpacker_path, container_path_with_version)
|
301
301
|
|
302
302
|
puts "-----> Launching Application ... "
|
303
303
|
|
304
|
-
if File.exist? "#{
|
304
|
+
if File.exist? "#{container_path_with_version}/bin/rails"
|
305
305
|
# Stopping & Removing container
|
306
306
|
self.stop_app(appname)
|
307
307
|
|
308
308
|
# Starting Rails App
|
309
|
-
self.start_app_rails(appname, container_path,
|
309
|
+
self.start_app_rails(appname, container_path, container_path_with_version)
|
310
310
|
end
|
311
311
|
end
|
312
312
|
end
|
@@ -333,7 +333,7 @@ module Smartcloud
|
|
333
333
|
end
|
334
334
|
end
|
335
335
|
|
336
|
-
def self.start_app_rails(appname, container_path,
|
336
|
+
def self.start_app_rails(appname, container_path, container_path_with_version)
|
337
337
|
puts "-----> Ruby on Rails application detected"
|
338
338
|
|
339
339
|
# Setup rails env
|
@@ -347,12 +347,22 @@ module Smartcloud
|
|
347
347
|
system("grep -q '^RAILS_MASTER_KEY=' #{env_path} || echo 'RAILS_MASTER_KEY=yourmasterkey' >> #{env_path}")
|
348
348
|
puts "-----> WARNING: Please set your RAILS_MASTER_KEY env var for this rails app." if system("grep -q '^RAILS_MASTER_KEY=yourmasterkey' #{env_path}")
|
349
349
|
|
350
|
-
# Setup
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
350
|
+
# Setup gems folder. If this is not created then docker will create it while running the container,
|
351
|
+
# but the folder will have root user assigned instead of the current user.
|
352
|
+
FileUtils.mkdir_p("#{container_path}/gems")
|
353
|
+
|
354
|
+
# Setup Godfile
|
355
|
+
unless File.exist? "#{container_path_with_version}/Godfile"
|
356
|
+
puts "-----> WARNING: Godfile not detected. Adding a default Godfile. It is recommended to add your own Godfile."
|
357
|
+
page = <<~HEREDOC
|
358
|
+
God.watch do |w|
|
359
|
+
w.name = 'web'
|
360
|
+
w.start = 'bundle exec puma -C config/puma.rb'
|
361
|
+
w.behavior(:clean_pid_file)
|
362
|
+
w.keepalive
|
363
|
+
end
|
364
|
+
HEREDOC
|
365
|
+
system("echo '#{page}' > #{container_path_with_version}/Godfile")
|
356
366
|
end
|
357
367
|
|
358
368
|
# Creating & Starting container
|
@@ -360,8 +370,8 @@ module Smartcloud
|
|
360
370
|
--name='#{appname}' \
|
361
371
|
--env-file='#{container_path}/env' \
|
362
372
|
--expose='5000' \
|
363
|
-
--volume='#{
|
364
|
-
--volume='#{
|
373
|
+
--volume='#{container_path_with_version}:/code' \
|
374
|
+
--volume='#{container_path}/gems:/code/vendor/bundle' \
|
365
375
|
--workdir='/code' \
|
366
376
|
--restart='always' \
|
367
377
|
--network='nginx-network' \
|
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.0.86
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timeboard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-01 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
|
@@ -48,7 +48,6 @@ files:
|
|
48
48
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/users.yml
|
49
49
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-runner/apps/containers/.keep
|
50
50
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-runner/apps/repositories/.keep
|
51
|
-
- lib/smartcloud/templates/dotsmartcloud/grids/grid-runner/buildpacks/rails/gems/.keep
|
52
51
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-runner/pre-receive
|
53
52
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-solr/data/.keep
|
54
53
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-solr/data/README.txt
|
File without changes
|