smartcloud 0.3.1 → 0.4.4

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: 241790f96253161b990bfc75ef559b5872849e8f4dec6ccad65cdef173789144
4
- data.tar.gz: 7d6296cd2e0851b53758d2d1971d05903892dbac659b2c9783ce9484a4f28bfc
3
+ metadata.gz: 7b4fd82d9d4bff19e4ccf13550134ee76772adcf128014ffabe60875e186a293
4
+ data.tar.gz: f794d1aa22b50f4448222f37320b00a1301e93054d85942b410d9e2f54287022
5
5
  SHA512:
6
- metadata.gz: add6e6dfaca24de43ec1a45bbf0b3da91651c605e37591cde402629fa5e184f1c6997740ab30dd180e8477a7434d3b7f63b5d0a0edc061143972f66a94f842b5
7
- data.tar.gz: '038a10133f0e716a093b083722635cc52fad448e309e2fb92e837abb6d603508432c1fd4d627d19bdf2b8513f7e3596c383e88453f028f5ddb0ede815a068185'
6
+ metadata.gz: f96218c7bc601ae5a4bfd0ad9d289e432ad6ecef234280c0128a695d910f4ae9c0f42a04f04487b22c668c5346985e7a25416772e88c1e9af4b700716b56423e
7
+ data.tar.gz: daef98755e7880eeb5e9b422bf6659c6c6b0eac058a4d65dea9e4cf07496e4de860432496915f62822ca38bdbb9030edbdda5c79495401ed1ab8a836389256a1
@@ -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
File without changes
@@ -0,0 +1,77 @@
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
+ # The alias is necessary to support internal network requests directed to minio container using public url
40
+ system("docker network connect --alias #{Smartcloud.credentials.minio[:hostname]}.#{Smartcloud.config.apps_domain} minio-network nginx")
41
+ system("docker network connect nginx-network minio")
42
+
43
+ puts "done"
44
+ print "-----> Starting container minio ... "
45
+ if system("docker start minio", out: File::NULL)
46
+ puts "done"
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ def self.down
53
+ if Smartcloud::Docker.running?
54
+ # Disconnecting networks
55
+ system("docker network disconnect nginx-network minio")
56
+ system("docker network disconnect minio-network nginx")
57
+
58
+ # Stopping & Removing containers - in reverse order
59
+ print "-----> Stopping container minio ... "
60
+ if system("docker stop 'minio'", out: File::NULL)
61
+ puts "done"
62
+ print "-----> Removing container minio ... "
63
+ if system("docker rm 'minio'", out: File::NULL)
64
+ puts "done"
65
+ end
66
+ end
67
+
68
+ # Removing networks
69
+ print "-----> Removing network minio-network ... "
70
+ if system("docker network rm minio-network", out: File::NULL)
71
+ puts "done"
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -182,10 +182,12 @@ 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/***',
187
186
  'grids/grid-elasticsearch/logs/***',
188
187
 
188
+ 'grids/grid-minio',
189
+ 'grids/grid-minio/data/***',
190
+
189
191
  'grids/grid-mysql',
190
192
  'grids/grid-mysql/data/***',
191
193
 
@@ -223,6 +225,10 @@ module Smartcloud
223
225
  'grids/grid-elasticsearch/logs',
224
226
  'grids/grid-elasticsearch/logs/.keep',
225
227
 
228
+ 'grids/grid-minio',
229
+ 'grids/grid-minio/data',
230
+ 'grids/grid-minio/data/.keep',
231
+
226
232
  'grids/grid-mysql',
227
233
  'grids/grid-mysql/data',
228
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.3.1".freeze
4
+ VERSION = "0.4.4".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.1
4
+ version: 0.4.4
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-06 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
@@ -277,6 +279,7 @@ files:
277
279
  - lib/smartcloud/templates/dotsmartcloud/config/users.yml
278
280
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/data/.keep
279
281
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/logs/.keep
282
+ - lib/smartcloud/templates/dotsmartcloud/grids/grid-minio/data/.keep
280
283
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-mysql/data/.keep
281
284
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/certificates/.keep
282
285
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/fastcgi.conf
@@ -308,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
311
  - !ruby/object:Gem::Version
309
312
  version: 1.8.11
310
313
  requirements: []
311
- rubygems_version: 3.0.3
314
+ rubygems_version: 3.1.2
312
315
  signing_key:
313
316
  specification_version: 4
314
317
  summary: Full-stack deployment framework for Rails.