smartcloud 0.3.0 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85369e5e6c9d09e3120c224b6032b3498bd4d7f9fa896245b2f65f601f9c6c88
4
- data.tar.gz: cde8d32810801ed981f0359dcc82b2fb837cdd10c79c9524c9db248f9fe6379e
3
+ metadata.gz: 6229856d16664640cc0e9aa6d23906ee651ee4442637bfa5d7fed9db164f19c4
4
+ data.tar.gz: 2c81206bb6480c39388fc6cd70280ea713f38e8d6286d4c8ab5ad044aa2e47c5
5
5
  SHA512:
6
- metadata.gz: f972998785f3eb1931992ae1512e1510f363151fee1c3a328fc422a15a5351bdd1d120f149ee43636dadafcdbdde33f8f906fb1c88db045b6b1c4530bb1c4ed6
7
- data.tar.gz: d87aa2dec7bb4620bf5ecc9329afe1b53335da305b21e4b0035b81d65fec755243583bde24184cdfeaca560ad7b95ad943aa1fa22f3e1dfbeb2d4296e1f29208
6
+ metadata.gz: 37eb0ba70543cb03e188c59147b7fd1244e5128cd9fd41f1c90eede73faca48f1730031ff27b97bdace860c1da18ff09b617d549525b8275fca00c874e725c78
7
+ data.tar.gz: 1df40b71466061ab2dd74ab93721168c93ce54f6da75af7f6ddf97fbffe65bb88814960ad96ed59d8a9d6dae9c26a1f090341358290c01bdb42d6f3b520e3938
@@ -35,10 +35,12 @@ module Smartcloud
35
35
  FileUtils.mkdir_p("#{container_path}/app/public/assets")
36
36
  FileUtils.mkdir_p("#{container_path}/app/public/packs")
37
37
  FileUtils.mkdir_p("#{container_path}/app/node_modules")
38
+ FileUtils.mkdir_p("#{container_path}/app/storage")
38
39
  FileUtils.mkdir_p("#{container_path_with_version}/vendor/bundle")
39
40
  FileUtils.mkdir_p("#{container_path_with_version}/public/assets")
40
41
  FileUtils.mkdir_p("#{container_path_with_version}/public/packs")
41
42
  FileUtils.mkdir_p("#{container_path_with_version}/node_modules")
43
+ FileUtils.mkdir_p("#{container_path_with_version}/storage")
42
44
 
43
45
  # Creating & Starting container
44
46
  container_id = `docker ps -a -q --filter='name=^#{appname}_1$' --filter='status=running'`.chomp
@@ -58,13 +60,15 @@ module Smartcloud
58
60
  --volume='#{container_path}/app/public/assets:/app/public/assets' \
59
61
  --volume='#{container_path}/app/public/packs:/app/public/packs' \
60
62
  --volume='#{container_path}/app/node_modules:/app/node_modules' \
63
+ --volume='#{container_path}/app/storage:/app/storage' \
61
64
  --restart='always' \
62
65
  --init \
63
66
  --network='nginx-network' \
64
67
  smartcloud/buildpacks/rails", out: File::NULL)
65
68
 
66
- system("docker network connect mysql-network #{new_container}")
67
69
  system("docker network connect elasticsearch-network #{new_container}")
70
+ system("docker network connect minio-network #{new_container}")
71
+ system("docker network connect mysql-network #{new_container}")
68
72
 
69
73
  if system("docker start --attach #{new_container}")
70
74
  logger.debug "Starting Web Server ..."
@@ -118,7 +122,7 @@ module Smartcloud
118
122
 
119
123
  # Fix for mysql2 gem to support sha256_password, until it is fixed in main mysql2 gem.
120
124
  # https://github.com/brianmario/mysql2/issues/1023
121
- exit_status = system("mkdir ./lib/mariadb && ln -s /usr/lib/mariadb/plugin ./lib/mariadb/plugin")
125
+ exit_status = system("mkdir -p ./lib/mariadb && ln -s /usr/lib/mariadb/plugin ./lib/mariadb/plugin")
122
126
 
