escualo 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/commands/script.rb +9 -4
- data/lib/escualo/artifact.rb +2 -2
- data/lib/escualo/bootstrap.rb +14 -12
- data/lib/escualo/remote.rb +1 -1
- data/lib/escualo/version.rb +1 -1
- data/lib/ssh/session.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 432ee25813d9e628b9ee1dcd7854f6c5f4ad26fd
|
4
|
+
data.tar.gz: fa4492ebbe50f6e552d8b6a3750c46248da78bf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a0a3c01d37d9eaf25cf86a3379985994e4f976cf419c8ad7152d74e40a64980e6b5415e84cdc1435e5d0ca6dd100903db162b27dcc49acfc149d9733587da83
|
7
|
+
data.tar.gz: 51c6aaa54956684835e5b982ce40522c2635b1b9a501a054120626882b16148ef2cfb5c0966f481285d4d48d30d822b0f7b20060f0e627698b7dec1cbba81c8e
|
data/lib/commands/script.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
def run_commands_for!(script, extra='', ssh)
|
1
|
+
def run_commands_for!(script, extra='', ssh, options)
|
2
2
|
script.map { |it| "escualo #{it} #{extra}" }.each do |command|
|
3
3
|
puts "Running `#{command}`"
|
4
|
-
|
4
|
+
ssh.shell.perform! command, options
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
@@ -19,15 +19,20 @@ command 'script' do |c|
|
|
19
19
|
c.description = 'Runs a escualo configuration'
|
20
20
|
c.action do |args, options|
|
21
21
|
file = YAML.load_file args.first
|
22
|
+
local_ssh = Net::SSH::Connection::LocalSession.new
|
22
23
|
|
23
24
|
step 'Running local commands...' do
|
24
|
-
run_commands_for! file['local'], ssh_options,
|
25
|
+
run_commands_for! file['local'], ssh_options, local_ssh, options
|
25
26
|
end
|
26
27
|
|
27
28
|
step 'Running remote commands...' do
|
28
29
|
Net::SSH.start($hostname, $username, $ssh_options.compact) do |ssh|
|
29
|
-
run_commands_for! file['remote'], ssh
|
30
|
+
run_commands_for! file['remote'], ssh, options
|
30
31
|
end
|
31
32
|
end
|
33
|
+
|
34
|
+
step 'Running deploy commands...' do
|
35
|
+
run_commands_for! file['deploy'], ssh_options, local_ssh, options
|
36
|
+
end
|
32
37
|
end
|
33
38
|
end
|
data/lib/escualo/artifact.rb
CHANGED
@@ -60,12 +60,12 @@ module Escualo
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def self.create_codechange_script(ssh, name)
|
63
|
-
ssh.upload_template! "/var/scripts/#{name}/codechange",
|
63
|
+
ssh.upload_template! "/var/scripts/#{name}/codechange", 'codechange.sh', name: name
|
64
64
|
ssh.exec! "chmod +x /var/scripts/#{name}/codechange"
|
65
65
|
end
|
66
66
|
|
67
67
|
def self.configure_upstart(ssh, options)
|
68
|
-
ssh.upload_template! "/etc/init/#{name}.conf", 'upstart.conf', options
|
68
|
+
ssh.upload_template! "/etc/init/#{options[:name]}.conf", 'upstart.conf', options
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
data/lib/escualo/bootstrap.rb
CHANGED
@@ -13,6 +13,7 @@ module Escualo
|
|
13
13
|
libreadline6-dev \
|
14
14
|
curl \
|
15
15
|
git \
|
16
|
+
monit \
|
16
17
|
libssl-dev \
|
17
18
|
ruby2.0 \
|
18
19
|
ruby2.0-dev \
|
@@ -34,18 +35,19 @@ module Escualo
|
|
34
35
|
end
|
35
36
|
|
36
37
|
def self.setup_monit(ssh, options)
|
37
|
-
ssh.
|
38
|
-
service monit stop
|
39
|
-
cd /tmp &&
|
40
|
-
wget https://mmonit.com/monit/dist/binary/5.16/monit-#{options.monit_version}-linux-x64.tar.gz &&
|
41
|
-
tar -xzf monit-#{options.monit_version}-linux-x64.tar.gz &&
|
42
|
-
cp monit-#{options.monit_version}/bin/monit /usr/bin/monit
|
43
|
-
ln -s /etc/monit/monitrc /etc/monitrc
|
44
|
-
service monit start
|
45
|
-
'set httpd port 2812 and' > /etc/monit/conf.d/web-server
|
46
|
-
' allow 0.0.0.0/0.0.0.0' >> /etc/monit/conf.d/web-server
|
47
|
-
' allow admin:#{options.monit_password}' >> /etc/monit/conf.d/web-server
|
48
|
-
monit reload
|
38
|
+
ssh.perform! %Q{
|
39
|
+
service monit stop
|
40
|
+
cd /tmp &&
|
41
|
+
wget https://mmonit.com/monit/dist/binary/5.16/monit-#{options.monit_version}-linux-x64.tar.gz &&
|
42
|
+
tar -xzf monit-#{options.monit_version}-linux-x64.tar.gz &&
|
43
|
+
cp monit-#{options.monit_version}/bin/monit /usr/bin/monit
|
44
|
+
ln -s /etc/monit/monitrc /etc/monitrc
|
45
|
+
service monit start
|
46
|
+
'set httpd port 2812 and' > /etc/monit/conf.d/web-server
|
47
|
+
' allow 0.0.0.0/0.0.0.0' >> /etc/monit/conf.d/web-server
|
48
|
+
' allow admin:#{options.monit_password}' >> /etc/monit/conf.d/web-server
|
49
|
+
monit reload
|
50
|
+
}, options
|
49
51
|
end
|
50
52
|
|
51
53
|
def self.install_gems(ssh, options)
|
data/lib/escualo/remote.rb
CHANGED
@@ -2,7 +2,7 @@ module Escualo
|
|
2
2
|
module Remote
|
3
3
|
def self.attach(dir, name)
|
4
4
|
remote_name = "escualo-#{name}-#{$hostname}"
|
5
|
-
remote_url = "ssh://#{$username}@#{$hostname}:#{$
|
5
|
+
remote_url = "ssh://#{$username}@#{$hostname}:#{$ssh_port}/var/repo/#{name}.git"
|
6
6
|
%x{cd #{dir} && git remote add #{remote_name} #{remote_url}}
|
7
7
|
end
|
8
8
|
|
data/lib/escualo/version.rb
CHANGED
data/lib/ssh/session.rb
CHANGED
@@ -11,10 +11,10 @@ class Net::SSH::Connection::Session
|
|
11
11
|
ch.exec command do |ch, success|
|
12
12
|
raise 'could not execute command' unless success
|
13
13
|
ch.on_data do |c, data|
|
14
|
-
$stdout.print data
|
14
|
+
$stdout.print data unless garbage? data
|
15
15
|
end
|
16
16
|
ch.on_extended_data do |c, type, data|
|
17
|
-
$stderr.print data
|
17
|
+
$stderr.print data unless garbage? data
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -25,6 +25,12 @@ class Net::SSH::Connection::Session
|
|
25
25
|
Shell.new self
|
26
26
|
end
|
27
27
|
|
28
|
+
private
|
29
|
+
|
30
|
+
def garbage?(data)
|
31
|
+
data.start_with?('bash: cannot set terminal process group') || data.start_with?('bash: no job control in this shell')
|
32
|
+
end
|
33
|
+
|
28
34
|
class Shell
|
29
35
|
attr_reader :ssh
|
30
36
|
|