smartcloud 0.0.198 → 0.0.199
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/smartcloud +20 -1
- data/lib/smartcloud/boot.rb +8 -6
- data/lib/smartcloud/engine.rb +38 -0
- data/lib/smartcloud/engine/Dockerfile +5 -6
- data/lib/smartcloud/grids/buildpacker.rb +5 -5
- data/lib/smartcloud/grids/grid-runner/Dockerfile +14 -13
- data/lib/smartcloud/grids/grid-runner/buildpacks/rails/Dockerfile +8 -8
- data/lib/smartcloud/grids/runner.rb +4 -3
- 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: 4eb9601ae182ffa7449229b5f2f55e8906b0fc08124b0d16f06de5b1b422ced4
|
4
|
+
data.tar.gz: a60b68ec73a41fb8ba992b47087890a43556901dcda3187eaa0ab4c9d2091031
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3695721dde058c095120dfdc08358dc34478e0de4d2952011cd446e5a91c4bea8c89f46350f3ff45708bfdbefe7c3040bfb17f71466499231646ec7696841eb
|
7
|
+
data.tar.gz: a01c908ce88720241c3e3b055670a3c71ded477502536ade1828e18c1e4958e5a81815f8d8a08c83cd1deef860d30451876b8ad1a08fc4feeaf104d7e573a157
|
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,5 @@ elsif ARGV[0] == 'grids'
|
|
51
69
|
# elsif ARGV[1] == 'destroy'
|
52
70
|
# Smartcloud::User.destroy(ARGV[2], ARGV[3])
|
53
71
|
# end
|
54
|
-
end
|
72
|
+
end
|
73
|
+
puts "Specify a command to execute."
|
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,6 +1,9 @@
|
|
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
|
@@ -13,18 +16,14 @@ RUN sed -i "s/999/99/" /etc/group && \
|
|
13
16
|
adduser --disabled-password --gecos "" --uid $USER_UID $USER_NAME && \
|
14
17
|
addgroup --gid $USER_GID $USER_NAME && adduser $USER_NAME $USER_NAME && \
|
15
18
|
addgroup --gid $DOCKER_GID "docker" && adduser $USER_NAME docker
|
19
|
+
|
16
20
|
USER "$USER_NAME"
|
17
21
|
WORKDIR "/home/$USER_NAME/.smartcloud"
|
18
22
|
|
19
23
|
# Generating entrypoint file
|
20
24
|
RUN echo -e '#!/bin/sh\n\
|
21
25
|
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/*
|
26
|
+
exec smartcloud "$@"' >> "/home/$(whoami)/entrypoint"; chmod +x "/home/$(whoami)/entrypoint"
|
26
27
|
|
27
28
|
# Set entrypoint
|
28
29
|
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,18 +1,6 @@
|
|
1
1
|
FROM ruby:2.6.4-alpine3.10
|
2
2
|
MAINTAINER Timeboard <hello@timeboard.me>
|
3
3
|
|
4
|
-
# Setting up group and user
|
5
|
-
# - envs
|
6
|
-
ARG DOCKER_GID
|
7
|
-
ARG USER_UID
|
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
4
|
# We need the following:
|
17
5
|
# - fcgiwrap, because that is how nginx does CGI
|
18
6
|
# ----- IMPORTANT NOTE: This is custom build fcgiwrap package to account for NO_BUFFERING option.
|
@@ -32,12 +20,25 @@ RUN apk add --update coreutils && \
|
|
32
20
|
apk add --update spawn-fcgi && \
|
33
21
|
rm -rf /var/cache/apk/*
|
34
22
|
|
23
|
+
# Setting up group and user
|
24
|
+
# - envs
|
25
|
+
ARG USER_NAME
|
26
|
+
ARG USER_UID
|
27
|
+
ARG USER_GID
|
28
|
+
ARG DOCKER_GID
|
29
|
+
# - fix to change gid of 999 to 99 so that addgroup is free to create a group with 999 as gid
|
30
|
+
# - Create group & user. Then add user to group
|
31
|
+
RUN sed -i "s/999/99/" /etc/group && \
|
32
|
+
adduser --disabled-password --gecos "" --uid $USER_UID $USER_NAME && \
|
33
|
+
addgroup --gid $USER_GID $USER_NAME && adduser $USER_NAME $USER_NAME && \
|
34
|
+
addgroup --gid $DOCKER_GID "docker" && adduser $USER_NAME docker
|
35
|
+
|
35
36
|
USER "$USER_NAME"
|
36
37
|
WORKDIR "/home/$USER_NAME/.smartcloud/grids/grid-runner/apps"
|
37
38
|
|
38
39
|
# Generating entrypoint file
|
39
40
|
RUN echo -e '#!/bin/sh\n\
|
40
|
-
gem install --no-document
|
41
|
+
gem install --no-document smartcloud\n\
|
41
42
|
exec "$@"' >> "/home/$(whoami)/entrypoint"; chmod +x "/home/$(whoami)/entrypoint"
|
42
43
|
|
43
44
|
# Set entrypoint
|
@@ -1,13 +1,6 @@
|
|
1
1
|
FROM ruby:2.6.4-alpine3.10
|
2
2
|
MAINTAINER Timeboard <hello@timeboard.me>
|
3
3
|
|
4
|
-
# Setting up user
|
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
4
|
# Install Ruby on Rails Essentials
|
12
5
|
RUN apk add --update build-base && \
|
13
6
|
apk add --update tzdata && \
|
@@ -20,6 +13,13 @@ RUN apk add --update build-base && \
|
|
20
13
|
apk add --update mupdf-tools && \
|
21
14
|
rm -rf /var/cache/apk/*
|
22
15
|
|
16
|
+
# Setting up user
|
17
|
+
# - envs
|
18
|
+
ARG USER_UID
|
19
|
+
ARG USER_NAME
|
20
|
+
# - Create user.
|
21
|
+
RUN adduser --disabled-password --gecos "" --uid "$USER_UID" "$USER_NAME"
|
22
|
+
|
23
23
|
USER "$USER_NAME"
|
24
24
|
WORKDIR "/app"
|
25
25
|
|
@@ -29,7 +29,7 @@ RUN gem install bundler && \
|
|
29
29
|
|
30
30
|
# Generating entrypoint file
|
31
31
|
RUN echo -e '#!/bin/sh\n\
|
32
|
-
gem install --no-document
|
32
|
+
gem install --no-document smartcloud\n\
|
33
33
|
exec "$@"' >> "/home/$(whoami)/entrypoint"; chmod +x "/home/$(whoami)/entrypoint"
|
34
34
|
|
35
35
|
# Set entrypoint
|
@@ -111,9 +111,10 @@ module Smartcloud
|
|
111
111
|
unless system("docker image inspect smartcloud/runner", [:out, :err] => File::NULL)
|
112
112
|
print "-----> Creating image smartcloud/runner ... "
|
113
113
|
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
114
|
--build-arg USER_NAME=`id -un` \
|
115
|
+
--build-arg USER_UID=`id -u` \
|
116
|
+
--build-arg USER_GID=`id -g` \
|
117
|
+
--build-arg DOCKER_GID=`getent group docker | cut -d: -f3` \
|
117
118
|
#{Smartcloud.config.root_path}/lib/smartcloud/grids/grid-runner")
|
118
119
|
puts "done"
|
119
120
|
end
|
@@ -346,7 +347,7 @@ module Smartcloud
|
|
346
347
|
self.clean_up(container_path)
|
347
348
|
logger.info "Launched Application ... Success."
|
348
349
|
exit 0
|
349
|
-
end
|
350
|
+
end
|
350
351
|
else
|
351
352
|
self.stop_app("#{appname}_new")
|
352
353
|
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.199
|
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:
|