123
127
  if exit_status
124
128
  return true
@@ -133,8 +137,14 @@ module Smartcloud
133
137
  logger.info "Performing bundle install ..."
134
138
 
135
139
  set_logger_formatter_tabs
140
+
141
+ unless system("bundle config set deployment 'true' && bundle config set clean 'true'")
142
+ logger.error "Could not complete bundle config setting."
143
+ return false
144
+ end
145
+
136
146
  exit_status = nil
137
- Open3.popen2e("bundle", "install", "--deployment", "--clean") do |stdin, stdout_and_stderr, wait_thr|
147
+ Open3.popen2e("bundle", "install") do |stdin, stdout_and_stderr, wait_thr|
138
148
  stdout_and_stderr.each { |line| logger.info "#{line}" }
139
149
  exit_status = wait_thr.value.success?
140
150
  end
@@ -18,6 +18,7 @@ require 'smartcloud/buildpacker'
18
18
  require 'smartcloud/user'
19
19
 
20
20
  require 'smartcloud/grids/elasticsearch'
21
+ require 'smartcloud/grids/minio'
21
22
  require 'smartcloud/grids/mysql'
22
23
  require 'smartcloud/grids/nginx'
23
24
  require 'smartcloud/grids/prereceiver'
@@ -58,12 +58,19 @@ 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(4)}_production
73
+ database_name: #{SecureRandom.hex(8)}
67
74
 
68
75
  elasticsearch:
69
76
  port: 9200
@@ -76,7 +83,7 @@ module Smartcloud
76
83
  database_port: 3306
77
84
  database_username: #{SecureRandom.hex(8)}_redmine
78
85
  database_password: #{SecureRandom.hex(16)}
79
- database_name: #{SecureRandom.hex(4)}_redmine_production
86
+ database_name: #{SecureRandom.hex(8)}_redmine
80
87
  # plugins_migrate: true
81
88
  YAML
82
89
  end
@@ -1,4 +1,4 @@
1
- FROM ruby:2.6.4-alpine3.10
1
+ FROM ruby:2.7.0-alpine3.11
2
2
  LABEL maintainer="Timeboard <hello@timeboard.me>"
3
3
 
4
4
  # User
