Package not found. Please check the package name and try again.
rhoconnect 3.4.4 → 3.4.5
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.
- data/CHANGELOG.md +6 -1
- data/Gemfile.lock +54 -45
- data/install.sh +5 -5
- data/installer/unix-like/rho_connect_install_constants.rb +2 -2
- data/installer/utils/constants.rb +13 -10
- data/installer/utils/nix_install_test.rb +194 -224
- data/lib/rhoconnect/version.rb +1 -1
- data/lib/rhoconnect/web-console/server.rb +13 -13
- data/rhoconnect.gemspec +4 -4
- metadata +5 -5
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
## 3.4.5 (2013-05-14)
|
|
2
|
+
* TK-182435 - Run platform validation in parallel (both nightly tests and release jobs)
|
|
3
|
+
* D-04477 - Rack::Session::Cookie security warning printing on every http request
|
|
4
|
+
* B-106356 - Update nginx package to 1.4.1 (CVE-2013-2028)
|
|
5
|
+
|
|
1
6
|
## 3.4.4 (2013-02-27)
|
|
2
|
-
* Updated prod. stack to ruby-1.9.3-p392, redis-2.6.10, and nginx-1.3.13.
|
|
7
|
+
* Updated prod. stack to ruby-1.9.3-p392, redis-2.6.10, and nginx-1.3.13.
|
|
3
8
|
|
|
4
9
|
## 3.4.3 (2013-02-11)
|
|
5
10
|
* Updated rack gem to latest release with important security fixes. Locked version of 'connection_pool' gem.
|
data/Gemfile.lock
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rhoconnect (3.4.
|
|
4
|
+
rhoconnect (3.4.5)
|
|
5
5
|
bundler (~> 1.0)
|
|
6
6
|
connection_pool (= 0.9.2)
|
|
7
|
-
json (~> 1.
|
|
7
|
+
json (~> 1.7.7)
|
|
8
8
|
rack (~> 1.5.2)
|
|
9
9
|
rake (~> 0.9.2.2)
|
|
10
10
|
redis (>= 3.0.1)
|
|
@@ -20,8 +20,8 @@ GEM
|
|
|
20
20
|
remote: https://rubygems.org/
|
|
21
21
|
specs:
|
|
22
22
|
SystemTimer (1.2.3)
|
|
23
|
-
addressable (2.3.
|
|
24
|
-
arr-pm (0.0.
|
|
23
|
+
addressable (2.3.4)
|
|
24
|
+
arr-pm (0.0.8)
|
|
25
25
|
cabin (> 0)
|
|
26
26
|
async-rack (0.5.1)
|
|
27
27
|
rack (~> 1.1)
|
|
@@ -29,48 +29,55 @@ GEM
|
|
|
29
29
|
builder
|
|
30
30
|
mime-types
|
|
31
31
|
xml-simple
|
|
32
|
-
backports (
|
|
32
|
+
backports (3.3.0)
|
|
33
33
|
builder (3.2.0)
|
|
34
34
|
cabin (0.6.0)
|
|
35
|
-
childprocess (0.3.
|
|
35
|
+
childprocess (0.3.9)
|
|
36
36
|
ffi (~> 1.0, >= 1.0.11)
|
|
37
|
-
clamp (0.
|
|
37
|
+
clamp (0.6.0)
|
|
38
38
|
coffee-script (2.2.0)
|
|
39
39
|
coffee-script-source
|
|
40
40
|
execjs
|
|
41
|
-
coffee-script-source (1.
|
|
41
|
+
coffee-script-source (1.6.2)
|
|
42
42
|
connection_pool (0.9.2)
|
|
43
43
|
crack (0.3.2)
|
|
44
44
|
daemons (1.1.9)
|
|
45
45
|
diff-lcs (1.1.3)
|
|
46
|
-
eventmachine (1.0.
|
|
47
|
-
excon (0.
|
|
46
|
+
eventmachine (1.0.3)
|
|
47
|
+
excon (0.21.0)
|
|
48
48
|
execjs (1.4.0)
|
|
49
49
|
multi_json (~> 1.0)
|
|
50
50
|
extlib (0.9.16)
|
|
51
51
|
ffaker (1.14.0)
|
|
52
|
-
ffi (1.
|
|
53
|
-
fog (1.
|
|
52
|
+
ffi (1.8.1)
|
|
53
|
+
fog (1.11.1)
|
|
54
54
|
builder
|
|
55
|
-
excon (~> 0.
|
|
55
|
+
excon (~> 0.20)
|
|
56
56
|
formatador (~> 0.2.0)
|
|
57
|
+
json (~> 1.7)
|
|
57
58
|
mime-types
|
|
58
|
-
|
|
59
|
-
net-scp (~> 1.0.4)
|
|
59
|
+
net-scp (~> 1.1)
|
|
60
60
|
net-ssh (>= 2.1.3)
|
|
61
61
|
nokogiri (~> 1.5.0)
|
|
62
62
|
ruby-hmac
|
|
63
63
|
formatador (0.2.4)
|
|
64
|
-
fpm (0.4.
|
|
65
|
-
arr-pm (~> 0.0.
|
|
66
|
-
backports (
|
|
64
|
+
fpm (0.4.35)
|
|
65
|
+
arr-pm (~> 0.0.8)
|
|
66
|
+
backports (>= 2.6.2)
|
|
67
67
|
cabin (>= 0.6.0)
|
|
68
|
-
clamp (= 0.
|
|
69
|
-
|
|
68
|
+
clamp (= 0.6.0)
|
|
69
|
+
ftw (~> 0.0.30)
|
|
70
|
+
json (~> 1.7.7)
|
|
70
71
|
open4
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
ftw (0.0.33)
|
|
73
|
+
addressable
|
|
74
|
+
backports (>= 2.6.2)
|
|
75
|
+
cabin (> 0)
|
|
76
|
+
http_parser.rb (= 0.5.3)
|
|
77
|
+
highline (1.6.19)
|
|
78
|
+
hike (1.2.2)
|
|
79
|
+
http_parser.rb (0.5.3)
|
|
80
|
+
jasmine (1.3.2)
|
|
74
81
|
jasmine-core (~> 1.3.1)
|
|
75
82
|
rack (~> 1.0)
|
|
76
83
|
rspec (>= 1.3.1)
|
|
@@ -82,29 +89,31 @@ GEM
|
|
|
82
89
|
multi_json
|
|
83
90
|
rainbow
|
|
84
91
|
sprockets (~> 2)
|
|
85
|
-
json (1.
|
|
86
|
-
mime-types (1.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
json (1.7.7)
|
|
93
|
+
mime-types (1.23)
|
|
94
|
+
mono_logger (1.0.1)
|
|
95
|
+
multi_json (1.7.3)
|
|
96
|
+
net-scp (1.1.1)
|
|
97
|
+
net-ssh (>= 2.6.5)
|
|
98
|
+
net-ssh (2.6.7)
|
|
99
|
+
nokogiri (1.5.9)
|
|
92
100
|
open4 (1.3.0)
|
|
93
101
|
rack (1.5.2)
|
|
94
|
-
rack-fiber_pool (0.9.
|
|
95
|
-
rack-protection (1.
|
|
102
|
+
rack-fiber_pool (0.9.3)
|
|
103
|
+
rack-protection (1.5.0)
|
|
96
104
|
rack
|
|
97
105
|
rack-test (0.6.2)
|
|
98
106
|
rack (>= 1.0)
|
|
99
107
|
rainbow (1.1.4)
|
|
100
108
|
rake (0.9.2.2)
|
|
101
109
|
rcov (1.0.0)
|
|
102
|
-
redis (3.0.
|
|
103
|
-
redis-namespace (1.
|
|
110
|
+
redis (3.0.4)
|
|
111
|
+
redis-namespace (1.3.0)
|
|
104
112
|
redis (~> 3.0.0)
|
|
105
|
-
resque (1.
|
|
113
|
+
resque (1.24.1)
|
|
114
|
+
mono_logger (~> 1.0)
|
|
106
115
|
multi_json (~> 1.0)
|
|
107
|
-
redis-namespace (~> 1.
|
|
116
|
+
redis-namespace (~> 1.2)
|
|
108
117
|
sinatra (>= 0.9.2)
|
|
109
118
|
vegas (~> 0.1.2)
|
|
110
119
|
rest-client (1.6.7)
|
|
@@ -119,7 +128,7 @@ GEM
|
|
|
119
128
|
rspec-mocks (2.10.1)
|
|
120
129
|
ruby-hmac (0.4.0)
|
|
121
130
|
rubyzip (0.9.9)
|
|
122
|
-
selenium-webdriver (2.
|
|
131
|
+
selenium-webdriver (2.32.1)
|
|
123
132
|
childprocess (>= 0.2.5)
|
|
124
133
|
multi_json (~> 1.0)
|
|
125
134
|
rubyzip
|
|
@@ -128,11 +137,11 @@ GEM
|
|
|
128
137
|
multi_json (~> 1.0)
|
|
129
138
|
simplecov-html (~> 0.7.1)
|
|
130
139
|
simplecov-html (0.7.1)
|
|
131
|
-
sinatra (1.
|
|
132
|
-
rack (~> 1.
|
|
133
|
-
rack-protection (~> 1.
|
|
134
|
-
tilt (~> 1.3, >= 1.3.
|
|
135
|
-
sprockets (2.9.
|
|
140
|
+
sinatra (1.4.2)
|
|
141
|
+
rack (~> 1.5, >= 1.5.2)
|
|
142
|
+
rack-protection (~> 1.4)
|
|
143
|
+
tilt (~> 1.3, >= 1.3.4)
|
|
144
|
+
sprockets (2.9.3)
|
|
136
145
|
hike (~> 1.2)
|
|
137
146
|
multi_json (~> 1.0)
|
|
138
147
|
rack (~> 1.0)
|
|
@@ -142,13 +151,13 @@ GEM
|
|
|
142
151
|
diff-lcs (>= 1.1.2)
|
|
143
152
|
extlib (>= 0.9.5)
|
|
144
153
|
highline (>= 1.4.0)
|
|
145
|
-
thin (1.5.
|
|
154
|
+
thin (1.5.1)
|
|
146
155
|
daemons (>= 1.0.9)
|
|
147
156
|
eventmachine (>= 0.12.6)
|
|
148
157
|
rack (>= 1.0.0)
|
|
149
158
|
thor (0.15.4)
|
|
150
|
-
tilt (1.
|
|
151
|
-
uuidtools (2.1.
|
|
159
|
+
tilt (1.4.1)
|
|
160
|
+
uuidtools (2.1.4)
|
|
152
161
|
vegas (0.1.11)
|
|
153
162
|
rack (>= 1.0.0)
|
|
154
163
|
webmock (1.8.11)
|
data/install.sh
CHANGED
|
@@ -46,7 +46,7 @@ checkDeps ()
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
# determinePkgMgr
|
|
49
|
-
# Determines if the system is currently using rpm or
|
|
49
|
+
# Determines if the system is currently using rpm or
|
|
50
50
|
# debian based pckage management
|
|
51
51
|
determinePkgMgr ()
|
|
52
52
|
{
|
|
@@ -195,7 +195,7 @@ installRuby ()
|
|
|
195
195
|
echo "tar -xzf ${prefix}/${rubyTar} -C ${prefix}" >> $log
|
|
196
196
|
tar -xzf ${prefix}/${rubyTar} -C ${prefix} > /dev/null 2>&1
|
|
197
197
|
fi
|
|
198
|
-
|
|
198
|
+
|
|
199
199
|
echo "Installing ruby. This may take some time..." | tee -a $log
|
|
200
200
|
echo "pushd ${prefix}/${rubyDir}" | tee -a $log
|
|
201
201
|
pushd ${prefix}/${rubyDir}
|
|
@@ -204,14 +204,14 @@ installRuby ()
|
|
|
204
204
|
echo "make && make install" | tee -a $log
|
|
205
205
|
make >> $log 2>&1
|
|
206
206
|
make install >> $log 2>&1
|
|
207
|
-
|
|
207
|
+
|
|
208
208
|
if (( $? )) ; then
|
|
209
209
|
echo "Some dependencies not installed..." | tee -a $log
|
|
210
210
|
echo "Please install them and then re-run the installation script." | tee -a $log
|
|
211
211
|
echo "For troubleshooting see file $log ..." | tee -a $log
|
|
212
212
|
exit 1
|
|
213
213
|
fi
|
|
214
|
-
|
|
214
|
+
|
|
215
215
|
popd
|
|
216
216
|
echo -e "$rubyDir is successfully installed.\n" | tee -a $log
|
|
217
217
|
}
|
|
@@ -293,7 +293,7 @@ fi
|
|
|
293
293
|
# Install redis, sqllite3, nginx, rhoconnect
|
|
294
294
|
opts=" -d $dist -l $log"
|
|
295
295
|
${prefix}/bin/ruby ${INSTALL_DIR}/unix-like/rhoinstaller.rb ${opts}
|
|
296
|
-
if (( $? )) ; then
|
|
296
|
+
if (( $? )) ; then
|
|
297
297
|
echo "Installation failed. For troubleshooting see file $log ..." | tee -a $log
|
|
298
298
|
exit 1
|
|
299
299
|
fi
|
|
@@ -9,9 +9,9 @@ module Constants
|
|
|
9
9
|
"dtach"]
|
|
10
10
|
|
|
11
11
|
RUBY = "ruby-1.9.3-p392"
|
|
12
|
-
REDIS = "redis-2.6.
|
|
12
|
+
REDIS = "redis-2.6.13"
|
|
13
13
|
SQLITE3 = "sqlite-autoconf-3071502"
|
|
14
|
-
NGINX = "nginx-1.
|
|
14
|
+
NGINX = "nginx-1.4.1"
|
|
15
15
|
PASSENGER_ROOT = "/opt/rhoconnect/lib/ruby/gems/1.9.1/gems/passenger"
|
|
16
16
|
|
|
17
17
|
SOFTWARE = [ REDIS, SQLITE3, RUBY, NGINX ]
|
|
@@ -3,7 +3,6 @@ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
|
|
|
3
3
|
require 'rhoconnect/version'
|
|
4
4
|
|
|
5
5
|
module Constants
|
|
6
|
-
|
|
7
6
|
RC_VERSION = Rhoconnect::VERSION
|
|
8
7
|
REGION = 'us-west-1'
|
|
9
8
|
SLEEP = 60
|
|
@@ -12,21 +11,26 @@ module Constants
|
|
|
12
11
|
PEM_FILE = 'jenkinskey.pem'
|
|
13
12
|
SSH_KEY = "#{HOME_DIR}/.ssh/#{PEM_FILE}"
|
|
14
13
|
ACCESS_KEY_FILE = "#{HOME_DIR}/.ec2"
|
|
15
|
-
UBUNTU_STACK = { :image_id => 'ami-
|
|
14
|
+
UBUNTU_STACK = { :image_id => 'ami-02d7f547', # jenkins-ubuntu-12.04-test-image
|
|
15
|
+
:tags => {'Name' => 'Ubuntu-12.04'},
|
|
16
16
|
:flavor_id => 'c1.xlarge',
|
|
17
17
|
:key_name => 'jenkinskey',
|
|
18
18
|
:groups => 'load-test',
|
|
19
19
|
:user => 'ubuntu'}
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
CENTOS5_STACK = { :image_id => 'ami-bed9f5fb', # jenkins-centos-5.9-test-image
|
|
21
|
+
:tags => {'Name' => 'CentOS-5.9'},
|
|
22
22
|
:flavor_id => 'c1.xlarge',
|
|
23
23
|
:key_name => 'jenkinskey',
|
|
24
24
|
:groups => 'load-test',
|
|
25
25
|
:user => 'root'}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
CENTOS6_STACK = { :image_id => 'ami-02ae8c47', # jenkins-centos-6.3-test-image
|
|
27
|
+
:tags => {'Name' => 'CentOS-6.3'},
|
|
28
|
+
:flavor_id => 'c1.xlarge',
|
|
29
|
+
:key_name => 'jenkinskey',
|
|
30
|
+
:groups => 'load-test',
|
|
31
|
+
:user => 'root'}
|
|
32
|
+
STACKS = [ UBUNTU_STACK, CENTOS5_STACK, CENTOS6_STACK ]
|
|
33
|
+
STACK_SIZE = STACKS.size
|
|
30
34
|
DEB_DEPS = [ "build-essential",
|
|
31
35
|
"zlib1g-dev",
|
|
32
36
|
"libssl-dev",
|
|
@@ -34,11 +38,10 @@ module Constants
|
|
|
34
38
|
"libreadline5-dev",
|
|
35
39
|
"libsqlite3-0",
|
|
36
40
|
"libsqlite3-dev" ]
|
|
37
|
-
|
|
38
41
|
RPM_DEPS = [ "gcc-c++",
|
|
39
42
|
"zlib-devel",
|
|
40
43
|
"curl-devel",
|
|
41
44
|
"pcre-devel",
|
|
42
45
|
"openssl-devel",
|
|
43
46
|
"readline-devel" ]
|
|
44
|
-
end
|
|
47
|
+
end
|
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
2
|
$:.unshift File.expand_path(File.dirname(__FILE__))
|
|
4
3
|
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'installer', 'utils'))
|
|
5
4
|
|
|
6
5
|
require 'rubygems'
|
|
6
|
+
require 'stringio'
|
|
7
|
+
require 'fog'
|
|
7
8
|
require 'net/http'
|
|
9
|
+
|
|
8
10
|
require 'constants'
|
|
9
|
-
|
|
11
|
+
include Constants
|
|
10
12
|
|
|
11
13
|
BUCKET = 'rhoconnect'
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
end #cmd
|
|
22
|
-
|
|
23
|
-
# ssh_cmd
|
|
24
|
-
# More easily issue commands over the ssh connection.
|
|
25
|
-
def ssh_cmd(cmd)
|
|
26
|
-
puts cmd
|
|
27
|
-
puts @ssh.run(cmd)[0].stdout
|
|
28
|
-
exit_code = @ssh.run('echo $?')[0].stdout
|
|
29
|
-
exit 1 if exit_code.to_i != 0
|
|
30
|
-
end #ssh_cmd
|
|
15
|
+
def run_on_server(server, cmds)
|
|
16
|
+
result = server.ssh(cmds)
|
|
17
|
+
result.each do |r|
|
|
18
|
+
raise "Command #{r.command} failed.\nStdout: #{r.stdout}\nStderr: #{r.stderr}" if r.status != 0
|
|
19
|
+
puts "$ #{r.command}"
|
|
20
|
+
puts r.stdout
|
|
21
|
+
end
|
|
22
|
+
end
|
|
31
23
|
|
|
32
|
-
# build_type
|
|
33
24
|
def build_type
|
|
34
25
|
case ARGV[0]
|
|
35
26
|
when 'test'
|
|
@@ -40,44 +31,39 @@ def build_type
|
|
|
40
31
|
'packages'
|
|
41
32
|
else
|
|
42
33
|
'packages'
|
|
43
|
-
end
|
|
44
|
-
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
45
36
|
|
|
46
|
-
# compile_stack_info
|
|
47
37
|
# Fills in all necessary information which is stack specific
|
|
48
|
-
def compile_stack_info
|
|
38
|
+
def compile_stack_info(stack)
|
|
49
39
|
# User is stack specific but not to
|
|
50
40
|
# be included in the fog creation hash
|
|
51
|
-
|
|
52
|
-
@stack.delete :user
|
|
41
|
+
user = stack[:user]
|
|
53
42
|
|
|
54
|
-
|
|
55
|
-
local_file = "#{`pwd`.strip}/pkg/"
|
|
56
|
-
|
|
43
|
+
local_file = "#{Dir.pwd}/pkg/"
|
|
57
44
|
# Determine what channel to pull the packages from
|
|
58
45
|
channel = build_type
|
|
59
46
|
|
|
60
47
|
# Append the rest of the file name according to distribution
|
|
61
|
-
if
|
|
62
|
-
|
|
63
|
-
@dist = { :flavor => "ubuntu",
|
|
48
|
+
if user == 'ubuntu'
|
|
49
|
+
dist = { :flavor => "ubuntu",
|
|
64
50
|
:package => "rhoconnect_#{Constants::RC_VERSION}_all.deb",
|
|
65
51
|
:local_file => "#{local_file}rhoconnect_#{Constants::RC_VERSION}_all.deb",
|
|
66
52
|
:pkg_mgr => 'dpkg',
|
|
67
53
|
:pkg_type => 'DEB',
|
|
68
|
-
:
|
|
54
|
+
:pkg_cmd => 'apt-get',
|
|
69
55
|
:deps => Constants::DEB_DEPS,
|
|
70
56
|
:repo_src_file => '/etc/apt/sources.list',
|
|
71
57
|
:repo_str => '\n' +
|
|
72
58
|
'# This is the repository for rhoconnect packages\n' +
|
|
73
59
|
"deb http://#{BUCKET}.s3.amazonaws.com/#{channel}/deb rhoconnect main" }
|
|
74
|
-
elsif
|
|
75
|
-
|
|
60
|
+
elsif user == 'root'
|
|
61
|
+
dist = { :flavor => "centos",
|
|
76
62
|
:package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
|
|
77
63
|
:local_file => "#{local_file}rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
|
|
78
64
|
:pkg_mgr => 'rpm',
|
|
79
65
|
:pkg_type => 'RPM',
|
|
80
|
-
:
|
|
66
|
+
:pkg_cmd => 'yum -y',
|
|
81
67
|
:deps => Constants::RPM_DEPS,
|
|
82
68
|
:repo_src_file => '/etc/yum.repos.d/rhoconnect.repo',
|
|
83
69
|
:repo_str => '[rhoconnect]\n' +
|
|
@@ -85,215 +71,199 @@ def compile_stack_info
|
|
|
85
71
|
"baseurl=http://#{BUCKET}.s3.amazonaws.com/#{channel}/rpm" +
|
|
86
72
|
'\nenabled=1\n' +
|
|
87
73
|
'gpgcheck=0\n' }
|
|
74
|
+
# else
|
|
75
|
+
# raise "Incorrect user name"
|
|
76
|
+
end
|
|
77
|
+
[user, dist]
|
|
78
|
+
end
|
|
88
79
|
|
|
89
|
-
|
|
90
|
-
puts "Incorrect user name"
|
|
91
|
-
exit 3
|
|
92
|
-
end #i
|
|
93
|
-
end #compile_stack_info
|
|
94
|
-
|
|
95
|
-
# create_ec2_instance
|
|
96
|
-
# Generates the Fog object and creates a new ec2 instance.
|
|
97
|
-
def create_ec2_instance
|
|
98
|
-
make_fog
|
|
99
|
-
start_new_instance
|
|
100
|
-
end #create_ec2_instance
|
|
101
|
-
|
|
102
|
-
# get_access_keys
|
|
103
|
-
# Retrieves the access key and secret access key from the above specified file.
|
|
104
|
-
def get_access_keys
|
|
80
|
+
def connect_to_amazon
|
|
105
81
|
lines = IO.readlines Constants::ACCESS_KEY_FILE
|
|
82
|
+
access_key = lines.first.strip.split("=")[1]
|
|
83
|
+
secret_access_key = lines.last.strip.split("=")[1]
|
|
84
|
+
|
|
85
|
+
Fog::Compute.new(:provider => 'AWS', :region => Constants::REGION,
|
|
86
|
+
:aws_access_key_id => access_key,
|
|
87
|
+
:aws_secret_access_key => secret_access_key)
|
|
88
|
+
end
|
|
106
89
|
|
|
107
|
-
@access_key = lines.first.strip.split("=")[1]
|
|
108
|
-
@secret_access_key = lines.last.strip.split("=")[1]
|
|
109
|
-
end #get_access_keys
|
|
110
|
-
|
|
111
|
-
# make_fog
|
|
112
|
-
# Generates the Fog object used to create the new ec2 instance.
|
|
113
|
-
def make_fog
|
|
114
|
-
get_access_keys
|
|
115
|
-
@fog = Fog::Compute.new(
|
|
116
|
-
:provider => 'AWS',
|
|
117
|
-
:region => Constants::REGION,
|
|
118
|
-
:aws_access_key_id => @access_key,
|
|
119
|
-
:aws_secret_access_key => @secret_access_key
|
|
120
|
-
)
|
|
121
|
-
end #make_fog
|
|
122
|
-
|
|
123
|
-
# start_new_instance
|
|
124
90
|
# Creates a new ec2 instance as per the given stack.
|
|
125
|
-
def start_new_instance
|
|
91
|
+
def start_new_instance(connection, params)
|
|
126
92
|
puts "Creating new instance..."
|
|
127
93
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
94
|
+
server = connection.servers.create(params)
|
|
95
|
+
# Wait for machine to be booted
|
|
96
|
+
server.wait_for { ready? }
|
|
97
|
+
# Wait for machine to get an ip-address
|
|
98
|
+
server.wait_for { !public_ip_address.nil? }
|
|
99
|
+
|
|
100
|
+
if server.ready?
|
|
132
101
|
# wait for all services to start on remote VM
|
|
133
102
|
puts "Waiting #{Constants::SLEEP} seconds for services to start on remote VM..."
|
|
134
103
|
Constants::SLEEP.times do
|
|
135
104
|
sleep 1
|
|
136
105
|
print "."
|
|
137
106
|
STDOUT.flush
|
|
138
|
-
end
|
|
107
|
+
end
|
|
139
108
|
puts
|
|
140
|
-
|
|
141
|
-
# save important instance information
|
|
142
|
-
@host = @server.dns_name
|
|
143
|
-
@server_id = @server.id
|
|
144
109
|
else
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
# establish_ssh_connection
|
|
151
|
-
# Establishes the ssh connection needed to issue commands to the remote machine.
|
|
152
|
-
def establish_ssh_connection
|
|
153
|
-
@ssh = Fog::SSH.new( @host, @user, :keys => Constants::SSH_KEY )
|
|
154
|
-
end #establish_ssh_connection
|
|
110
|
+
raise "Server timed out."
|
|
111
|
+
end
|
|
112
|
+
server
|
|
113
|
+
end
|
|
155
114
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
end #destroy_ec2_instance
|
|
162
|
-
|
|
163
|
-
# prepare_sources
|
|
164
|
-
# Prepares the remote machine's repo source list to be able to download rhoconnect
|
|
165
|
-
def prepare_sources
|
|
166
|
-
puts "preparing sources..."
|
|
167
|
-
|
|
168
|
-
ssh_cmd "sudo touch #{@dist[:repo_src_file]}" if @dist[:flavor] == 'centos'
|
|
169
|
-
filename = @dist[:repo_src_file]
|
|
170
|
-
src_str = @dist[:repo_str]
|
|
115
|
+
def install_package(server, distro_params)
|
|
116
|
+
puts "Preparing sources..."
|
|
117
|
+
run_on_server(server, "sudo touch #{distro_params[:repo_src_file]}") if distro_params[:flavor] == 'centos'
|
|
118
|
+
filename = distro_params[:repo_src_file]
|
|
119
|
+
src_str = distro_params[:repo_str]
|
|
171
120
|
|
|
172
121
|
# Create file for yum rhoconnect sources
|
|
173
122
|
# Get current permissions of file
|
|
174
|
-
perms =
|
|
175
|
-
|
|
123
|
+
perms = server.ssh("stat --format=%a #{filename}")[0].stdout.strip
|
|
176
124
|
# Change permissions so that it can be edited by "others"
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
#
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
125
|
+
cmds = ["sudo chmod 0666 #{filename}",
|
|
126
|
+
"echo -e \"#{src_str}\" >> #{filename}",
|
|
127
|
+
"sudo chmod 0#{perms} #{filename}"]
|
|
128
|
+
cmds << "sudo #{distro_params[:pkg_cmd]} update" unless distro_params[:flavor] == "centos"
|
|
129
|
+
run_on_server(server, cmds)
|
|
130
|
+
|
|
131
|
+
puts "Installing rhoconnect package.\nThis may take a while...\n\n"
|
|
132
|
+
run_on_server(server, "yes | sudo #{distro_params[:pkg_cmd]} install rhoconnect")
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def start_services(server)
|
|
136
|
+
puts
|
|
137
|
+
['redis', 'thin', 'nginx'].each do |program|
|
|
138
|
+
status = -1
|
|
139
|
+
3.times do
|
|
140
|
+
res = server.ssh("sudo /etc/init.d/#{program} start")
|
|
141
|
+
puts "$ #{res[0].command}"
|
|
142
|
+
puts res[0].stdout
|
|
143
|
+
status = server.ssh("pgrep -f #{program}")[0].status
|
|
144
|
+
break status == 0
|
|
145
|
+
sleep 3
|
|
146
|
+
end
|
|
147
|
+
raise "Service #{program} failed to start." if status != 0
|
|
148
|
+
end
|
|
199
149
|
puts
|
|
200
|
-
|
|
201
|
-
['Redis', 'Nginx', 'thin'].each do |program|
|
|
202
|
-
attempts = 0
|
|
203
|
-
while @ssh.run("pgrep -f #{program.downcase}")[0].stdout.strip == "" and
|
|
204
|
-
attempts < max_attempts
|
|
205
|
-
ssh_cmd "sudo /etc/init.d/#{program.downcase} start"
|
|
206
|
-
attempts += 1
|
|
207
|
-
sleep 2
|
|
208
|
-
end #while
|
|
209
|
-
if attempts >= max_attempts
|
|
210
|
-
puts "#{program} failed to start."
|
|
211
|
-
exit 1
|
|
212
|
-
else
|
|
213
|
-
puts "#{program} start took #{attempts} attempts." if attempts > 1
|
|
214
|
-
end #if
|
|
215
|
-
puts
|
|
216
|
-
end #do
|
|
217
|
-
end # start_servers
|
|
150
|
+
end
|
|
218
151
|
|
|
219
|
-
# check_rc_service
|
|
220
152
|
# Makes an HTTP request to check that the rhoconnect service is working
|
|
221
|
-
def
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
puts "Code: #{request.code} Message: #{request.message}"
|
|
231
|
-
|
|
232
|
-
if request.code.to_s < '400'
|
|
233
|
-
puts "Rhoconnect service up!"
|
|
234
|
-
else
|
|
235
|
-
puts "Failed to connect to rhoconnect service."
|
|
236
|
-
exit 13
|
|
237
|
-
end #if
|
|
238
|
-
end #check_rc_service
|
|
239
|
-
|
|
240
|
-
# compute_time
|
|
241
|
-
# General time computation method
|
|
242
|
-
def compute_time(start_time, end_time)
|
|
243
|
-
time_delta = (end_time - start_time).round 3
|
|
244
|
-
|
|
245
|
-
if time_delta >= 60
|
|
246
|
-
time_delta /= 60
|
|
247
|
-
time_units = 'minute'
|
|
248
|
-
if time_delta > 1
|
|
249
|
-
time_units << 's'
|
|
250
|
-
end #if
|
|
153
|
+
def check_rhoconnect_status(server)
|
|
154
|
+
host = server.dns_name
|
|
155
|
+
puts "Testing rhoconnect server on host #{host}"
|
|
156
|
+
uri = URI("http://#{host}/console/")
|
|
157
|
+
response = Net::HTTP.get_response(uri)
|
|
158
|
+
puts "#{response.code} #{response.message}"
|
|
159
|
+
resp_code = response.code.to_i
|
|
160
|
+
if resp_code < 400
|
|
161
|
+
puts "Rhoconnect server up and running!"; puts
|
|
251
162
|
else
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
163
|
+
puts "Nginx error log:"
|
|
164
|
+
puts server.ssh('cat /opt/nginx/logs/error.log')[0].stdout
|
|
165
|
+
puts "Thin server logs:"
|
|
166
|
+
puts server.ssh('cat /var/log/thin/thin.0.log')[0].stdout
|
|
167
|
+
puts server.ssh('cat /var/log/thin/thin.1.log')[0].stdout
|
|
168
|
+
raise "Failed to connect to rhoconnect service on #{host}" # unless resp_code == 502
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def ping_remote_host(server)
|
|
173
|
+
status = -1
|
|
174
|
+
10.times do
|
|
175
|
+
begin
|
|
176
|
+
res = server.ssh(['uptime'])
|
|
177
|
+
status = res[0].status
|
|
178
|
+
break if status == 0
|
|
179
|
+
rescue Exception => e
|
|
180
|
+
sleep 6
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
status
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def test_package(connection, stack)
|
|
262
187
|
start_time = Time.now
|
|
263
188
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
puts
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
189
|
+
user, distro_params = compile_stack_info(stack)
|
|
190
|
+
server = start_new_instance(connection, stack)
|
|
191
|
+
host = server.dns_name
|
|
192
|
+
puts "Remote host #{host} is up and running ..."
|
|
193
|
+
|
|
194
|
+
server.username = user
|
|
195
|
+
server.private_key_path = Constants::SSH_KEY
|
|
196
|
+
puts "Establish ssh connection for \"#{user}@#{host}\" ..."
|
|
197
|
+
# For a minute trying to reach remote host
|
|
198
|
+
raise "Cannot establish ssh connection with #{stack[:tags]['Name']} instance." if ping_remote_host(server) != 0
|
|
199
|
+
puts "SSH connection establised!"
|
|
200
|
+
|
|
201
|
+
install_package(server, distro_params)
|
|
202
|
+
# Start the redis and nginx servers on the remote machine
|
|
203
|
+
start_services(server)
|
|
204
|
+
# Check the status of the rhoconnect service
|
|
205
|
+
check_rhoconnect_status(server)
|
|
206
|
+
|
|
207
|
+
elapsed_time = (Time.now - start_time).to_i
|
|
208
|
+
puts "Test for #{stack[:tags]['Name']} completed in #{elapsed_time/60} min. #{elapsed_time - ((elapsed_time/60)*60)} sec."
|
|
209
|
+
0
|
|
210
|
+
rescue => e
|
|
211
|
+
puts e.inspect
|
|
212
|
+
puts e.backtrace
|
|
213
|
+
-1
|
|
214
|
+
ensure
|
|
215
|
+
if server
|
|
216
|
+
puts "Terminating #{stack[:tags]['Name']} instance ..."
|
|
217
|
+
server.destroy
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
module ThreadOut
|
|
222
|
+
# Writes to Thread.current[:stdout] instead of STDOUT if the thread local is set.
|
|
223
|
+
def self.write(stuff)
|
|
224
|
+
if Thread.current[:stdout] then
|
|
225
|
+
Thread.current[:stdout].write stuff
|
|
226
|
+
else
|
|
227
|
+
STDOUT.write stuff
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
# Connect to Amamzon EC2 cloud
|
|
233
|
+
start_at = Time.now
|
|
234
|
+
connection = connect_to_amazon
|
|
235
|
+
|
|
236
|
+
# Redirect stdout
|
|
237
|
+
$stdout = ThreadOut
|
|
238
|
+
|
|
239
|
+
# Create logs and threads
|
|
240
|
+
logs = []
|
|
241
|
+
threads = []
|
|
242
|
+
STACK_SIZE.times do |i|
|
|
243
|
+
logs << StringIO.new
|
|
244
|
+
threads << Thread.new(i) do |idx|
|
|
245
|
+
puts "Starting test for #{STACKS[idx][:tags]['Name']} ... "
|
|
246
|
+
Thread.current[:stdout] = logs[idx]
|
|
247
|
+
test_package(connection, STACKS[idx])
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
# Wait till threads re finished
|
|
251
|
+
threads.each { |thread| thread.join }
|
|
252
|
+
|
|
253
|
+
# Output logs and check resluts
|
|
254
|
+
threads.each_with_index do |thread, i|
|
|
255
|
+
puts "\n#{STACKS[i][:tags]['Name']} installation log:"
|
|
256
|
+
puts logs[i].string
|
|
257
|
+
end
|
|
258
|
+
exit_code = 0
|
|
259
|
+
threads.each_with_index do |thread, i|
|
|
260
|
+
if thread.value != 0
|
|
261
|
+
puts "Package for #{STACKS[i][:tags]['Name']} failed to pass test!"
|
|
262
|
+
exit_code = -1
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
elapsed_time = (Time.now - start_at).to_i
|
|
267
|
+
puts "Elapsed time: #{elapsed_time/60} min. #{elapsed_time - ((elapsed_time/60)*60)} sec."
|
|
268
|
+
|
|
269
|
+
exit exit_code
|
data/lib/rhoconnect/version.rb
CHANGED
|
@@ -3,27 +3,27 @@ require 'erb'
|
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'rhoconnect/graph_helper'
|
|
5
5
|
|
|
6
|
-
module RhoconnectConsole
|
|
6
|
+
module RhoconnectConsole
|
|
7
7
|
class << self
|
|
8
8
|
ROOT_DIR = File.dirname(File.expand_path(__FILE__)) unless defined? ROOT_DIR
|
|
9
9
|
def root_path(*args)
|
|
10
10
|
File.join(ROOT_DIR, *args)
|
|
11
11
|
end
|
|
12
|
-
end
|
|
12
|
+
end
|
|
13
13
|
|
|
14
14
|
class Server < Sinatra::Base
|
|
15
15
|
set :views, RhoconnectConsole.root_path('templates')
|
|
16
16
|
set :public_folder, RhoconnectConsole.root_path
|
|
17
|
-
set :static, true
|
|
18
|
-
use Rack::Session::Cookie
|
|
17
|
+
set :static, true
|
|
18
|
+
use Rack::Session::Cookie, :key => 'rhoconnect.console', :secret => SecureRandom.hex(64)
|
|
19
19
|
HEROKU_NAV = ENV['INSTANCE_ID'] ? RestClient.get('http://nav.heroku.com/v1/providers/header') : nil
|
|
20
20
|
before do
|
|
21
21
|
headers['Expires'] = 'Sun, 19 Nov 1978 05:00:00 GMT'
|
|
22
|
-
headers['Cache-Control'] = 'no-store, no-cache, must-revalidate'
|
|
22
|
+
headers['Cache-Control'] = 'no-store, no-cache, must-revalidate'
|
|
23
23
|
headers['Pragma'] = 'no-cache'
|
|
24
24
|
end
|
|
25
25
|
include GraphHelper
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
get '/' do
|
|
28
28
|
#if heroku instance single sign will already have logged in a have token in session
|
|
29
29
|
@token = session[:token] if ENV['INSTANCE_ID']
|
|
@@ -45,7 +45,7 @@ module RhoconnectConsole
|
|
|
45
45
|
post '/http_timing' do
|
|
46
46
|
http_timing(params)
|
|
47
47
|
end
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
post '/http_timing_key' do
|
|
50
50
|
http_timing_key(params)
|
|
51
51
|
end
|
|
@@ -53,16 +53,16 @@ module RhoconnectConsole
|
|
|
53
53
|
post '/device_count' do
|
|
54
54
|
count_graph('timing/devicecount', "Device Count", "Devices", "clients")
|
|
55
55
|
end
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
get '/get_sources' do
|
|
58
58
|
sources = App.load(APP_NAME).sources
|
|
59
59
|
sources.to_json
|
|
60
60
|
end
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
get '/get_http_routes' do
|
|
63
63
|
# keys = get_user_count("http:*:*")
|
|
64
64
|
# sources = get_sources('all')
|
|
65
|
-
#
|
|
65
|
+
#
|
|
66
66
|
# #loop through arrays and remove any regex matches
|
|
67
67
|
# keysf = keys.inject([]) do |keys_final, element|
|
|
68
68
|
# found = true
|
|
@@ -72,11 +72,11 @@ module RhoconnectConsole
|
|
|
72
72
|
# keys_final << element.strip if found
|
|
73
73
|
# keys_final
|
|
74
74
|
# end
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
keysf = get_http_routes()
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
keysf.to_json
|
|
79
79
|
end
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
end
|
|
82
82
|
end
|
data/rhoconnect.gemspec
CHANGED
|
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
|
|
|
14
14
|
s.description = %q{RhoConnect App Integration Server and related command-line utilities}
|
|
15
15
|
|
|
16
16
|
s.rubyforge_project = nil
|
|
17
|
-
|
|
18
|
-
s.files = %w(
|
|
19
|
-
CHANGELOG.md CREDITS Gemfile Gemfile.lock install.sh README.md Rakefile LICENSE Rakefile rhoconnect.gemspec
|
|
17
|
+
|
|
18
|
+
s.files = %w(
|
|
19
|
+
CHANGELOG.md CREDITS Gemfile Gemfile.lock install.sh README.md Rakefile LICENSE Rakefile rhoconnect.gemspec
|
|
20
20
|
)
|
|
21
21
|
s.files += Dir.glob("bench/**/*")
|
|
22
22
|
s.files += Dir.glob("commands/**/*")
|
|
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
|
|
|
42
42
|
s.add_dependency("rack", '~> 1.5.2')
|
|
43
43
|
s.add_dependency("sinatra", '~> 1.3')
|
|
44
44
|
s.add_dependency('rake', '~> 0.9.2.2')
|
|
45
|
-
s.add_dependency('json', '~> 1.
|
|
45
|
+
s.add_dependency('json', '~> 1.7.7')
|
|
46
46
|
s.add_dependency('rubyzip', '~> 0.9.4')
|
|
47
47
|
s.add_dependency('uuidtools', '>= 2.1.1')
|
|
48
48
|
# Locked 'connection_pool' version because latest releases (>= 0.9.3) not compatible with MRI 1.8.7
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rhoconnect
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.4.
|
|
4
|
+
version: 3.4.5
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-05-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -82,7 +82,7 @@ dependencies:
|
|
|
82
82
|
requirements:
|
|
83
83
|
- - ~>
|
|
84
84
|
- !ruby/object:Gem::Version
|
|
85
|
-
version: 1.
|
|
85
|
+
version: 1.7.7
|
|
86
86
|
type: :runtime
|
|
87
87
|
prerelease: false
|
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -90,7 +90,7 @@ dependencies:
|
|
|
90
90
|
requirements:
|
|
91
91
|
- - ~>
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
|
-
version: 1.
|
|
93
|
+
version: 1.7.7
|
|
94
94
|
- !ruby/object:Gem::Dependency
|
|
95
95
|
name: rubyzip
|
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -734,7 +734,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
734
734
|
version: '0'
|
|
735
735
|
segments:
|
|
736
736
|
- 0
|
|
737
|
-
hash: -
|
|
737
|
+
hash: -3406822103563071743
|
|
738
738
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
739
739
|
none: false
|
|
740
740
|
requirements:
|