smartcloud 0.2.2 → 0.3.2

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: a3a4b06c6842a024e3757c3c13f4c68e6c89eb8cda63d7c3a4c1a6ef91a5fcd9
4
- data.tar.gz: a662e9487b659b6e5acdead2aa6477c6c9f6de79ae0fefbf7737c2cc22f71f0c
3
+ metadata.gz: 474fdd2356fd60ade2ebb2cad2982ebf66d2d045ae19559e13d7cc244b43657a
4
+ data.tar.gz: 17f10d83a70e04d06ba32205bbe3878da6eec8b106898c385fdc36bf00b0e24a
5
5
  SHA512:
6
- metadata.gz: 8e7559e579857751c931e9f3fd7918748eaf92fface204a9f97701600061462e16b76c52c4fe04a91cf7bbd0b824f447d55fc900d11f3864da4583fcb369d494
7
- data.tar.gz: 671f84d2d73034bae9cea1195ddd847d26cf978fa1065e0ad721fbe478aee8f8889af21fc855ef9b414bc61f771be341f3e9e7285f5d70027f0d658721dc8bf0
6
+ metadata.gz: 2f27dfd480192c5eac77388da0c8e94487a7266b7b4596ad9b1883cf98a14932b8d4b096f9b10a7512788b002254231f7614099a61ced315075e360830f31dd3
7
+ data.tar.gz: 612b0aa19cce9b011b720c994917b6977507ed6e46861d3a007c43247a4d922379b331453684bbd070dc41d753b051104073922395aa4ebb9205c5e9de6c11cd
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # SmartCloud
2
+ Git push should deploy.
3
+
2
4
  Smartcloud is a full-stack deployment framework for Rails optimized for programmer happiness and peaceful administration. It encourages natural simplicity by favoring convention over configuration.
3
5
 
4
6
  Deploy your Rails apps to your own server with - git push production master
@@ -63,8 +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}")
67
66
  system("docker network connect mysql-network #{new_container}")
67
+ system("docker network connect elasticsearch-network #{new_container}")
68
68
 
69
69
  if system("docker start --attach #{new_container}")
70
70
  logger.debug "Starting Web Server ..."
@@ -17,6 +17,7 @@ require 'smartcloud/buildpacker'
17
17
 
18
18
  require 'smartcloud/user'
19
19
 
20
+ require 'smartcloud/grids/elasticsearch'
20
21
  require 'smartcloud/grids/mysql'
21
22
  require 'smartcloud/grids/nginx'
22
23
  require 'smartcloud/grids/prereceiver'
@@ -65,6 +65,9 @@ module Smartcloud
65
65
  password: #{SecureRandom.hex(16)}
66
66
  database_name: #{SecureRandom.hex(4)}_production
67
67
 
68
+ elasticsearch:
69
+ port: 9200
70
+
68
71
  redmine:
69
72
  admin_username: admin
70
73
  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
@@ -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
@@ -22,6 +22,7 @@ module Smartcloud
22
22
  --env REDMINE_DB_PASSWORD=#{Smartcloud.credentials.redmine[:database_password]} \
23
23
  --env REDMINE_DB_DATABASE=#{Smartcloud.credentials.redmine[:database_name]} \
24
24
  --env REDMINE_PLUGINS_MIGRATE=#{Smartcloud.credentials.redmine[:plugins_migrate]} \
25
+ --volume='#{Smartcloud.config.user_home_path}/.smartcloud/apps/repositories:/repositories:ro' \
25
26
  --volume='#{Smartcloud.config.user_home_path}/.smartcloud/grids/grid-redmine/files:/usr/src/redmine/files' \
26
27
  --restart='always' \
27
28
  --network='nginx-network' \
@@ -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,10 @@ module Smartcloud
175
181
 
176
182
  'grids',
177
183
 
184
+ 'grids/grid-elasticsearch',
185
+ 'grids/grid-elasticsearch/data/***',
186
+ 'grids/grid-elasticsearch/logs/***',
187
+
178
188
  'grids/grid-mysql',
179
189
  'grids/grid-mysql/data/***',
180
190
 
@@ -206,6 +216,12 @@ module Smartcloud
206
216
 
207
217
  'grids',
208
218
 
219
+ 'grids/grid-elasticsearch',
220
+ 'grids/grid-elasticsearch/data',
221
+ 'grids/grid-elasticsearch/data/.keep',
222
+ 'grids/grid-elasticsearch/logs',
223
+ 'grids/grid-elasticsearch/logs/.keep',
224
+
209
225
  'grids/grid-mysql',
210
226
  'grids/grid-mysql/data',
211
227
  '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.2".freeze
4
+ VERSION = "0.3.2".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.2
4
+ version: 0.3.2
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-25 00:00:00.000000000 Z
11
+ date: 2019-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -85,6 +85,8 @@ 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
88
90
  - lib/smartcloud/grids/grid-mysql/docker-entrypoint-initdb.d/.keep
89
91
  - lib/smartcloud/grids/grid-nginx/.keep
90
92
  - lib/smartcloud/grids/grid-prereceiver/Dockerfile
@@ -273,6 +275,8 @@ files:
273
275
  - lib/smartcloud/templates/dotsmartcloud/bin/smartcloud.sh
274
276
  - lib/smartcloud/templates/dotsmartcloud/config/environment.rb
275
277
  - lib/smartcloud/templates/dotsmartcloud/config/users.yml
278
+ - lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/data/.keep
279
+ - lib/smartcloud/templates/dotsmartcloud/grids/grid-elasticsearch/logs/.keep
276
280
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-mysql/data/.keep
277
281
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/certificates/.keep
278
282
  - lib/smartcloud/templates/dotsmartcloud/grids/grid-nginx/fastcgi.conf