@@ -14,6 +14,6 @@ RUN apk add --update build-base && \
14
14
  rm -rf /var/cache/apk/*
15
15
 
16
16
  # Gems
17
- RUN gem install bundler
17
+ RUN gem install bundler -v 2.1.4
18
18
 
19
19
  CMD ["buildpacker", "pack"]
@@ -10,10 +10,8 @@ module Smartcloud
10
10
 
11
11
  print "-----> Creating settings for elasticsearch ... "
12
12
 
13
- vm_max_map_count_filepath = "~/.smartcloud/grids/grid-elasticsearch/vm_max_map_count"
14
13
  ssh = Smartcloud::SSH.new
15
- ssh.run "sudo sysctl -b vm.max_map_count > #{vm_max_map_count_filepath}"
16
- ssh.run "sudo sysctl -w vm.max_map_count=262144"
14
+ ssh.run "echo 'vm.max_map_count=262144' | sudo tee /etc/sysctl.d/60-smartcloud-elasticsearch.conf && sudo sysctl --system"
17
15
 
18
16
  puts "done"
19
17
  end
@@ -21,10 +19,9 @@ module Smartcloud
21
19
  def uninstall
22
20
  print "-----> Removing settings for elasticsearch ... "
23
21
 
24
- vm_max_map_count_filepath = "~/.smartcloud/grids/grid-elasticsearch/vm_max_map_count"
25
22
  ssh = Smartcloud::SSH.new
26
- ssh.run "test -f #{vm_max_map_count_filepath} && sudo sysctl -w vm.max_map_count=$(cat #{vm_max_map_count_filepath})"
27
- ssh.run "test -f #{vm_max_map_count_filepath} && rm #{vm_max_map_count_filepath}"
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"
28
25
 
29
26
  puts "done"
30
27
  end
@@ -48,12 +45,14 @@ module Smartcloud
48
45
  --name='elasticsearch' \
49
46
  --env discovery.type=single-node \
50
47
  --env cluster.name=elasticsearch-cluster \
51
- --env bootstrap.memory_lock=true \
52
48
  --env 'ES_JAVA_OPTS=-Xms512m -Xmx512m -Des.enforce.bootstrap.checks=true' \
49
+ --env bootstrap.memory_lock=true \
53
50
  --ulimit memlock=-1:-1 \
51
+ --ulimit nofile=65535:65535 \
54
52
  --user `id -u`:`id -g` \
55
53
  #{"--publish='#{Smartcloud.credentials.elasticsearch[:port]}:#{Smartcloud.credentials.elasticsearch[:port]}'" if exposed == '--exposed'} \
56
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' \
57
56
  --restart='always' \
58
57
  --network='elasticsearch-network' \
59
58
  elasticsearch:7.4.1", out: File::NULL)
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
@@ -182,8 +182,11 @@ module Smartcloud
182
182
  'grids',
183
183
 
184
184
  'grids/grid-elasticsearch',
185
- 'grids/grid-elasticsearch/vm_max_map_count',
186
185
  'grids/grid-elasticsearch/data/***',
186
+ 'grids/grid-elasticsearch/logs/***',
187
+
188
+ 'grids/grid-minio',
189
+ 'grids/grid-minio/data/***',
187
190
 
188
191
  'grids/grid-mysql',
189
192
  'grids/grid-mysql/data/***',
@@ -219,6 +222,12 @@ module Smartcloud
219
222
  'grids/grid-elasticsearch',
220
223
  'grids/grid-elasticsearch/data',
221
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',
222
231
 
223
232
  'grids/grid-mysql',
224
233
  'grids/grid-mysql/data',
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Smartcloud
4
- VERSION = "0.3.0".freeze
4
+ VERSION = "0.4.3".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.3.0
4
+ version: 0.4.3
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-01 00:00:00.000000000 Z
11
+ date: 2020-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -87,6 +87,7 @@ files:
87
87
  - lib/smartcloud/engine/buildpacks/rails/Dockerfile
88
88
  - lib/smartcloud/grids/elasticsearch.rb
89
89
  - lib/smartcloud/grids/grid-elasticsearch/.keep
90
+ - lib/smartcloud/grids/grid-minio/.keep
90
91
  - lib/smartcloud/grids/grid-mysql/docker-entrypoint-initdb.d/.keep
91
92
  - lib/smartcloud/grids/grid-nginx/.keep
92
93
  - lib/smartcloud/grids/grid-prereceiver/Dockerfile
@@ -262,6 +263,7 @@ files:
262
263
  - lib/smartcloud/grids/grid-solr/docker-entrypoint-initdb.d/.keep
263
264
  - lib/smartcloud/grids/grid-solr/sunspot/conf/schema.xml
264
265
  - lib/smartcloud/grids/grid-solr/sunspot/conf/solrconfig.xml
266
+ - lib/smartcloud/grids/minio.rb
265
267
  - lib/smartcloud/grids/mysql.rb
266
268
  - lib/smartcloud/grids/nginx.rb
267
269
  - lib/smartcloud/grids/prereceiver.rb
@@ -276,6 +278,8 @@ files:
276
278
  - lib/smartcloud/templates/dotsmartcloud/config/environment.rb
277
279
  - lib/smartcloud/templates/dotsmartcloud/config/users.yml
278
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
279
283
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-mysql/data/.keep
280
284
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/certificates/.keep
281
285
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/fastcgi.conf
@@ -307,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
307
311
  - !ruby/object:Gem::Version
308
312
  version: 1.8.11
309
313
  requirements: []
310
- rubygems_version: 3.0.3
314
+ rubygems_version: 3.1.2
311
315
  signing_key:
312
316
  specification_version: 4
313
317
  summary: Full-stack deployment framework for Rails.