smartcloud 0.3.2 → 0.5.0

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: 474fdd2356fd60ade2ebb2cad2982ebf66d2d045ae19559e13d7cc244b43657a
4
- data.tar.gz: 17f10d83a70e04d06ba32205bbe3878da6eec8b106898c385fdc36bf00b0e24a
3
+ metadata.gz: 68cc89738e48e399cd83ff545c8a0790fb788d405e10b39b89884386525e17ff
4
+ data.tar.gz: add2311595fe17d489c2f5e0dc6142e7a4b99a0c3d90a9910d6be3b8edc7b311
5
5
  SHA512:
6
- metadata.gz: 2f27dfd480192c5eac77388da0c8e94487a7266b7b4596ad9b1883cf98a14932b8d4b096f9b10a7512788b002254231f7614099a61ced315075e360830f31dd3
7
- data.tar.gz: 612b0aa19cce9b011b720c994917b6977507ed6e46861d3a007c43247a4d922379b331453684bbd070dc41d753b051104073922395aa4ebb9205c5e9de6c11cd
6
+ metadata.gz: 4921eb04bbb27f4672254bce33aada08c89b92b28df3aa805c8ddc562ad9f679dbce2e94d085bed3938bb021fa5ffe8778d0f0fbbb3dd3f2959926212bdabc77
7
+ data.tar.gz: 38caf894d976ce9944dff72a69a40a971d9cb62232f90404ee4ade9e897f6f89bb08328a371a098bc72e42c5233b35dc03911bb93b1aecf680db9eec4bdd7504
@@ -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,7 +18,9 @@ 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'
23
+ require 'smartcloud/grids/nextcloud'
22
24
  require 'smartcloud/grids/nginx'
23
25
  require 'smartcloud/grids/prereceiver'
24
26
  require 'smartcloud/grids/redmine'
@@ -58,12 +58,28 @@ 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)}
74
+
75
+ nextcloud:
76
+ admin_username: #{SecureRandom.hex(8)}
77
+ admin_password: #{SecureRandom.hex(16)}
78
+ database_host: mysql
79
+ database_port: 3306
80
+ database_username: #{SecureRandom.hex(8)}_nextcloud
81
+ database_password: #{SecureRandom.hex(16)}
82
+ database_name: #{SecureRandom.hex(8)}_nextcloud
67
83
 
68
84
  elasticsearch:
69
85
  port: 9200
@@ -76,7 +92,7 @@ module Smartcloud
76
92
  database_port: 3306
77
93
  database_username: #{SecureRandom.hex(8)}_redmine
78
94
  database_password: #{SecureRandom.hex(16)}
79
- database_name: #{SecureRandom.hex(4)}_redmine_production
95
+ database_name: #{SecureRandom.hex(8)}_redmine
80
96
  # plugins_migrate: true
81
97
  YAML
