sumomo 0.8.9 → 0.8.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/sumomo +2 -2
- data/lib/sumomo.rb +10 -2
- data/lib/sumomo/ec2.rb +9 -6
- data/lib/sumomo/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44594639cdb423778a130d3debb64caa315d70a6a983a4a5b5fb7b6ed67793f5
|
4
|
+
data.tar.gz: 7f6bfa09705119de6682275516395b89362b50aa491e5e48ee64709cd55c8e17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a336692e9a46532499c5bb4c64dcab1a8c0e485dba942090c707f07dae3c888c542d93a7e012187dae0013d564c1348e6e17061fb4e394a302aea4833c78ce0b
|
7
|
+
data.tar.gz: 85927305c489ef72b87a271caddde2fd09696a9dee63f2bbbbd96724f587238195458080285820868a1d2df8f7fdfb73d8dfce3e4689cdb9865349374b559634
|
data/exe/sumomo
CHANGED
@@ -34,7 +34,7 @@ cmd_opts = case cmd
|
|
34
34
|
local_opts = Trollop.options do
|
35
35
|
opt :filename, 'File that describes the stack', type: :string, default: 'Sumomofile'
|
36
36
|
end
|
37
|
-
Sumomo.
|
37
|
+
Sumomo.send("#{cmd}_stack", name: ARGV[0], region: global_opts[:region]) do
|
38
38
|
proc = proc {}
|
39
39
|
eval File.read(local_opts[:filename]), proc.binding, local_opts[:filename]
|
40
40
|
end
|
@@ -49,7 +49,7 @@ cmd_opts = case cmd
|
|
49
49
|
key = JSON.parse(File.read('x.txt'))['value']
|
50
50
|
File.write('key.pem', key)
|
51
51
|
`chmod 0600 key.pem`
|
52
|
-
exec "ssh -i 'key.pem' ec2-user@#{ARGV[1]}"
|
52
|
+
exec "ssh -i 'key.pem' ec2-user@#{ARGV[1]} #{ARGV[2]}"
|
53
53
|
|
54
54
|
when 'testapi'
|
55
55
|
local_opts = Trollop.options do
|
data/lib/sumomo.rb
CHANGED
@@ -26,6 +26,16 @@ module Sumomo
|
|
26
26
|
"cloudformation/#{make_master_key_name(name: name)}.pem"
|
27
27
|
end
|
28
28
|
|
29
|
+
def self.create_stack(name:, region:, sns_arn: nil, &block)
|
30
|
+
cf = Aws::CloudFormation::Client.new(region: region)
|
31
|
+
begin
|
32
|
+
cf.describe_stacks(stack_name: name)
|
33
|
+
raise "There is already a stack named '#{name}'"
|
34
|
+
rescue Aws::CloudFormation::Errors::ValidationError
|
35
|
+
update_stack(name: name, region: region, sns_arn: sns_arn, &block)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
29
39
|
def self.update_stack(name:, region:, sns_arn: nil, &block)
|
30
40
|
cf = Aws::CloudFormation::Client.new(region: region)
|
31
41
|
s3 = Aws::S3::Client.new(region: region)
|
@@ -249,6 +259,4 @@ module Sumomo
|
|
249
259
|
|
250
260
|
map
|
251
261
|
end
|
252
|
-
|
253
|
-
singleton_class.send(:alias_method, :create_stack, :update_stack)
|
254
262
|
end
|
data/lib/sumomo/ec2.rb
CHANGED
@@ -254,6 +254,7 @@ module Sumomo
|
|
254
254
|
has_public_ips: true,
|
255
255
|
ingress: nil,
|
256
256
|
egress: nil,
|
257
|
+
security_groups: [],
|
257
258
|
machine_tag: nil,
|
258
259
|
ec2_sns_arn: nil,
|
259
260
|
ami_name: nil,
|
@@ -297,10 +298,12 @@ module Sumomo
|
|
297
298
|
|
298
299
|
bucket_name = @bucket_name
|
299
300
|
|
300
|
-
|
301
|
+
script_arr = [script]
|
302
|
+
|
303
|
+
script_arr << task_script
|
301
304
|
|
302
305
|
if ecs_cluster
|
303
|
-
|
306
|
+
script_arr << <<~ECS_START
|
304
307
|
|
305
308
|
yum update
|
306
309
|
yum groupinstall "Development Tools"
|
@@ -318,12 +321,12 @@ module Sumomo
|
|
318
321
|
end
|
319
322
|
|
320
323
|
if eip
|
321
|
-
|
324
|
+
script_arr << <<~EIP_ALLOCATE
|
322
325
|
aws ec2 associate-address --region `cat /etc/aws_region` --instance-id `curl http://169.254.169.254/latest/meta-data/instance-id` --allocation-id `cat /etc/eip_allocation_id`
|
323
326
|
EIP_ALLOCATE
|
324
327
|
end
|
325
328
|
|
326
|
-
|
329
|
+
script_arr << "service spot-watcher start" if(spot_price && ec2_sns_arn)
|
327
330
|
|
328
331
|
unless ingress.is_a? Array
|
329
332
|
raise 'ec2: ingress option needs to be an array'
|
@@ -339,7 +342,7 @@ module Sumomo
|
|
339
342
|
|
340
343
|
wait_handle = make 'AWS::CloudFormation::WaitConditionHandle'
|
341
344
|
|
342
|
-
user_data = initscript(wait_handle, name,
|
345
|
+
user_data = initscript(wait_handle, name, call('Fn::Join', "\n", script_arr))
|
343
346
|
|
344
347
|
role_policy_doc = {
|
345
348
|
'Version' => '2012-10-17',
|
@@ -407,7 +410,7 @@ module Sumomo
|
|
407
410
|
launch_config = make 'AWS::AutoScaling::LaunchConfiguration' do
|
408
411
|
AssociatePublicIpAddress has_public_ips
|
409
412
|
KeyName keypair
|
410
|
-
SecurityGroups [web_sec_group]
|
413
|
+
SecurityGroups [web_sec_group] + security_groups
|
411
414
|
ImageId ami_name
|
412
415
|
UserData user_data
|
413
416
|
InstanceType type
|
data/lib/sumomo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sumomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Siaw
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -2548,7 +2548,7 @@ homepage: https://github.com/davidsiaw/sumomo
|
|
2548
2548
|
licenses: []
|
2549
2549
|
metadata:
|
2550
2550
|
allowed_push_host: https://rubygems.org
|
2551
|
-
post_install_message:
|
2551
|
+
post_install_message:
|
2552
2552
|
rdoc_options: []
|
2553
2553
|
require_paths:
|
2554
2554
|
- lib
|
@@ -2563,8 +2563,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
2563
2563
|
- !ruby/object:Gem::Version
|
2564
2564
|
version: '0'
|
2565
2565
|
requirements: []
|
2566
|
-
rubygems_version: 3.
|
2567
|
-
signing_key:
|
2566
|
+
rubygems_version: 3.1.2
|
2567
|
+
signing_key:
|
2568
2568
|
specification_version: 4
|
2569
2569
|
summary: An advanced infrastructure description language for AWS
|
2570
2570
|
test_files: []
|