smartcloud 0.2.3 → 0.4.1

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: fdcdee99df7d2882b59c62eeae3a8248e98f61e4ffb41d717092b2a6b8493a16
4
- data.tar.gz: 8c467e8d8e848ff2c5005fb61f3c97155d28a3e5575c844573e96574b2ab0f7e
3
+ metadata.gz: 771fafc023e8af4228d942f6629a05c1607f8b3bed34c79e79190083ce6b9d7b
4
+ data.tar.gz: a57da3cf4e496b8fea60db3bde5b2a2f2ae1e55f0862659ffaa3208310cb0ac1
5
5
  SHA512:
6
- metadata.gz: e296e2c051b797469c934fff6539e070345da995f132043461e9290339b2607389c525ebaa4f7a8f5e706b7db9b272e33dc085549f77e881b53b13a969dea2cb
7
- data.tar.gz: a3d536431dfd462b9920422aaf0a57d9dc09f0db15497e56f866f7abf4a5ce9bce7f3a8fdf612c7654425c6cf8c06b40154ee4e07eeca2ef7938d6648f87dee7
6
+ metadata.gz: 0a7a46a96df2b9ffecb71f283d160bec26a7fef5153c90d6583310a3b73928e20776ebe45470604e531556d12f6416dc6532963cacb9a06e6acd0ae5cb7edcdf
7
+ data.tar.gz: 140f28602924a10a725612ea8011036dd3fca8b68a9860955492420e9461625883ccc255de0b174fc88f3b2e2847763ce210f0d6f0016b00d0e37ed5c63a9cba
@@ -63,7 +63,8 @@ module Smartcloud
63
63
  --network='nginx-network' \
64
64
  smartcloud/buildpacks/rails", out: File::NULL)
65
65
 
66
- # system("docker network connect solr-network #{new_container}")
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
@@ -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,6 +58,11 @@ module Smartcloud
58
58
  username: #{SecureRandom.hex(8)}
59
59
  password: #{SecureRandom.hex(16)}
60
60
 
61
+ minio:
62
+ port: 9000
63
+ access_key: #{SecureRandom.hex(8)}
64
+ secret_key: #{SecureRandom.hex(16)}
65
+
61
66
  mysql:
62
67
  port: 3306
63
68
  root_password: #{SecureRandom.hex(16)}
@@ -65,6 +70,9 @@ module Smartcloud
65
70
  password: #{SecureRandom.hex(16)}
66
71
  database_name: #{SecureRandom.hex(4)}_production
67
72
 
73
+ elasticsearch:
74
+ port: 9200
75
+
68
76
  redmine:
69
77
  admin_username: admin
70
78
  admin_password: #{SecureRandom.hex(16)}
@@ -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
@@ -0,0 +1,64 @@
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 MINIO_ACCESS_KEY=#{Smartcloud.credentials.minio[:access_key]} \
26
+ --env MINIO_SECRET_KEY=#{Smartcloud.credentials.minio[:secret_key]} \
27
+ --user `id -u`:`id -g` \
28
+ #{"--publish='#{Smartcloud.credentials.minio[:port]}:#{Smartcloud.credentials.minio[:port]}'" if exposed == '--exposed'} \
29
+ --volume='#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-minio/data:/data' \
30
+ --restart='always' \
31
+ --network='minio-network' \
32
+ minio/minio:RELEASE.2020-02-27T00-23-05Z server /data", out: File::NULL)
33
+
34
+ puts "done"
35
+ print "-----> Starting container minio ... "
36
+ if system("docker start minio", out: File::NULL)
37
+ puts "done"
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ def self.down
44
+ if Smartcloud::Docker.running?
45
+ # Stopping & Removing containers - in reverse order
46
+ print "-----> Stopping container minio ... "
47
+ if system("docker stop 'minio'", out: File::NULL)
48
+ puts "done"
49
+ print "-----> Removing container minio ... "
50
+ if system("docker rm 'minio'", out: File::NULL)
51
+ puts "done"
52
+ end
53
+ end
54
+
55
+ # Removing networks
56
+ print "-----> Removing network minio-network ... "
57
+ if system("docker network rm minio-network", out: File::NULL)
58
+ puts "done"
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -122,6 +122,9 @@ module Smartcloud
122
122
  logger.fatal "This version name already exists ... Failed."
123
123
  return
124
124
  end
125
+ else
126
+ # Allow the push to complete for all other branches normally.
127
+ exit 10
125
128
  end
126
129
 
127
130
  logger.formatter = nil
@@ -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',
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Smartcloud
4
- VERSION = "0.2.3".freeze
4
+ VERSION = "0.4.1".freeze
5
5
 
6
6
  def self.version
7
7
  @@version ||= VERSION
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.3
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timeboard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-26 00:00:00.000000000 Z
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