smartcloud 0.2.4 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smartcloud/apps/rails.rb +3 -2
- data/lib/smartcloud/boot.rb +2 -0
- data/lib/smartcloud/credentials.rb +12 -2
- data/lib/smartcloud/grids/elasticsearch.rb +90 -0
- data/lib/smartcloud/grids/grid-elasticsearch/.keep +0 -0
- data/lib/smartcloud/grids/grid-minio/.keep +0 -0
- data/lib/smartcloud/grids/minio.rb +71 -0
- data/lib/smartcloud/machine.rb +23 -0
- data/lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/data/.keep +0 -0
- data/lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/logs/.keep +0 -0
- data/lib/smartcloud/templates/dotsmartcloud/grids/grid-minio/data/.keep +0 -0
- data/lib/smartcloud/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec440d4ec540e783e7f8af0e3c652421c200b856220f884cae1716fe8c1f90c2
|
4
|
+
data.tar.gz: 49e62cd6528a6e6187ed229f278715f5a757889cb39f32839c9cf36de52c1517
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b4e59bba167cf3e516aaef9ed4978cca24f9c215ab47edf24560a2d7fdb1b8253ed978c8badeba30ee245d3c6cfaeca642e698b7126290886c86d530b0dd2f9
|
7
|
+
data.tar.gz: 898e3cd32b789be48255ac4acad80fcdceb6c3226cad971f59feb62636b7f39b8c1139e322c82f178f35bb9e265f8619ce7025322afad29ae3140e36deb6f9b6
|
@@ -63,7 +63,8 @@ module Smartcloud
|
|
63
63
|
--network='nginx-network' \
|
64
64
|
smartcloud/buildpacks/rails", out: File::NULL)
|
65
65
|
|
66
|
-
|
66
|
+
system("docker network connect elasticsearch-network #{new_container}")
|
67
|
+
system("docker network connect minio-network #{new_container}")
|
67
68
|
system("docker network connect mysql-network #{new_container}")
|
68
69
|
|
69
70
|
if system("docker start --attach #{new_container}")
|
@@ -118,7 +119,7 @@ module Smartcloud
|
|
118
119
|
|
119
120
|
# Fix for mysql2 gem to support sha256_password, until it is fixed in main mysql2 gem.
|
120
121
|
# https://github.com/brianmario/mysql2/issues/1023
|
121
|
-
exit_status = system("mkdir ./lib/mariadb && ln -s /usr/lib/mariadb/plugin ./lib/mariadb/plugin")
|
122
|
+
exit_status = system("mkdir -p ./lib/mariadb && ln -s /usr/lib/mariadb/plugin ./lib/mariadb/plugin")
|
122
123
|
|
123
124
|
if exit_status
|
124
125
|
return true
|
data/lib/smartcloud/boot.rb
CHANGED
@@ -17,6 +17,8 @@ require 'smartcloud/buildpacker'
|
|
17
17
|
|
18
18
|
require 'smartcloud/user'
|
19
19
|
|
20
|
+
require 'smartcloud/grids/elasticsearch'
|
21
|
+
require 'smartcloud/grids/minio'
|
20
22
|
require 'smartcloud/grids/mysql'
|
21
23
|
require 'smartcloud/grids/nginx'
|
22
24
|
require 'smartcloud/grids/prereceiver'
|
@@ -58,12 +58,22 @@ module Smartcloud
|
|
58
58
|
username: #{SecureRandom.hex(8)}
|
59
59
|
password: #{SecureRandom.hex(16)}
|
60
60
|
|
61
|
+
minio:
|
62
|
+
hostname: #{SecureRandom.hex(8)}
|
63
|
+
access_key: #{SecureRandom.hex(8)}
|
64
|
+
secret_key: #{SecureRandom.hex(16)}
|
65
|
+
browser: on
|
66
|
+
worm: off
|
67
|
+
|
61
68
|
mysql:
|
62
69
|
port: 3306
|
63
70
|
root_password: #{SecureRandom.hex(16)}
|
64
71
|
username: #{SecureRandom.hex(8)}
|
65
72
|
password: #{SecureRandom.hex(16)}
|
66
|
-
database_name: #{SecureRandom.hex(
|
73
|
+
database_name: #{SecureRandom.hex(8)}
|
74
|
+
|
75
|
+
elasticsearch:
|
76
|
+
port: 9200
|
67
77
|
|
68
78
|
redmine:
|
69
79
|
admin_username: admin
|
@@ -73,7 +83,7 @@ module Smartcloud
|
|
73
83
|
database_port: 3306
|
74
84
|
database_username: #{SecureRandom.hex(8)}_redmine
|
75
85
|
database_password: #{SecureRandom.hex(16)}
|
76
|
-
database_name: #{SecureRandom.hex(
|
86
|
+
database_name: #{SecureRandom.hex(8)}_redmine
|
77
87
|
# plugins_migrate: true
|
78
88
|
YAML
|
79
89
|
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# The main Smartcloud Grids Elasticsearch driver
|
2
|
+
module Smartcloud
|
3
|
+
module Grids
|
4
|
+
class Elasticsearch < Smartcloud::Base
|
5
|
+
def initialize
|
6
|
+
end
|
7
|
+
|
8
|
+
def install
|
9
|
+
self.uninstall
|
10
|
+
|
11
|
+
print "-----> Creating settings for elasticsearch ... "
|
12
|
+
|
13
|
+
ssh = Smartcloud::SSH.new
|
14
|
+
ssh.run "echo 'vm.max_map_count=262144' | sudo tee /etc/sysctl.d/60-smartcloud-elasticsearch.conf && sudo sysctl --system"
|
15
|
+
|
16
|
+
puts "done"
|
17
|
+
end
|
18
|
+
|
19
|
+
def uninstall
|
20
|
+
print "-----> Removing settings for elasticsearch ... "
|
21
|
+
|
22
|
+
ssh = Smartcloud::SSH.new
|
23
|
+
# NOTE: sysctl does not reset this setting until restart of system even after sudo sysctl --system is run.
|
24
|
+
ssh.run "test -f /etc/sysctl.d/60-smartcloud-elasticsearch.conf && sudo rm /etc/sysctl.d/60-smartcloud-elasticsearch.conf && sudo sysctl --system"
|
25
|
+
|
26
|
+
puts "done"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.up(*args)
|
30
|
+
args.flatten!
|
31
|
+
exposed = args.empty? ? '' : args.shift
|
32
|
+
|
33
|
+
if Smartcloud::Docker.running?
|
34
|
+
# Creating networks
|
35
|
+
unless system("docker network inspect elasticsearch-network", [:out, :err] => File::NULL)
|
36
|
+
print "-----> Creating network elasticsearch-network ... "
|
37
|
+
if system("docker network create elasticsearch-network", out: File::NULL)
|
38
|
+
puts "done"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Creating & Starting containers
|
43
|
+
print "-----> Creating container elasticsearch ... "
|
44
|
+
if system("docker create \
|
45
|
+
--name='elasticsearch' \
|
46
|
+
--env discovery.type=single-node \
|
47
|
+
--env cluster.name=elasticsearch-cluster \
|
48
|
+
--env 'ES_JAVA_OPTS=-Xms512m -Xmx512m -Des.enforce.bootstrap.checks=true' \
|
49
|
+
--env bootstrap.memory_lock=true \
|
50
|
+
--ulimit memlock=-1:-1 \
|
51
|
+
--ulimit nofile=65535:65535 \
|
52
|
+
--user `id -u`:`id -g` \
|
53
|
+
#{"--publish='#{Smartcloud.credentials.elasticsearch[:port]}:#{Smartcloud.credentials.elasticsearch[:port]}'" if exposed == '--exposed'} \
|
54
|
+
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-elasticsearch/data:/usr/share/elasticsearch/data' \
|
55
|
+
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-elasticsearch/logs:/usr/share/elasticsearch/logs' \
|
56
|
+
--restart='always' \
|
57
|
+
--network='elasticsearch-network' \
|
58
|
+
elasticsearch:7.4.1", out: File::NULL)
|
59
|
+
|
60
|
+
puts "done"
|
61
|
+
print "-----> Starting container elasticsearch ... "
|
62
|
+
if system("docker start elasticsearch", out: File::NULL)
|
63
|
+
puts "done"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.down
|
70
|
+
if Smartcloud::Docker.running?
|
71
|
+
# Stopping & Removing containers - in reverse order
|
72
|
+
print "-----> Stopping container elasticsearch ... "
|
73
|
+
if system("docker stop 'elasticsearch'", out: File::NULL)
|
74
|
+
puts "done"
|
75
|
+
print "-----> Removing container elasticsearch ... "
|
76
|
+
if system("docker rm 'elasticsearch'", out: File::NULL)
|
77
|
+
puts "done"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Removing networks
|
82
|
+
print "-----> Removing network elasticsearch-network ... "
|
83
|
+
if system("docker network rm elasticsearch-network", out: File::NULL)
|
84
|
+
puts "done"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# The main Smartcloud Grids Minio driver
|
2
|
+
module Smartcloud
|
3
|
+
module Grids
|
4
|
+
class Minio < Smartcloud::Base
|
5
|
+
def initialize
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.up(*args)
|
9
|
+
args.flatten!
|
10
|
+
exposed = args.empty? ? '' : args.shift
|
11
|
+
|
12
|
+
if Smartcloud::Docker.running?
|
13
|
+
# Creating networks
|
14
|
+
unless system("docker network inspect minio-network", [:out, :err] => File::NULL)
|
15
|
+
print "-----> Creating network minio-network ... "
|
16
|
+
if system("docker network create minio-network", out: File::NULL)
|
17
|
+
puts "done"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Creating & Starting containers
|
22
|
+
print "-----> Creating container minio ... "
|
23
|
+
if system("docker create \
|
24
|
+
--name='minio' \
|
25
|
+
--env VIRTUAL_HOST=#{Smartcloud.credentials.minio[:hostname]}.#{Smartcloud.config.apps_domain} \
|
26
|
+
--env LETSENCRYPT_HOST=#{Smartcloud.credentials.minio[:hostname]}.#{Smartcloud.config.apps_domain} \
|
27
|
+
--env LETSENCRYPT_EMAIL=#{Smartcloud.config.sysadmin_email} \
|
28
|
+
--env LETSENCRYPT_TEST=false \
|
29
|
+
--env MINIO_ACCESS_KEY=#{Smartcloud.credentials.minio[:access_key]} \
|
30
|
+
--env MINIO_SECRET_KEY=#{Smartcloud.credentials.minio[:secret_key]} \
|
31
|
+
--env MINIO_BROWSER=#{Smartcloud.credentials.minio[:browser]} \
|
32
|
+
--env MINIO_WORM=#{Smartcloud.credentials.minio[:worm]} \
|
33
|
+
--user `id -u`:`id -g` \
|
34
|
+
--volume='#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-minio/data:/data' \
|
35
|
+
--restart='always' \
|
36
|
+
--network='minio-network' \
|
37
|
+
minio/minio:RELEASE.2020-02-27T00-23-05Z server /data", out: File::NULL)
|
38
|
+
|
39
|
+
system("docker network connect nginx-network minio")
|
40
|
+
|
41
|
+
puts "done"
|
42
|
+
print "-----> Starting container minio ... "
|
43
|
+
if system("docker start minio", out: File::NULL)
|
44
|
+
puts "done"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.down
|
51
|
+
if Smartcloud::Docker.running?
|
52
|
+
# Stopping & Removing containers - in reverse order
|
53
|
+
print "-----> Stopping container minio ... "
|
54
|
+
if system("docker stop 'minio'", out: File::NULL)
|
55
|
+
puts "done"
|
56
|
+
print "-----> Removing container minio ... "
|
57
|
+
if system("docker rm 'minio'", out: File::NULL)
|
58
|
+
puts "done"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Removing networks
|
63
|
+
print "-----> Removing network minio-network ... "
|
64
|
+
if system("docker network rm minio-network", out: File::NULL)
|
65
|
+
puts "done"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/smartcloud/machine.rb
CHANGED
@@ -28,9 +28,15 @@ module Smartcloud
|
|
28
28
|
ssh = Smartcloud::SSH.new
|
29
29
|
ssh.run "smartcloud buildpacker install"
|
30
30
|
ssh.run "smartcloud prereceiver install"
|
31
|
+
|
32
|
+
elasticsearch = Smartcloud::Grids::Elasticsearch.new
|
33
|
+
elasticsearch.install
|
31
34
|
end
|
32
35
|
|
33
36
|
def stop
|
37
|
+
elasticsearch = Smartcloud::Grids::Elasticsearch.new
|
38
|
+
elasticsearch.uninstall
|
39
|
+
|
34
40
|
ssh = Smartcloud::SSH.new
|
35
41
|
ssh.run "smartcloud prereceiver uninstall"
|
36
42
|
ssh.run "smartcloud buildpacker uninstall"
|
@@ -175,6 +181,13 @@ module Smartcloud
|
|
175
181
|
|
176
182
|
'grids',
|
177
183
|
|
184
|
+
'grids/grid-elasticsearch',
|
185
|
+
'grids/grid-elasticsearch/data/***',
|
186
|
+
'grids/grid-elasticsearch/logs/***',
|
187
|
+
|
188
|
+
'grids/grid-minio',
|
189
|
+
'grids/grid-minio/data/***',
|
190
|
+
|
178
191
|
'grids/grid-mysql',
|
179
192
|
'grids/grid-mysql/data/***',
|
180
193
|
|
@@ -206,6 +219,16 @@ module Smartcloud
|
|
206
219
|
|
207
220
|
'grids',
|
208
221
|
|
222
|
+
'grids/grid-elasticsearch',
|
223
|
+
'grids/grid-elasticsearch/data',
|
224
|
+
'grids/grid-elasticsearch/data/.keep',
|
225
|
+
'grids/grid-elasticsearch/logs',
|
226
|
+
'grids/grid-elasticsearch/logs/.keep',
|
227
|
+
|
228
|
+
'grids/grid-minio',
|
229
|
+
'grids/grid-minio/data',
|
230
|
+
'grids/grid-minio/data/.keep',
|
231
|
+
|
209
232
|
'grids/grid-mysql',
|
210
233
|
'grids/grid-mysql/data',
|
211
234
|
'grids/grid-mysql/data/.keep',
|
File without changes
|
File without changes
|
File without changes
|
data/lib/smartcloud/version.rb
CHANGED
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.2
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timeboard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -85,6 +85,9 @@ files:
|
|
85
85
|
- lib/smartcloud/engine.rb
|
86
86
|
- lib/smartcloud/engine/Dockerfile
|
87
87
|
- lib/smartcloud/engine/buildpacks/rails/Dockerfile
|
88
|
+
- lib/smartcloud/grids/elasticsearch.rb
|
89
|
+
- lib/smartcloud/grids/grid-elasticsearch/.keep
|
90
|
+
- lib/smartcloud/grids/grid-minio/.keep
|
88
91
|
- lib/smartcloud/grids/grid-mysql/docker-entrypoint-initdb.d/.keep
|
89
92
|
- lib/smartcloud/grids/grid-nginx/.keep
|
90
93
|
- lib/smartcloud/grids/grid-prereceiver/Dockerfile
|
@@ -260,6 +263,7 @@ files:
|
|
260
263
|
- lib/smartcloud/grids/grid-solr/docker-entrypoint-initdb.d/.keep
|
261
264
|
- lib/smartcloud/grids/grid-solr/sunspot/conf/schema.xml
|
262
265
|
- lib/smartcloud/grids/grid-solr/sunspot/conf/solrconfig.xml
|
266
|
+
- lib/smartcloud/grids/minio.rb
|
263
267
|
- lib/smartcloud/grids/mysql.rb
|
264
268
|
- lib/smartcloud/grids/nginx.rb
|
265
269
|
- lib/smartcloud/grids/prereceiver.rb
|
@@ -273,6 +277,9 @@ files:
|
|
273
277
|
- lib/smartcloud/templates/dotsmartcloud/bin/smartcloud.sh
|
274
278
|
- lib/smartcloud/templates/dotsmartcloud/config/environment.rb
|
275
279
|
- lib/smartcloud/templates/dotsmartcloud/config/users.yml
|
280
|
+
- lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/data/.keep
|
281
|
+
- lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/logs/.keep
|
282
|
+
- lib/smartcloud/templates/dotsmartcloud/grids/grid-minio/data/.keep
|
276
283
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-mysql/data/.keep
|
277
284
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/certificates/.keep
|
278
285
|
- lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/fastcgi.conf
|