pvcglue 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/bin/pvc +2 -2
- data/lib/pvcglue.rb +3 -2
- data/lib/pvcglue/cli.rb +37 -2
- data/lib/pvcglue/cloud.rb +15 -1
- data/lib/pvcglue/cloud_providers.rb +4 -2
- data/lib/pvcglue/cloud_providers/digital_ocean.rb +66 -10
- data/lib/pvcglue/cloud_providers/linode.rb +6 -3
- data/lib/pvcglue/connection.rb +2 -2
- data/lib/pvcglue/custom_hashie.rb +5 -0
- data/lib/pvcglue/docs.rb +4 -1
- data/lib/pvcglue/env.rb +24 -14
- data/lib/pvcglue/manager.rb +4 -6
- data/lib/pvcglue/minion.rb +65 -6
- data/lib/pvcglue/packages.rb +36 -4
- data/lib/pvcglue/packages/apt.rb +4 -0
- data/lib/pvcglue/packages/apt_repos.rb +15 -0
- data/lib/pvcglue/packages/authorized_keys.rb +46 -19
- data/lib/pvcglue/packages/firewall.rb +6 -2
- data/lib/pvcglue/packages/manager.rb +5 -2
- data/lib/pvcglue/packages/postgresql.rb +5 -2
- data/lib/pvcglue/packages/redis.rb +59 -0
- data/lib/pvcglue/packages/rvm.rb +1 -1
- data/lib/pvcglue/packages/secrets.rb +7 -1
- data/lib/pvcglue/packages/sidekiq_workers.rb +89 -0
- data/lib/pvcglue/packages/slack.rb +39 -0
- data/lib/pvcglue/packages/web.rb +2 -1
- data/lib/pvcglue/packages/worker.rb +25 -0
- data/lib/pvcglue/templates/capfile.erb +3 -1
- data/lib/pvcglue/templates/deploy.rb.erb +10 -95
- data/lib/pvcglue/templates/redis.conf.erb +807 -171
- data/lib/pvcglue/templates/sidekiq.service.erb +33 -0
- data/lib/pvcglue/templates/slacktee.erb +7 -0
- data/lib/pvcglue/templates/sshd_config.erb +7 -7
- data/lib/pvcglue/templates/stage-deploy.rb.erb +66 -8
- data/lib/pvcglue/templates/sysctl.conf.erb +62 -0
- data/lib/pvcglue/version.rb +1 -1
- data/pvcglue.gemspec +2 -1
- metadata +25 -12
data/lib/pvcglue/minion.rb
CHANGED
@@ -18,6 +18,7 @@ module Pvcglue
|
|
18
18
|
Pvcglue::Packages::UnattendedUpgrades.apply(minion)
|
19
19
|
Pvcglue::Packages::Users.apply(minion)
|
20
20
|
Pvcglue::Packages::AuthorizedKeys.apply(minion)
|
21
|
+
Pvcglue::Packages::Slack.apply(minion)
|
21
22
|
Pvcglue::Packages::Roles.apply(minion)
|
22
23
|
|
23
24
|
|
@@ -38,9 +39,16 @@ module Pvcglue
|
|
38
39
|
public_ip.present?
|
39
40
|
end
|
40
41
|
|
42
|
+
def get_cloud_provider_options
|
43
|
+
# Merge default and machine options
|
44
|
+
options = machine_options.cloud_provider || ::SafeMash.new
|
45
|
+
options.reverse_merge(default_cloud_provider)
|
46
|
+
end
|
47
|
+
|
41
48
|
def pvc_cloud_provider
|
42
|
-
|
43
|
-
|
49
|
+
options = get_cloud_provider_options
|
50
|
+
# raise("Unknown cloud provider '#{get_cloud_provider_name}'") unless get_cloud_provider_name
|
51
|
+
@pvc_cloud_provider ||= Pvcglue::CloudProviders.init(options)
|
44
52
|
end
|
45
53
|
|
46
54
|
def create!
|
@@ -70,9 +78,6 @@ module Pvcglue
|
|
70
78
|
ssh_keys: ssh_keys,
|
71
79
|
backups: backups,
|
72
80
|
ipv6: false,
|
73
|
-
private_networking: true,
|
74
|
-
user_data: '',
|
75
|
-
monitoring: true,
|
76
81
|
tags: tags,
|
77
82
|
group: group,
|
78
83
|
)
|
@@ -174,7 +179,8 @@ module Pvcglue
|
|
174
179
|
keys += get_github_authorized_keys(user)
|
175
180
|
keys.each do |public_key|
|
176
181
|
line = %Q(environment="PVCGLUE_USER=#{user.name}" #{public_key})
|
177
|
-
# line = %Q(command="export PVCGLUE_USER=#{
|
182
|
+
# line = %Q(command="export PVCGLUE_USER=#{user.name}" #{public_key})
|
183
|
+
# line = %Q(command="path/to/script",environment="LEVEL=1" command="export PVCGLUE_USER=#{user.name}" #{public_key})
|
178
184
|
data << line
|
179
185
|
end
|
180
186
|
end
|
@@ -186,5 +192,58 @@ module Pvcglue
|
|
186
192
|
# self.public_ip = another_minion.public_ip
|
187
193
|
# self.cloud_id = another_minion.cloud_id
|
188
194
|
# end
|
195
|
+
|
196
|
+
def sidekiq_worker_base_name # pvc-sidekiq-project-stage-
|
197
|
+
"pvc-sidekiq-#{remote_user_name}-"
|
198
|
+
end
|
199
|
+
|
200
|
+
def sidekiq_service_file_name(name) # /lib/systemd/system/pvc-sidekiq-project-stage-name.service
|
201
|
+
"#{Pvcglue.cloud.service_directory}#{sidekiq_service_name(name)}#{Pvcglue.cloud.service_extension}"
|
202
|
+
end
|
203
|
+
|
204
|
+
def sidekiq_service_name(name) # pvc-sidekiq-project-stage-name
|
205
|
+
"#{sidekiq_worker_base_name}#{name}"
|
206
|
+
end
|
207
|
+
|
208
|
+
|
209
|
+
def quiet_all_sidekiq_workers_cmd
|
210
|
+
cmd = []
|
211
|
+
return cmd unless stage_options.sidekiq_queues
|
212
|
+
stage_options.sidekiq_queues.each do |name, options|
|
213
|
+
cmd << "sudo systemctl kill -s USR1 --kill-who=main #{sidekiq_service_name(name)}"
|
214
|
+
end
|
215
|
+
cmd
|
216
|
+
end
|
217
|
+
|
218
|
+
def stop_all_sidekiq_workers_cmd
|
219
|
+
cmd = []
|
220
|
+
return cmd unless stage_options.sidekiq_queues
|
221
|
+
stage_options.sidekiq_queues.each do |name, options|
|
222
|
+
cmd << "sudo systemctl stop #{sidekiq_service_name(name)}"
|
223
|
+
end
|
224
|
+
cmd
|
225
|
+
end
|
226
|
+
|
227
|
+
def start_all_sidekiq_workers_cmd
|
228
|
+
cmd = []
|
229
|
+
return cmd unless stage_options.sidekiq_queues
|
230
|
+
stage_options.sidekiq_queues.each do |name, options|
|
231
|
+
cmd << "sudo systemctl start #{sidekiq_service_name(name)}"
|
232
|
+
end
|
233
|
+
cmd
|
234
|
+
end
|
235
|
+
|
236
|
+
def quiet_all_workers_cmd
|
237
|
+
quiet_all_sidekiq_workers_cmd.join('; ')
|
238
|
+
end
|
239
|
+
|
240
|
+
|
241
|
+
def stop_all_workers_cmd
|
242
|
+
stop_all_sidekiq_workers_cmd.join(' && ')
|
243
|
+
end
|
244
|
+
|
245
|
+
def start_all_workers_cmd
|
246
|
+
start_all_sidekiq_workers_cmd.join(' && ')
|
247
|
+
end
|
189
248
|
end
|
190
249
|
end
|
data/lib/pvcglue/packages.rb
CHANGED
@@ -10,6 +10,9 @@ module Pvcglue
|
|
10
10
|
|
11
11
|
attr_accessor :errors
|
12
12
|
attr_accessor :options
|
13
|
+
attr_accessor :post_install_max_retry_seconds
|
14
|
+
attr_accessor :post_install_max_retry_count
|
15
|
+
attr_accessor :post_install_retry_delay_seconds
|
13
16
|
|
14
17
|
def initialize(minion, options = {})
|
15
18
|
@minion = minion
|
@@ -42,13 +45,13 @@ module Pvcglue
|
|
42
45
|
Pvcglue.logger_package_description = self.class.name
|
43
46
|
unless installed?
|
44
47
|
install!
|
45
|
-
if
|
48
|
+
if post_install_check_with_retry?
|
46
49
|
post_install!
|
47
50
|
else
|
48
51
|
# TODO: Better error message
|
49
52
|
|
50
53
|
errors << 'Install failed post install check.'
|
51
|
-
Pvcglue.logger.error {
|
54
|
+
Pvcglue.logger.error {full_error_message}
|
52
55
|
return false
|
53
56
|
end
|
54
57
|
end
|
@@ -71,6 +74,27 @@ module Pvcglue
|
|
71
74
|
installed?
|
72
75
|
end
|
73
76
|
|
77
|
+
def post_install_retry(max_tries, delay_seconds = 0, max_seconds = 30)
|
78
|
+
self.post_install_max_retry_seconds = max_seconds
|
79
|
+
self.post_install_retry_delay_seconds = delay_seconds
|
80
|
+
self.post_install_max_retry_count = max_tries
|
81
|
+
end
|
82
|
+
|
83
|
+
def post_install_check_with_retry?
|
84
|
+
self.post_install_max_retry_seconds = 0.0
|
85
|
+
self.post_install_retry_delay_seconds = 0.0
|
86
|
+
self.post_install_max_retry_count = 1
|
87
|
+
started_at = Time.now.utc.to_f
|
88
|
+
tries = 0
|
89
|
+
begin
|
90
|
+
return true if post_install_check?
|
91
|
+
tries += 1
|
92
|
+
Pvcglue.logger.debug('Failed post install check, retrying...')
|
93
|
+
sleep(post_install_retry_delay_seconds)
|
94
|
+
end until tries >= post_install_max_retry_count || Time.now.utc.to_f - started_at > post_install_max_retry_seconds
|
95
|
+
false
|
96
|
+
end
|
97
|
+
|
74
98
|
def post_install!
|
75
99
|
|
76
100
|
end
|
@@ -113,12 +137,20 @@ module Pvcglue
|
|
113
137
|
end
|
114
138
|
end
|
115
139
|
|
116
|
-
def get_minion_state(key)
|
140
|
+
def get_minion_state(key = nil)
|
141
|
+
key = get_minion_state_key(key)
|
117
142
|
get_minion_state_data
|
118
143
|
connection.minion_state_data[key]
|
119
144
|
end
|
120
145
|
|
121
|
-
def
|
146
|
+
def get_minion_state_key(key)
|
147
|
+
# TODO: Use a versioned state, so that when the Pvcglue version is updated, it will rebuild all
|
148
|
+
key || self.class.name.downcase.gsub(':', '_').to_sym
|
149
|
+
end
|
150
|
+
|
151
|
+
def set_minion_state(key = nil, value = nil)
|
152
|
+
value ||= Time.now.utc
|
153
|
+
key = get_minion_state_key(key)
|
122
154
|
get_minion_state_data
|
123
155
|
connection.minion_state_data[key] = value
|
124
156
|
connection.write_to_file(:root, TOML.dump(connection.minion_state_data), minion_state_file_name)
|
data/lib/pvcglue/packages/apt.rb
CHANGED
@@ -8,6 +8,11 @@ module Pvcglue
|
|
8
8
|
has_roles? %w(lb web)
|
9
9
|
end
|
10
10
|
|
11
|
+
def redis_needed?
|
12
|
+
# has_roles? %w(redis)
|
13
|
+
has_roles? %w(redis web worker) # web worker will just have package `redis-tools`
|
14
|
+
end
|
15
|
+
|
11
16
|
def node_js_needed?
|
12
17
|
has_roles? %w(web worker)
|
13
18
|
end
|
@@ -58,6 +63,16 @@ module Pvcglue
|
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
66
|
+
if redis_needed?
|
67
|
+
docs.set_item(
|
68
|
+
heading: 'Redis',
|
69
|
+
body: 'Install the latest stable version. The current Ubuntu version is apparently behind on security updates.',
|
70
|
+
reference: 'https://www.linode.com/docs/databases/redis/deploy-redis-on-ubuntu-or-debian'
|
71
|
+
) do
|
72
|
+
connection.run!(:root, '', 'add-apt-repository "ppa:chris-lea/redis-server"')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
61
76
|
if node_js_needed?
|
62
77
|
# Reference: http://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/
|
63
78
|
connection.run!(:root, '', 'apt-get install -y apt-transport-https ca-certificates python-software-properties lsb-release')
|
@@ -10,30 +10,57 @@ module Pvcglue
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def install!
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
docs.set_item(
|
14
|
+
heading: 'Authorized Users',
|
15
|
+
body: 'Configures sshd and the authorized_keys files.',
|
16
|
+
notes: [
|
17
|
+
''
|
18
|
+
],
|
19
|
+
cheatsheet: [
|
20
|
+
'',
|
21
|
+
],
|
22
|
+
references: [
|
23
|
+
'https://serverfault.com/questions/256098/authorized-keys-environment-variables-not-setting-environment-variables',
|
24
|
+
'https://serverfault.com/questions/527638/security-risks-of-permituserenvironment-in-ssh',
|
25
|
+
'',
|
26
|
+
'https://www.digitalocean.com/community/tutorials/how-to-read-and-set-environmental-and-shell-variables-on-a-linux-vps',
|
27
|
+
'https://binblog.info/2008/10/20/openssh-going-flexible-with-forced-commands/',
|
28
|
+
'https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.foto100/authkeyf.htm',
|
29
|
+
'https://en.wikibooks.org/wiki/OpenSSH/Client_Configuration_Files#environment.3D.22NAME.3Dvalue.22',
|
30
|
+
'http://man.openbsd.org/sshd_config.5',
|
31
|
+
'https://developer.rackspace.com/blog/speeding-up-ssh-session-creation/',
|
32
|
+
]
|
33
|
+
) do
|
34
|
+
# sshd configuration
|
35
|
+
connection.write_to_file_from_template(:root, 'sshd_config.erb', '/etc/ssh/sshd_config')
|
36
|
+
connection.run!(:root, '', 'systemctl restart sshd')
|
37
|
+
|
38
|
+
# authorized_keys
|
39
|
+
# TODO: Safety check to see if user is locking himself out. :)
|
40
|
+
if manager_first_bootstrap?
|
41
|
+
# TODO: work out system for pvc-manager access
|
42
|
+
data = [`cat ~/.ssh/id_rsa.pub`.strip]
|
43
|
+
else
|
44
|
+
data = minion.get_root_authorized_keys_data
|
45
|
+
if data.count == 0
|
46
|
+
raise('No authorized keys found for root users!')
|
47
|
+
end
|
21
48
|
end
|
22
|
-
|
23
|
-
connection.write_to_file(:root, data.join("\n"), '/root/.ssh/authorized_keys')
|
49
|
+
connection.write_to_file(:root, data.join("\n"), '/root/.ssh/authorized_keys')
|
24
50
|
|
25
|
-
|
51
|
+
connection.mkdir_p(:root, "/home/#{user_name}/.ssh", user_name, user_name, '0700')
|
26
52
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
53
|
+
if manager_first_bootstrap?
|
54
|
+
data = [`cat ~/.ssh/id_rsa.pub`.strip]
|
55
|
+
else
|
56
|
+
data = minion.get_users_authorized_keys_data
|
57
|
+
if data.count == 0
|
58
|
+
raise('No authorized keys found for users!')
|
59
|
+
# TODO: work out system for pvc-manager access
|
60
|
+
end
|
34
61
|
end
|
62
|
+
connection.write_to_file(:root, data.join("\n"), user_authorized_keys_file_name, user_name, user_name, '0644')
|
35
63
|
end
|
36
|
-
connection.write_to_file(:root, data.join("\n"), user_authorized_keys_file_name, user_name, user_name, '0644')
|
37
64
|
end
|
38
65
|
|
39
66
|
def user_authorized_keys_file_name
|
@@ -4,8 +4,7 @@ module Pvcglue
|
|
4
4
|
# Reference: http://manpages.ubuntu.com/manpages/xenial/en/man8/ufw-framework.8.html
|
5
5
|
# Examples: https://help.ubuntu.com/community/UFW
|
6
6
|
def installed?
|
7
|
-
|
8
|
-
result =~ /Status: active/ && result =~ /Default: deny \(incoming\), allow \(outgoing\)/
|
7
|
+
get_minion_state
|
9
8
|
end
|
10
9
|
|
11
10
|
def install!
|
@@ -26,8 +25,13 @@ module Pvcglue
|
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
28
|
+
set_minion_state
|
29
29
|
end
|
30
30
|
|
31
|
+
def post_install_check?
|
32
|
+
result = connection.run_get_stdout!(:root, '', 'ufw status verbose')
|
33
|
+
result =~ /Status: active/ && result =~ /Default: deny \(incoming\), allow \(outgoing\)/
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
end
|
@@ -82,7 +82,7 @@ module Pvcglue
|
|
82
82
|
raise('Not supported for local manager') if Pvcglue.command_line_options[:cloud_manager_override]
|
83
83
|
|
84
84
|
test_data = File.read(::Pvcglue.cloud.local_file_name)
|
85
|
-
TOML.parse(test_data) # At least make sure it's valid TOML
|
85
|
+
::SafeMash.new(TOML.parse(test_data)) # At least make sure it's valid TOML and that we can load it in
|
86
86
|
|
87
87
|
# TODO: More in-depth validations
|
88
88
|
|
@@ -94,7 +94,9 @@ module Pvcglue
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def git_commit!
|
97
|
-
connection.ssh!(user_name, '', %Q(cd #{manager_dir} && git add -A && git commit --allow-empty --author="pvc-$PVCGLUE_USER <>" -m "Change configuration"))
|
97
|
+
# connection.ssh!(user_name, '', %Q(cd #{manager_dir} && git add -A && git commit --allow-empty --author="pvc-$PVCGLUE_USER <>" -m "Change configuration")) # Will not work as $PVCGLUE_USER is in the local context here
|
98
|
+
connection.ssh!(user_name, '', %Q(cd #{manager_dir} && git add -A && git commit --allow-empty --author="pvc-\\$PVCGLUE_USER <>" -m "Change configuration")) # It's all about context!
|
99
|
+
# connection.ssh!(user_name, '', %Q(cd #{manager_dir} && git add -A && git commit --allow-empty --author="pvc-\\`printenv PVCGLUE_USER\\` <>" -m "Change configuration")) # Another way that works...for future reference
|
98
100
|
end
|
99
101
|
|
100
102
|
def working_directory_clean?
|
@@ -107,6 +109,7 @@ module Pvcglue
|
|
107
109
|
end
|
108
110
|
|
109
111
|
def pull_configuration
|
112
|
+
# ssh REMOTE "sh -c \"(nohup sleep 30; touch nohup-exit) > /dev/null &\""
|
110
113
|
# TODO: Rename to edit_config_start, and create Thor commands to match
|
111
114
|
if connection.file_exists?(user_name, ::Pvcglue::Manager.manager_file_name)
|
112
115
|
data = connection.read_from_file(user_name, ::Pvcglue::Manager.manager_file_name)
|
@@ -7,9 +7,12 @@ module Pvcglue
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def install!
|
10
|
+
# TODO: Adjust vm.overcommit_memory?
|
11
|
+
# See https://www.postgresql.org/docs/9.3/static/kernel-resources.html#LINUX-MEMORY-OVERCOMMIT
|
12
|
+
# http://serverfault.com/questions/755772/redis-and-postgresql-on-same-machine-vm-overcommit-memory
|
10
13
|
Pvcglue::Env.initialize_stage_env
|
11
|
-
connection.write_to_file_from_template(:root, 'postgresql.conf.erb', '/etc/postgresql/9.6/main/postgresql.conf', 'postgres', 'postgres', '0644')
|
12
|
-
connection.write_to_file_from_template(:root, 'pg_hba.conf.erb', '/etc/postgresql/9.6/main/pg_hba.conf', 'postgres', 'postgres', '0644')
|
14
|
+
connection.write_to_file_from_template(:root, 'postgresql.conf.erb', '/etc/postgresql/9.6/main/postgresql.conf', nil, 'postgres', 'postgres', '0644')
|
15
|
+
connection.write_to_file_from_template(:root, 'pg_hba.conf.erb', '/etc/postgresql/9.6/main/pg_hba.conf', nil, 'postgres', 'postgres', '0644')
|
13
16
|
|
14
17
|
connection.run_get_stdout(:root, '', 'service postgresql restart')
|
15
18
|
unless $?.exitstatus == 0
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Pvcglue
|
2
|
+
class Packages
|
3
|
+
class Redis < Pvcglue::Packages
|
4
|
+
|
5
|
+
def installed?
|
6
|
+
get_minion_state
|
7
|
+
end
|
8
|
+
|
9
|
+
def install!
|
10
|
+
docs.set_item(
|
11
|
+
heading: 'Redis',
|
12
|
+
body: 'Set the recommended persistence and memory settings.',
|
13
|
+
notes: [
|
14
|
+
'If multiple applications use the same virtual machine, set a unique database number (0-15) for each one `REDIS_URL=redis://<redis_private_ip>:6379/<number>`'
|
15
|
+
],
|
16
|
+
cheatsheet: [
|
17
|
+
'System Level Status(run on Redis server): sudo systemctl status redis',
|
18
|
+
'Redis Info (run on Redis server): redis-cli info',
|
19
|
+
'Redis Status (run on Redis server): redis-cli --stat',
|
20
|
+
'Monitor Redis Commands (run on Redis server): redis-cli monitor',
|
21
|
+
'Latency (run on Redis server): redis-cli --latency',
|
22
|
+
'Intrinsic Latency (run on Redis server): redis-cli --intrinsic-latency 10',
|
23
|
+
'Ping Redis (run from web or worker): redis-cli -h xxx.xxx.xxx.xxx ping',
|
24
|
+
'Redis Status (run from web or worker): redis-cli -h xxx.xxx.xxx.xxx --stat',
|
25
|
+
'Latency (run from web or worker): redis-cli -h xxx.xxx.xxx.xxx --latency',
|
26
|
+
'Latency Dist (run from web or worker): redis-cli -h xxx.xxx.xxx.xxx --latency-dist',
|
27
|
+
],
|
28
|
+
references: [
|
29
|
+
'[CLI Reference]https://redis.io/topics/rediscli',
|
30
|
+
'https://www.linode.com/docs/databases/redis/deploy-redis-on-ubuntu-or-debian',
|
31
|
+
'https://redis.io/topics/faq',
|
32
|
+
'http://serverfault.com/questions/485798/cent-os-how-do-i-turn-off-or-reduce-memory-overcommitment-and-is-it-safe-to-do',
|
33
|
+
'https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04',
|
34
|
+
'http://stackoverflow.com/questions/21795340/linux-install-redis-cli-only',
|
35
|
+
]
|
36
|
+
) do
|
37
|
+
# Persistence
|
38
|
+
connection.write_to_file_from_template(:root, 'redis.conf.erb', '/etc/redis/redis.conf')
|
39
|
+
connection.run!(:root, '', 'service redis-server restart')
|
40
|
+
|
41
|
+
# Memory management
|
42
|
+
connection.run!(:root, '', 'sysctl vm.overcommit_memory=1') # Not sure if this is necessary if doing `sysctl -p`
|
43
|
+
connection.write_to_file_from_template(:root, 'sysctl.conf.erb', '/etc/sysctl.conf')
|
44
|
+
connection.run!(:root, '', 'sysctl -p')
|
45
|
+
end
|
46
|
+
|
47
|
+
set_minion_state
|
48
|
+
end
|
49
|
+
|
50
|
+
def post_install_check?
|
51
|
+
post_install_retry(20,0.5)
|
52
|
+
redis_info = connection.run_get_stdout!(user_name, '', 'redis-cli info')
|
53
|
+
no_eviction = redis_info =~ /maxmemory_policy:noeviction/
|
54
|
+
aof_enabled = redis_info =~ /aof_enabled:1/
|
55
|
+
get_minion_state && no_eviction && aof_enabled
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/lib/pvcglue/packages/rvm.rb
CHANGED
@@ -13,7 +13,7 @@ module Pvcglue
|
|
13
13
|
# Do it again, the first time only sets things up, and does not import the keys
|
14
14
|
connection.run!(user_name, '', '\curl -sSL https://get.rvm.io | bash -s stable --with-default-gems=bundler')
|
15
15
|
|
16
|
-
# TODO: set autolibs mode so
|
16
|
+
# TODO: set autolibs mode so they are not installed automatically, as the user won't have sudo permissions later.
|
17
17
|
# OR create a 'install' user that can sudo...might be easier...
|
18
18
|
# Installing required packages: libreadline6-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgmp-dev, libgdbm-dev, libncurses5-dev, automake, libtool, bison, pkg-config, libffi-dev...............
|
19
19
|
|
@@ -7,8 +7,9 @@ module Pvcglue
|
|
7
7
|
|
8
8
|
def install!
|
9
9
|
Pvcglue::Env.initialize_stage_env
|
10
|
-
connection.write_to_file_from_template(user_name, 'web.env.erb', Pvcglue.cloud.env_file_name, nil, nil, '0640') # TODO: Double check permissions
|
10
|
+
connection.write_to_file_from_template(user_name, 'web.env.erb', Pvcglue.cloud.env_file_name, nil, nil, nil, '0640') # TODO: Double check permissions
|
11
11
|
restart_web_app!
|
12
|
+
restart_workers!
|
12
13
|
end
|
13
14
|
|
14
15
|
def post_install_check?
|
@@ -21,6 +22,11 @@ module Pvcglue
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
25
|
+
def restart_workers!
|
26
|
+
puts ('*'*800).red
|
27
|
+
puts 'Workers not restarted!!!'.yellow
|
28
|
+
end
|
29
|
+
|
24
30
|
def self.load_for_stage
|
25
31
|
data = Pvcglue::Packages::Manager.new.load_secrets
|
26
32
|
data = '' if data.nil?
|