82
98
  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"]
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
@@ -0,0 +1,56 @@
1
+ # The main Smartcloud Grids Minio driver
2
+ module Smartcloud
3
+ module Grids
4
+ class Nextcloud < Smartcloud::Base
5
+ def initialize
6
+ end
7
+
8
+ def self.up
9
+ if Smartcloud::Docker.running?
10
+ # Creating & Starting containers
11
+ print "-----> Creating container nextcloud ... "
12
+ if system("docker create \
13
+ --name='nextcloud' \
14
+ --env VIRTUAL_HOST=nextcloud.#{Smartcloud.config.apps_domain} \
15
+ --env LETSENCRYPT_HOST=nextcloud.#{Smartcloud.config.apps_domain} \
16
+ --env LETSENCRYPT_EMAIL=#{Smartcloud.config.sysadmin_email} \
17
+ --env LETSENCRYPT_TEST=false \
18
+ --env NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.#{Smartcloud.config.apps_domain} \
19
+ --env NEXTCLOUD_ADMIN_USER=#{Smartcloud.credentials.nextcloud[:admin_username]} \
20
+ --env NEXTCLOUD_ADMIN_PASSWORD=#{Smartcloud.credentials.nextcloud[:admin_password]} \
21
+ --env MYSQL_HOST=#{Smartcloud.credentials.nextcloud[:database_host]}:#{Smartcloud.credentials.nextcloud[:database_port]} \
22
+ --env MYSQL_USER=#{Smartcloud.credentials.nextcloud[:database_username]} \
23
+ --env MYSQL_PASSWORD=#{Smartcloud.credentials.nextcloud[:database_password]} \
24
+ --env MYSQL_DATABASE=#{Smartcloud.credentials.nextcloud[:database_name]} \
25
+ --volume='#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-nextcloud/html:/var/www/html' \
26
+ --restart='always' \
27
+ --network='nginx-network' \
28
+ nextcloud:18.0.2-apache", out: File::NULL)
29
+
30
+ system("docker network connect mysql-network nextcloud")
31
+
32
+ puts "done"
33
+ print "-----> Starting container nextcloud ... "
34
+ if system("docker start nextcloud", out: File::NULL)
35
+ puts "done"
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ def self.down
42
+ if Smartcloud::Docker.running?
43
+ # Stopping & Removing containers - in reverse order
44
+ print "-----> Stopping container nextcloud ... "
45
+ if system("docker stop 'nextcloud'", out: File::NULL)
46
+ puts "done"
47
+ print "-----> Removing container nextcloud ... "
48
+ if system("docker rm 'nextcloud'", out: File::NULL)
49
+ puts "done"
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -185,9 +185,15 @@ module Smartcloud
185
185
  'grids/grid-elasticsearch/data/***',
186
186
  'grids/grid-elasticsearch/logs/***',
187
187
 
188
+ 'grids/grid-minio',
189
+ 'grids/grid-minio/data/***',
190
+
188
191
  'grids/grid-mysql',
189
192
  'grids/grid-mysql/data/***',
190
193
 
194
+ 'grids/grid-nextcloud',
195
+ 'grids/grid-nextcloud/html/***',
196
+
191
197
  'grids/grid-nginx',
192
198
  'grids/grid-nginx/certificates/***',
193
199
 
@@ -222,10 +228,18 @@ module Smartcloud
222
228
  'grids/grid-elasticsearch/logs',
223
229
  'grids/grid-elasticsearch/logs/.keep',
224
230
 
231
+ 'grids/grid-minio',
232
+ 'grids/grid-minio/data',
233
+ 'grids/grid-minio/data/.keep',
234
+
225
235
  'grids/grid-mysql',
226
236
  'grids/grid-mysql/data',
227
237
  'grids/grid-mysql/data/.keep',
228
238
 
239
+ 'grids/grid-nextcloud',
240
+ 'grids/grid-nextcloud/html',
241
+ 'grids/grid-nextcloud/html/.keep',
242
+
229
243
  'grids/grid-nginx',
230
244
  'grids/grid-nginx/certificates',
231
245
  'grids/grid-nginx/certificates/.keep',
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Smartcloud
4
- VERSION = "0.3.2".freeze
4
+ VERSION = "0.5.0".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.2
4
+ version: 0.5.0
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-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -87,7 +87,9 @@ 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
92
+ - lib/smartcloud/grids/grid-nextcloud/.keep
91
93
  - lib/smartcloud/grids/grid-nginx/.keep
92
94
  - lib/smartcloud/grids/grid-prereceiver/Dockerfile
93
95
  - lib/smartcloud/grids/grid-prereceiver/fcgiwrap/APKBUILD
@@ -262,7 +264,9 @@ files:
262
264
  - lib/smartcloud/grids/grid-solr/docker-entrypoint-initdb.d/.keep
263
265
  - lib/smartcloud/grids/grid-solr/sunspot/conf/schema.xml
264
266
  - lib/smartcloud/grids/grid-solr/sunspot/conf/solrconfig.xml
267
+ - lib/smartcloud/grids/minio.rb
265
268
  - lib/smartcloud/grids/mysql.rb
269
+ - lib/smartcloud/grids/nextcloud.rb
266
270
  - lib/smartcloud/grids/nginx.rb
267
271
  - lib/smartcloud/grids/prereceiver.rb
268
272
  - lib/smartcloud/grids/redmine.rb
@@ -277,7 +281,9 @@ files:
277
281
  - lib/smartcloud/templates/dotsmartcloud/config/users.yml
278
282
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/data/.keep
279
283
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/logs/.keep
284
+ - lib/smartcloud/templates/dotsmartcloud/grids/grid-minio/data/.keep
280
285
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-mysql/data/.keep
286
+ - lib/smartcloud/templates/dotsmartcloud/grids/grid-nextcloud/html/.keep
281
287
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/certificates/.keep
282
288
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/fastcgi.conf
283
289
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/htpasswd/.keep
@@ -308,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
314
  - !ruby/object:Gem::Version
309
315
  version: 1.8.11
310
316
  requirements: []
311
- rubygems_version: 3.0.3
317
+ rubygems_version: 3.1.2
312
318
  signing_key:
313
319
  specification_version: 4
314
320
  summary: Full-stack deployment framework for Rails.