smartcloud 0.0.198 → 0.0.203
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/smartcloud +21 -1
- data/lib/smartcloud/boot.rb +8 -6
- data/lib/smartcloud/engine.rb +38 -0
- data/lib/smartcloud/engine/Dockerfile +5 -8
- data/lib/smartcloud/grids/buildpacker.rb +5 -5
- data/lib/smartcloud/grids/grid-runner/Dockerfile +14 -27
- data/lib/smartcloud/grids/grid-runner/buildpacks/rails/Dockerfile +9 -20
- data/lib/smartcloud/grids/runner.rb +3 -5
- data/lib/smartcloud/machine.rb +23 -0
- data/lib/smartcloud/templates/machine/config/machine.yml +5 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f39e9f8572245850d400240d2562d24233f0510f53576d5aa5618583b7f0a8a6
|
4
|
+
data.tar.gz: b994f906a8d88af94c62381f9a327159c253f4b639ec17d3c63f0d1ff2692dc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43656caf7f2c93f42bd216881260f2c4e7afc701c13742d0f55eb018c60ab28f1b6cf5833e09d6a6037a2503910f6a707d72a3b91ed9811259d9ae2f9c1c6a49
|
7
|
+
data.tar.gz: d5636d2f9f6ebef5666bf68a1ac179b2806a91f69bc268dcef9df2758d1d0eeae5f4dbdb27b8bf15aaede4f149a6a837b3cb834a4e72cc7e8f235ff6eaf75ca1
|
data/bin/smartcloud
CHANGED
@@ -9,6 +9,24 @@ elsif !Smartcloud::Boot.initialized?
|
|
9
9
|
exit
|
10
10
|
end
|
11
11
|
|
12
|
+
# if ARGV[0] == 'new'
|
13
|
+
# machine = Smartcloud::Machine.new
|
14
|
+
# raise "Please specify machine name" unless ARGV[1]
|
15
|
+
# machine.create(ARGV[1])
|
16
|
+
# elsif ARGV[0] == 'install'
|
17
|
+
# machine = Smartcloud::Machine.new
|
18
|
+
# machine.install_docker
|
19
|
+
# machine.install_engine
|
20
|
+
# elsif ARGV[0] == 'uninstall'
|
21
|
+
# machine = Smartcloud::Machine.new
|
22
|
+
# machine.uninstall_engine
|
23
|
+
# machine.uninstall_docker
|
24
|
+
# elsif ARGV[0] == 'run'
|
25
|
+
# machine = Smartcloud::Machine.new
|
26
|
+
# ARGV.shift
|
27
|
+
# raise "Please specify command to run" unless ARGV[0]
|
28
|
+
# machine.run(ARGV)
|
29
|
+
|
12
30
|
if ARGV[0] == 'docker'
|
13
31
|
if ARGV[1] == 'install'
|
14
32
|
Smartcloud::Docker.install
|
@@ -51,4 +69,6 @@ elsif ARGV[0] == 'grids'
|
|
51
69
|
# elsif ARGV[1] == 'destroy'
|
52
70
|
# Smartcloud::User.destroy(ARGV[2], ARGV[3])
|
53
71
|
# end
|
54
|
-
|
72
|
+
else
|
73
|
+
puts "Specify a command to execute."
|
74
|
+
end
|
data/lib/smartcloud/boot.rb
CHANGED
@@ -83,12 +83,14 @@ module Smartcloud
|
|
83
83
|
end
|
84
84
|
|
85
85
|
require 'smartcloud/machine'
|
86
|
-
require 'smartcloud/docker'
|
87
86
|
|
88
|
-
require 'smartcloud/
|
89
|
-
require 'smartcloud/
|
90
|
-
require 'smartcloud/grids/buildpacker'
|
91
|
-
require 'smartcloud/grids/solr'
|
92
|
-
require 'smartcloud/grids/mysql'
|
87
|
+
require 'smartcloud/engine'
|
88
|
+
require 'smartcloud/docker'
|
93
89
|
|
94
90
|
require 'smartcloud/user'
|
91
|
+
|
92
|
+
require 'smartcloud/grids/mysql'
|
93
|
+
require 'smartcloud/grids/solr'
|
94
|
+
require 'smartcloud/grids/buildpacker'
|
95
|
+
require 'smartcloud/grids/runner'
|
96
|
+
require 'smartcloud/grids/nginx'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# The main Smartcloud Engine driver
|
2
|
+
module Smartcloud
|
3
|
+
class Engine < Smartcloud::Base
|
4
|
+
def initialize
|
5
|
+
end
|
6
|
+
|
7
|
+
def create_images
|
8
|
+
# unless system("docker image inspect smartcloud", [:out, :err] => File::NULL)
|
9
|
+
# print "-----> Creating image smartcloud ... "
|
10
|
+
# if system("docker image build -t smartcloud \
|
11
|
+
# --build-arg DOCKER_GID=`getent group docker | cut -d: -f3` \
|
12
|
+
# --build-arg USER_UID=`id -u` \
|
13
|
+
# --build-arg USER_NAME=`id -un` \
|
14
|
+
# #{Smartcloud.config.root_path}/lib/smartcloud/engine")
|
15
|
+
# puts "done"
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
|
19
|
+
#docker build -t smartcloud \
|
20
|
+
# --build-arg USER_UID=`id -u` \
|
21
|
+
# --build-arg USER_GID=`id -g` \
|
22
|
+
# --build-arg USER_NAME=`id -un` \
|
23
|
+
# .
|
24
|
+
|
25
|
+
# docker run -it --rm -v "/home/$(whoami)/.smartcloud:/home/$(whoami)/.smartcloud" smartcloud
|
26
|
+
#
|
27
|
+
# system("docker create \
|
28
|
+
# --name='smartcloud' \
|
29
|
+
# --volume='#{Smartcloud.config.user_home_path}/.gem:#{Smartcloud.config.user_home_path}/.gem' \
|
30
|
+
# --volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
|
31
|
+
# --volume='#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner:#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner' \
|
32
|
+
# --volume='/var/run/docker.sock:/var/run/docker.sock' \
|
33
|
+
# --restart='always' \
|
34
|
+
# --network='nginx-network' \
|
35
|
+
# smartcloud/runner", out: File::NULL)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,30 +1,27 @@
|
|
1
1
|
FROM ruby:2.6.4-alpine3.10
|
2
2
|
MAINTAINER Timeboard <hello@timeboard.me>
|
3
3
|
|
4
|
+
RUN apk add --update docker && \
|
5
|
+
rm -rf /var/cache/apk/*
|
6
|
+
|
4
7
|
# Setting up group and user
|
5
8
|
# - envs
|
6
9
|
ARG USER_NAME
|
7
10
|
ARG USER_UID
|
8
|
-
ARG USER_GID
|
9
11
|
ARG DOCKER_GID
|
10
12
|
# - fix to change gid of 999 to 99 so that addgroup is free to create a group with 999 as gid
|
11
13
|
# - Create group & user. Then add user to group
|
12
14
|
RUN sed -i "s/999/99/" /etc/group && \
|
13
15
|
adduser --disabled-password --gecos "" --uid $USER_UID $USER_NAME && \
|
14
|
-
addgroup --gid $USER_GID $USER_NAME && adduser $USER_NAME $USER_NAME && \
|
15
16
|
addgroup --gid $DOCKER_GID "docker" && adduser $USER_NAME docker
|
17
|
+
|
16
18
|
USER "$USER_NAME"
|
17
19
|
WORKDIR "/home/$USER_NAME/.smartcloud"
|
18
20
|
|
19
21
|
# Generating entrypoint file
|
20
22
|
RUN echo -e '#!/bin/sh\n\
|
21
23
|
gem install --no-document smartcloud\n\
|
22
|
-
exec "$@"' >> "/home/$(whoami)/entrypoint"; chmod +x "/home/$(whoami)/entrypoint"
|
23
|
-
|
24
|
-
RUN apk add --update docker && \
|
25
|
-
rm -rf /var/cache/apk/*
|
24
|
+
exec smartcloud "$@"' >> "/home/$(whoami)/entrypoint"; chmod +x "/home/$(whoami)/entrypoint"
|
26
25
|
|
27
26
|
# Set entrypoint
|
28
27
|
ENTRYPOINT "/home/$(whoami)/entrypoint"
|
29
|
-
|
30
|
-
CMD ["smartcloud"]
|
@@ -24,7 +24,7 @@ module Smartcloud
|
|
24
24
|
exit 0
|
25
25
|
end
|
26
26
|
|
27
|
-
# Perform bundle install
|
27
|
+
# Perform bundle install
|
28
28
|
def bundle_install?
|
29
29
|
logger.info "Performing bundle install ..."
|
30
30
|
|
@@ -43,7 +43,7 @@ module Smartcloud
|
|
43
43
|
return false
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
# Perform pre-compiling of assets
|
48
48
|
def precompile_assets?
|
49
49
|
logger.info "Installing Javascript dependencies & pre-compiling assets ..."
|
@@ -63,7 +63,7 @@ module Smartcloud
|
|
63
63
|
return false
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
# Perform starting of web server
|
68
68
|
def start_web_server?
|
69
69
|
logger.debug "Starting Web Server ..."
|
@@ -76,7 +76,7 @@ module Smartcloud
|
|
76
76
|
# end
|
77
77
|
# return false
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
def set_logger_formatter_arrow
|
81
81
|
logger.formatter = proc do |severity, datetime, progname, message|
|
82
82
|
severity_text = { "DEBUG" => "\u{1f527} #{severity}:", "INFO" => " \u{276f}", "WARN" => "\u{2757} #{severity}:",
|
@@ -85,7 +85,7 @@ module Smartcloud
|
|
85
85
|
"\t\t\t\t#{severity_text[severity]} #{message}\n"
|
86
86
|
end
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
def set_logger_formatter_tabs
|
90
90
|
logger.formatter = proc do |severity, datetime, progname, message|
|
91
91
|
"\t\t\t\t #{message}"
|
@@ -1,26 +1,10 @@
|
|
1
1
|
FROM ruby:2.6.4-alpine3.10
|
2
2
|
MAINTAINER Timeboard <hello@timeboard.me>
|
3
3
|
|
4
|
-
#
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
ARG USER_NAME
|
9
|
-
# - fix to change gid of 999 to 99 so that addgroup is free to create a group with 999 as gid
|
10
|
-
# - Create group & user. Then add user to group
|
11
|
-
RUN sed -i "s/999/99/" /etc/group && \
|
12
|
-
addgroup --gid "$DOCKER_GID" "docker" && \
|
13
|
-
adduser --disabled-password --gecos "" --uid "$USER_UID" "$USER_NAME" && \
|
14
|
-
adduser "$USER_NAME" "docker"
|
15
|
-
USER "$USER_NAME"
|
16
|
-
# We need the following:
|
17
|
-
# - fcgiwrap, because that is how nginx does CGI
|
18
|
-
# ----- IMPORTANT NOTE: This is custom build fcgiwrap package to account for NO_BUFFERING option.
|
19
|
-
# ----- Original fcgiwrap: https://github.com/gnosek/fcgiwrap
|
20
|
-
# ----- Custom fcgiwrap: https://github.com/notr1ch/fcgiwrap
|
21
|
-
# - git and git-daemon, because that gets us the git-http-backend CGI script
|
22
|
-
# - ruby, to run smartcloud gem
|
23
|
-
# - spawn-fcgi, to launch fcgiwrap and to create the unix socket
|
4
|
+
# FCGI Essentials
|
5
|
+
# --- IMPORTANT NOTE: This is custom built fcgiwrap package for alpine linux to account for NO_BUFFERING option.
|
6
|
+
# --- Original fcgiwrap: https://github.com/gnosek/fcgiwrap
|
7
|
+
# --- Custom fcgiwrap: https://github.com/notr1ch/fcgiwrap
|
24
8
|
COPY fcgiwrap /root/apk-packages/fcgiwrap
|
25
9
|
RUN apk add fcgiwrap --repository /root/apk-packages/fcgiwrap/packages/main --allow-untrusted && \
|
26
10
|
rm -rf /root/apk-packages
|
@@ -32,15 +16,18 @@ RUN apk add --update coreutils && \
|
|
32
16
|
apk add --update spawn-fcgi && \
|
33
17
|
rm -rf /var/cache/apk/*
|
34
18
|
|
19
|
+
# User
|
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" && \
|
26
|
+
addgroup --gid "$DOCKER_GID" "docker" && adduser "$USER_NAME" "docker"
|
35
27
|
USER "$USER_NAME"
|
36
28
|
WORKDIR "/home/$USER_NAME/.smartcloud/grids/grid-runner/apps"
|
37
29
|
|
38
|
-
#
|
39
|
-
RUN
|
40
|
-
gem install --no-document --local smartcloud\n\
|
41
|
-
exec "$@"' >> "/home/$(whoami)/entrypoint"; chmod +x "/home/$(whoami)/entrypoint"
|
42
|
-
|
43
|
-
# Set entrypoint
|
44
|
-
ENTRYPOINT "/home/$(whoami)/entrypoint"
|
30
|
+
# Gems
|
31
|
+
RUN gem install smartcloud
|
45
32
|
|
46
33
|
CMD ["spawn-fcgi", "-n", "-p", "9000", "/usr/bin/fcgiwrap", "-f"]
|
@@ -1,14 +1,7 @@
|
|
1
1
|
FROM ruby:2.6.4-alpine3.10
|
2
|
-
|
2
|
+
LABEL maintainer="Timeboard <hello@timeboard.me>"
|
3
3
|
|
4
|
-
#
|
5
|
-
# - envs
|
6
|
-
ARG USER_UID
|
7
|
-
ARG USER_NAME
|
8
|
-
# - Create user.
|
9
|
-
RUN adduser --disabled-password --gecos "" --uid "$USER_UID" "$USER_NAME"
|
10
|
-
|
11
|
-
# Install Ruby on Rails Essentials
|
4
|
+
# Ruby on Rails Essentials
|
12
5
|
RUN apk add --update build-base && \
|
13
6
|
apk add --update tzdata && \
|
14
7
|
apk add --update nodejs && \
|
@@ -20,20 +13,16 @@ RUN apk add --update build-base && \
|
|
20
13
|
apk add --update mupdf-tools && \
|
21
14
|
rm -rf /var/cache/apk/*
|
22
15
|
|
16
|
+
# User
|
17
|
+
ARG USER_UID
|
18
|
+
ARG USER_NAME
|
19
|
+
RUN adduser --disabled-password --gecos "" --uid "$USER_UID" "$USER_NAME"
|
23
20
|
USER "$USER_NAME"
|
24
21
|
WORKDIR "/app"
|
25
22
|
|
26
|
-
#
|
27
|
-
RUN gem install
|
23
|
+
# Gems
|
24
|
+
RUN gem install smartcloud && \
|
25
|
+
gem install bundler && \
|
28
26
|
gem install god
|
29
27
|
|
30
|
-
# Generating entrypoint file
|
31
|
-
RUN echo -e '#!/bin/sh\n\
|
32
|
-
gem install --no-document --local smartcloud\n\
|
33
|
-
exec "$@"' >> "/home/$(whoami)/entrypoint"; chmod +x "/home/$(whoami)/entrypoint"
|
34
|
-
|
35
|
-
# Set entrypoint
|
36
|
-
ENTRYPOINT "/home/$(whoami)/entrypoint"
|
37
|
-
|
38
|
-
# Command to execute at container start
|
39
28
|
CMD ["buildpacker", "start"]
|
@@ -27,7 +27,6 @@ module Smartcloud
|
|
27
27
|
--env GIT_PROJECT_ROOT=#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner/apps/repositories \
|
28
28
|
--env GIT_HTTP_EXPORT_ALL="" \
|
29
29
|
--expose='9000' \
|
30
|
-
--volume='#{Smartcloud.config.user_home_path}/.gem:#{Smartcloud.config.user_home_path}/.gem' \
|
31
30
|
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
|
32
31
|
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner:#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-runner' \
|
33
32
|
--volume='/var/run/docker.sock:/var/run/docker.sock' \
|
@@ -111,9 +110,9 @@ module Smartcloud
|
|
111
110
|
unless system("docker image inspect smartcloud/runner", [:out, :err] => File::NULL)
|
112
111
|
print "-----> Creating image smartcloud/runner ... "
|
113
112
|
if system("docker image build -t smartcloud/runner \
|
114
|
-
--build-arg DOCKER_GID=`getent group docker | cut -d: -f3` \
|
115
|
-
--build-arg USER_UID=`id -u` \
|
116
113
|
--build-arg USER_NAME=`id -un` \
|
114
|
+
--build-arg USER_UID=`id -u` \
|
115
|
+
--build-arg DOCKER_GID=`getent group docker | cut -d: -f3` \
|
117
116
|
#{Smartcloud.config.root_path}/lib/smartcloud/grids/grid-runner")
|
118
117
|
puts "done"
|
119
118
|
end
|
@@ -328,7 +327,6 @@ module Smartcloud
|
|
328
327
|
--name='#{appname}_new' \
|
329
328
|
--env-file='#{container_path}/env' \
|
330
329
|
--expose='5000' \
|
331
|
-
--volume='#{Smartcloud.config.user_home_path}/.gem:#{Smartcloud.config.user_home_path}/.gem' \
|
332
330
|
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/config:#{Smartcloud.config.user_home_path}/.smartcloud/config' \
|
333
331
|
--volume='#{container_path_with_version}:/app' \
|
334
332
|
--volume='#{container_path}/app/vendor/bundle:/app/vendor/bundle' \
|
@@ -346,7 +344,7 @@ module Smartcloud
|
|
346
344
|
self.clean_up(container_path)
|
347
345
|
logger.info "Launched Application ... Success."
|
348
346
|
exit 0
|
349
|
-
end
|
347
|
+
end
|
350
348
|
else
|
351
349
|
self.stop_app("#{appname}_new")
|
352
350
|
end
|
data/lib/smartcloud/machine.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "net/ssh"
|
2
|
+
|
1
3
|
# The main Smartcloud Machine driver
|
2
4
|
module Smartcloud
|
3
5
|
class Machine < Smartcloud::Base
|
@@ -59,5 +61,26 @@ module Smartcloud
|
|
59
61
|
# sudo fail2ban-client reload
|
60
62
|
# sudo fail2ban-client status
|
61
63
|
end
|
64
|
+
|
65
|
+
# def create(name)
|
66
|
+
# FileUtils.mkdir_p name
|
67
|
+
# FileUtils.cp_r "#{Smartcloud.config.root_path}/lib/smartcloud/templates/machine/.", "#{name}"
|
68
|
+
# puts "Please fill details in your config folder before proceeding."
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# def run(*args)
|
72
|
+
# end
|
73
|
+
#
|
74
|
+
# def install_docker
|
75
|
+
# end
|
76
|
+
#
|
77
|
+
# def uninstall_docker
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# def install_engine
|
81
|
+
# end
|
82
|
+
#
|
83
|
+
# def uninstall_engine
|
84
|
+
# end
|
62
85
|
end
|
63
86
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.203
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timeboard
|
@@ -9,7 +9,21 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-09-04 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: net-ssh
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.2'
|
13
27
|
description: Smartcloud is a full-stack deployment framework for rails optimized for
|
14
28
|
programmer happiness and peaceful administration. It encourages natural simplicity
|
15
29
|
by favoring convention over configuration.
|
@@ -30,6 +44,7 @@ files:
|
|
30
44
|
- lib/smartcloud/base.rb
|
31
45
|
- lib/smartcloud/boot.rb
|
32
46
|
- lib/smartcloud/docker.rb
|
47
|
+
- lib/smartcloud/engine.rb
|
33
48
|
- lib/smartcloud/engine/Dockerfile
|
34
49
|
- lib/smartcloud/grids/buildpacker.rb
|
35
50
|
- lib/smartcloud/grids/grid-buildpacker/.keep
|
@@ -224,6 +239,7 @@ files:
|
|
224
239
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-solr/data/lib/.keep
|
225
240
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-solr/data/solr.xml
|
226
241
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-solr/data/zoo.cfg
|
242
|
+
- lib/smartcloud/templates/machine/config/machine.yml
|
227
243
|
- lib/smartcloud/user.rb
|
228
244
|
homepage: https://github.com/timeboardme/smartcloud
|
229
245
|
licenses:
|