simple_perf 0.0.9 → 0.0.10
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/lib/simple_perf/cli/{deploy_gatling.rb → deploy.rb} +7 -7
- data/lib/simple_perf/cli/shared.rb +1 -1
- data/lib/simple_perf/cli.rb +5 -8
- data/lib/simple_perf/cloud_formation_templates/instance_group.json +2 -2
- data/lib/simple_perf/cloud_formation_templates/instance_group_gatling.json +1 -1
- data/lib/simple_perf/version.rb +1 -1
- metadata +3 -4
- data/lib/simple_perf/cli/deploy_jmeter.rb +0 -90
@@ -3,7 +3,7 @@ require 'aws-sdk'
|
|
3
3
|
|
4
4
|
module SimplePerf
|
5
5
|
module CLI
|
6
|
-
class
|
6
|
+
class Deploy
|
7
7
|
include Shared
|
8
8
|
|
9
9
|
def execute
|
@@ -11,10 +11,10 @@ module SimplePerf
|
|
11
11
|
version SimplePerf::VERSION
|
12
12
|
banner <<-EOS
|
13
13
|
|
14
|
-
Deploys
|
14
|
+
Deploys test assets (local directory) to EC2 simple_perf instances.
|
15
15
|
|
16
16
|
Usage:
|
17
|
-
simple_perf
|
17
|
+
simple_perf deploy -e ENVIRONMENT -p PROJECT_NAME
|
18
18
|
EOS
|
19
19
|
opt :help, "Display Help"
|
20
20
|
opt :environment, "Set the target environment", :type => :string
|
@@ -23,9 +23,9 @@ EOS
|
|
23
23
|
Trollop::die :environment, "is required but not specified" unless opts[:environment]
|
24
24
|
Trollop::die :project, "is required but not specified" unless opts[:project]
|
25
25
|
|
26
|
-
file_name = '
|
26
|
+
file_name = 'test-files.tar.gz'
|
27
27
|
|
28
|
-
`#{'
|
28
|
+
`#{'tar -cvzf ' + file_name + ' --exclude="gatling.sh" *'}`
|
29
29
|
|
30
30
|
config = Config.new.environment opts[:environment]
|
31
31
|
|
@@ -72,7 +72,7 @@ EOS
|
|
72
72
|
command = 'simple_deploy execute' +
|
73
73
|
' -e ' + opts[:environment] +
|
74
74
|
' -n ' + 'simple-perf-' + opts[:project] +
|
75
|
-
' -c "~/
|
75
|
+
' -c "~/sync_test_files.sh"' +
|
76
76
|
' -l debug'
|
77
77
|
|
78
78
|
Shared::pretty_print `#{command}`
|
@@ -80,7 +80,7 @@ EOS
|
|
80
80
|
command = 'simple_deploy execute' +
|
81
81
|
' -e ' + opts[:environment] +
|
82
82
|
' -n ' + 'simple-perf-' + opts[:project] +
|
83
|
-
' -c "cd ~/simple_perf_test_files; tar
|
83
|
+
' -c "cd ~/simple_perf_test_files; tar -xzvf "' + file_name +
|
84
84
|
' -l debug'
|
85
85
|
|
86
86
|
Shared::pretty_print `#{command}`
|
data/lib/simple_perf/cli.rb
CHANGED
@@ -11,8 +11,7 @@ require 'simple_perf/cli/chaos'
|
|
11
11
|
require 'simple_perf/cli/create_bucket'
|
12
12
|
require 'simple_perf/cli/create_jmeter'
|
13
13
|
require 'simple_perf/cli/create_gatling'
|
14
|
-
require 'simple_perf/cli/
|
15
|
-
require 'simple_perf/cli/deploy_gatling'
|
14
|
+
require 'simple_perf/cli/deploy'
|
16
15
|
require 'simple_perf/cli/start_jmeter'
|
17
16
|
require 'simple_perf/cli/start_gatling'
|
18
17
|
require 'simple_perf/cli/start_custom'
|
@@ -31,10 +30,8 @@ module SimplePerf
|
|
31
30
|
CLI::StartCustom.new.execute
|
32
31
|
when 'stop'
|
33
32
|
CLI::Stop.new.execute
|
34
|
-
when '
|
35
|
-
CLI::
|
36
|
-
when 'deploy_gatling'
|
37
|
-
CLI::DeployGatling.new.execute
|
33
|
+
when 'deploy'
|
34
|
+
CLI::Deploy.new.execute
|
38
35
|
when 'create_jmeter'
|
39
36
|
CLI::CreateJmeter.new.execute
|
40
37
|
when 'create_gatling'
|
@@ -52,13 +49,13 @@ module SimplePerf
|
|
52
49
|
when 'chaos'
|
53
50
|
CLI::Chaos.new.execute
|
54
51
|
when '-h'
|
55
|
-
puts "simple_perf [start_jmeter|start_gatling|start_custom|stop|
|
52
|
+
puts "simple_perf [start_jmeter|start_gatling|start_custom|stop|deploy|create_jmeter|create_gatling|create_bucket|destroy|status|results|update|chaos] [options]"
|
56
53
|
puts "Append -h for help on specific subcommand."
|
57
54
|
when '-v'
|
58
55
|
puts SimplePerf::VERSION
|
59
56
|
else
|
60
57
|
puts "Unknown command: '#{cmd}'."
|
61
|
-
puts "simple_perf [start_jmeter|start_gatling|start_custom|stop|
|
58
|
+
puts "simple_perf [start_jmeter|start_gatling|start_custom|stop|deploy|create_jmeter|create_gatling|create_bucket|destroy|status|results|update|chaos] [options]"
|
62
59
|
puts "Append -h for help on specific subcommand."
|
63
60
|
exit 1
|
64
61
|
end
|
@@ -217,7 +217,7 @@
|
|
217
217
|
"mode": "000644"
|
218
218
|
},
|
219
219
|
|
220
|
-
"/home/ec2-user/
|
220
|
+
"/home/ec2-user/sync_test_files.sh": {
|
221
221
|
"content": { "Fn::Join": [ "", [ "#!/bin/bash", "\n",
|
222
222
|
"mkdir -p ~/simple_perf_test_files", "\n",
|
223
223
|
"cd ~/simple_perf_test_files", "\n",
|
@@ -262,7 +262,7 @@
|
|
262
262
|
" --access-key=", { "Ref": "UserKey" },
|
263
263
|
" --secret-key=", { "Fn::GetAtt": ["UserKey", "SecretAccessKey"] }, "\n",
|
264
264
|
|
265
|
-
"runuser -c \"~/
|
265
|
+
"runuser -c \"~/sync_test_files.sh\" ec2-user", "\n",
|
266
266
|
|
267
267
|
"/opt/aws/bin/cfn-signal -e ",
|
268
268
|
{ "Fn::FindInMap": [ "BootstrapSettingMap", "abort", { "Ref": "Abort" } ] },
|
@@ -193,7 +193,7 @@
|
|
193
193
|
|
194
194
|
"files": {
|
195
195
|
|
196
|
-
"/home/ec2-user/
|
196
|
+
"/home/ec2-user/sync_test_files.sh": {
|
197
197
|
"content": { "Fn::Join": [ "", [ "#!/bin/bash", "\n",
|
198
198
|
"mkdir -p ~/simple_perf_test_files", "\n",
|
199
199
|
"cd ~/simple_perf_test_files", "\n",
|
data/lib/simple_perf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_perf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
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-10-
|
12
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -114,8 +114,7 @@ files:
|
|
114
114
|
- lib/simple_perf/cli/create_bucket.rb
|
115
115
|
- lib/simple_perf/cli/create_gatling.rb
|
116
116
|
- lib/simple_perf/cli/create_jmeter.rb
|
117
|
-
- lib/simple_perf/cli/
|
118
|
-
- lib/simple_perf/cli/deploy_jmeter.rb
|
117
|
+
- lib/simple_perf/cli/deploy.rb
|
119
118
|
- lib/simple_perf/cli/destroy.rb
|
120
119
|
- lib/simple_perf/cli/results.rb
|
121
120
|
- lib/simple_perf/cli/shared.rb
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'trollop'
|
2
|
-
require 'aws-sdk'
|
3
|
-
|
4
|
-
module SimplePerf
|
5
|
-
module CLI
|
6
|
-
class DeployJmeter
|
7
|
-
include Shared
|
8
|
-
|
9
|
-
def execute
|
10
|
-
opts = Trollop::options do
|
11
|
-
version SimplePerf::VERSION
|
12
|
-
banner <<-EOS
|
13
|
-
|
14
|
-
Deploys jmeter test assets (csv's and jmx) to EC2 jmeter instances.
|
15
|
-
|
16
|
-
Usage:
|
17
|
-
simple_perf deploy -e ENVIRONMENT -p PROJECT_NAME
|
18
|
-
EOS
|
19
|
-
opt :help, "Display Help"
|
20
|
-
opt :environment, "Set the target environment", :type => :string
|
21
|
-
opt :project, "Project name to manage", :type => :string
|
22
|
-
end
|
23
|
-
Trollop::die :environment, "is required but not specified" unless opts[:environment]
|
24
|
-
Trollop::die :project, "is required but not specified" unless opts[:project]
|
25
|
-
|
26
|
-
file_name = 'test.zip'
|
27
|
-
|
28
|
-
`#{'zip ' + file_name + ' *'}`
|
29
|
-
|
30
|
-
config = Config.new.environment opts[:environment]
|
31
|
-
|
32
|
-
ENV['SIMPLE_DEPLOY_SSH_KEY'] = config['local_pem']
|
33
|
-
ENV['SIMPLE_DEPLOY_SSH_USER'] = config['user']
|
34
|
-
|
35
|
-
AWS.config(
|
36
|
-
:access_key_id => config['access_key'],
|
37
|
-
:secret_access_key => config['secret_key'])
|
38
|
-
|
39
|
-
command = 'simple_deploy list' +
|
40
|
-
' -e ' + opts[:environment] +
|
41
|
-
' | grep ' + opts[:project] + '-s3'
|
42
|
-
bucket_stack = `#{command}`
|
43
|
-
|
44
|
-
command = 'simple_deploy outputs' +
|
45
|
-
' -e ' + opts[:environment] +
|
46
|
-
' -n ' + bucket_stack
|
47
|
-
bucket_name = `#{command}`
|
48
|
-
bucket_name = bucket_name.split(' ')[1]
|
49
|
-
|
50
|
-
if(config['region'] == 'us-east-1')
|
51
|
-
s3_endpoint = 's3.amazonaws.com'
|
52
|
-
else
|
53
|
-
s3_endpoint = "s3-#{config['region']}.amazonaws.com"
|
54
|
-
end
|
55
|
-
|
56
|
-
s3 = AWS::S3.new(:s3_endpoint => s3_endpoint)
|
57
|
-
|
58
|
-
# create a bucket
|
59
|
-
#b = s3.buckets.create(bucket_name)
|
60
|
-
|
61
|
-
# use existing s3 bucket
|
62
|
-
b = s3.buckets[bucket_name] # no request made
|
63
|
-
|
64
|
-
# upload a file
|
65
|
-
basename = File.basename(file_name)
|
66
|
-
o = b.objects[basename]
|
67
|
-
o.write(:file => file_name)
|
68
|
-
|
69
|
-
puts "Uploaded #{file_name} to:"
|
70
|
-
puts o.public_url
|
71
|
-
|
72
|
-
command = 'simple_deploy execute' +
|
73
|
-
' -e ' + opts[:environment] +
|
74
|
-
' -n ' + 'simple-perf-' + opts[:project] +
|
75
|
-
' -c "~/sync_jmeter_files.sh"' +
|
76
|
-
' -l debug'
|
77
|
-
|
78
|
-
Shared::pretty_print `#{command}`
|
79
|
-
|
80
|
-
command = 'simple_deploy execute' +
|
81
|
-
' -e ' + opts[:environment] +
|
82
|
-
' -n ' + 'simple-perf-' + opts[:project] +
|
83
|
-
' -c "cd ~/simple_perf_test_files; unzip -o "' + file_name +
|
84
|
-
' -l debug'
|
85
|
-
|
86
|
-
Shared::pretty_print `#{command}`
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|