openstudio-aws 0.5.0.pre.rc10 → 0.5.0.rc0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de6c544860e89bb1aa21c31c2a1080e39e4c05f1
4
- data.tar.gz: 0ccece11b3414a692798053a86405b4911a39968
3
+ metadata.gz: f25ae1f2fffef1ff271532785c98876ca3537a49
4
+ data.tar.gz: 33d4ffb87da5ec343c439792f2c92313860ee44c
5
5
  SHA512:
6
- metadata.gz: 456278c94c96aef2e226cef7d942ce085e6108a7e798a676ba87c94102069e8b36fcf0bd0771fa3760c9292f658588a6aa069df38495a7d2882fdb05c04631c5
7
- data.tar.gz: d4ab0350dfb8bcc640b0d8cb959493292678436f424bef60130d0c997ef4d854b7764892fcd28236b0bf88b6d71129a45696e14f1a1b78f4f5a64386aa49cbd5
6
+ metadata.gz: 5372a36a082bf5a83462debb6773cfaa3d2acba5a53e22125278a8b7144141f90b3bc977386c437761435743489d62dd2eead6a603e33c613674606579735449
7
+ data.tar.gz: f1f2769a3ef6d21d5722a543a572e73088ae8638c205fb1574fed894bf862ba1635365aa277176daa88708c87f5563eba7691a395d9ad92773d09ad3831d0ec8
@@ -162,8 +162,8 @@ module OpenStudio
162
162
  end
163
163
 
164
164
  if options[:security_groups].empty?
165
- # if the user has not specified any security groups, then create one called: 'openstudio-server-sg-v2'
166
- @os_aws.create_or_retrieve_default_security_group(tmp_name = 'openstudio-server-sg-v2.2',
165
+ # if the user has not specified any security groups, then create one called: 'openstudio-server-sg-v1'
166
+ @os_aws.create_or_retrieve_default_security_group(tmp_name = 'openstudio-server-sg-v2.1',
167
167
  vpc_id=options[:vpc_id])
168
168
  else
169
169
  @os_aws.security_groups = options[:security_groups]
@@ -180,18 +180,13 @@ module OpenStudio
180
180
  @os_aws.save_private_key @save_directory
181
181
  end
182
182
 
183
- user_data_file = @dockerized ? 'server_script.sh.docker.template' : 'server_script.sh.template'
184
-
185
183
  server_options = {
186
184
  user_id: options[:user_id],
187
185
  tags: options[:tags],
188
186
  subnet_id: options[:subnet_id],
189
- associate_public_ip_address: options[:associate_public_ip_address],
190
- user_data_file: user_data_file
187
+ associate_public_ip_address: options[:associate_public_ip_address]
191
188
  }
192
189
 
193
- server_options[:availability_zone] = options[:availability_zone] if options[:availability_zone]
194
-
195
190
  # save the worker pem and public to the directory
196
191
  # presently, this will always overwrite the worker key, is that okay? Is this really needed later?
197
192
  @os_aws.save_worker_keys @save_directory
@@ -233,15 +228,13 @@ module OpenStudio
233
228
  end
234
229
 
235
230
  fail "Can't create workers without a server instance running" if @os_aws.server.nil?
236
- user_data_file = @dockerized ? 'worker_script.sh.docker.template' : 'worker_script.sh.template'
237
231
 
238
232
  unless number_of_instances == 0
239
233
  worker_options = {
240
234
  user_id: options[:user_id],
241
235
  tags: options[:tags],
242
236
  subnet_id: options[:subnet_id],
243
- associate_public_ip_address: options[:associate_public_ip_address],
244
- user_data_file: user_data_file
237
+ associate_public_ip_address: options[:associate_public_ip_address]
245
238
  }
246
239
 
247
240
  # if options[:ebs_volume_size]
@@ -253,15 +246,8 @@ module OpenStudio
253
246
 
254
247
  logger.info 'Waiting for server/worker configurations'
255
248
 
256
- begin
257
- if @dockerized
258
- @os_aws.configure_swarm_cluster(@save_directory)
259
- else
260
- @os_aws.configure_server_and_workers
261
- end
262
- rescue => e
263
- fail "Configuring the cluster failed with error `#{e.message}` in:\n#{e.backtrace.join('\n')}"
264
- end
249
+ return @os_aws.configure_server_and_workers unless @dockerized
250
+ @os_aws.configure_swarm_cluster if @dockerized
265
251
  end
266
252
 
267
253
  # Write out to the terminal the connection information for the servers and workers
@@ -1,5 +1,5 @@
1
1
  module OpenStudio
2
2
  module Aws
3
- VERSION = '0.5.0-rc10'
3
+ VERSION = '0.5.0.rc0'
4
4
  end
5
5
  end
@@ -179,24 +179,20 @@ class OpenStudioAmis
179
179
  # Return the required docker AMI base box
180
180
  def get_ami_version_3
181
181
  json = list
182
- amis = nil
182
+ amis = {}
183
183
  if @options[:openstudio_version].to_sym == :default && @options[:openstudio_server_version].to_sym == :default
184
184
  # grab the most recent openstudio server version - this is not recommended
185
- value = json[:builds].first
186
- amis = {}
185
+ key, value = json[:openstudio_server].first
187
186
  amis[:server] = value[:ami]
188
187
  amis[:worker] = value[:ami]
189
188
  elsif @options[:openstudio_server_version] != 'default'
190
- hash_array = json[:builds]
191
- hash = hash_array.select { |hash| hash[:name] == @options[:openstudio_server_version] }
192
- fail "Multiple | no entries found matching name key `#{@options[:openstudio_server_version]}`" unless hash.length == 1
193
- amis = {}
194
- amis[:server] = hash.first[:ami]
195
- amis[:worker] = hash.first[:ami]
189
+ value = json[:openstudio_server][@options[:openstudio_server_version].to_sym]
190
+ amis[:server] = value[:ami]
191
+ amis[:worker] = value[:ami]
196
192
  elsif @options[:openstudio_version] != 'default'
197
193
  fail 'Currently the openstudio_version lookup is not supported in v3.'
198
194
  end
199
- fail 'The requested AMI key is NULL.' if amis[:server] == nil
195
+
200
196
  logger.info "AMI IDs are #{amis}" if amis
201
197
 
202
198
  amis
@@ -170,7 +170,7 @@ class OpenStudioAwsInstance
170
170
 
171
171
  # only asked for 1 instance, so therefore it should be the first
172
172
  begin
173
- tries ||= 5
173
+ tries ||= 3
174
174
  aws_instance = result.data.instances.first
175
175
  @aws.create_tags(
176
176
  resources: [aws_instance.instance_id],
@@ -283,10 +283,6 @@ class OpenStudioAwsInstance
283
283
  'i2.2xlarge' => 8,
284
284
  'i2.4xlarge' => 16,
285
285
  'i2.8xlarge' => 32,
286
- 'd2.xlarge' => 4,
287
- 'd2.2xlarge' => 8,
288
- 'd2.4xlarge' => 16,
289
- 'd2.8xlarge' => 36,
290
286
  'hs1.8xlarge' => 16
291
287
  }
292
288
 
@@ -59,7 +59,7 @@ class OpenStudioAwsWrapper
59
59
  @region = options[:region] || 'unknown-region'
60
60
 
61
61
  # If the keys exist in the directory then load those, otherwise create new ones.
62
- @work_dir = File.expand_path options[:save_directory]
62
+ @work_dir = options[:save_directory] || '.'
63
63
  if File.exist?(File.join(@work_dir, 'ec2_worker_key.pem')) && File.exist?(File.join(@work_dir, 'ec2_worker_key.pub'))
64
64
  logger.info "Worker keys already exist, loading from #{@work_dir}"
65
65
  load_worker_key(File.join(@work_dir, 'ec2_worker_key.pem'))
@@ -81,7 +81,7 @@ class OpenStudioAwsWrapper
81
81
  @aws = Aws::EC2::Client.new(options[:credentials])
82
82
  end
83
83
 
84
- def create_or_retrieve_default_security_group(tmp_name = 'openstudio-server-sg-v2.2', vpc_id = nil)
84
+ def create_or_retrieve_default_security_group(tmp_name = 'openstudio-server-sg-v2.1', vpc_id = nil)
85
85
  group = @aws.describe_security_groups(filters: [{ name: 'group-name', values: [tmp_name] }])
86
86
  logger.info "Length of the security group is: #{group.data.security_groups.length}"
87
87
  if group.data.security_groups.length == 0
@@ -94,13 +94,13 @@ class OpenStudioAwsWrapper
94
94
  end
95
95
  group_id = r[:group_id]
96
96
  @aws.authorize_security_group_ingress(
97
+ group_name: tmp_name,
97
98
  group_id: group_id,
98
99
  ip_permissions: [
99
100
  { ip_protocol: 'tcp', from_port: 22, to_port: 22, ip_ranges: [cidr_ip: '0.0.0.0/0'] }, # Eventually make this only the user's IP address seen by the internet
100
101
  { ip_protocol: 'tcp', from_port: 80, to_port: 80, ip_ranges: [cidr_ip: '0.0.0.0/0'] },
101
102
  { ip_protocol: 'tcp', from_port: 443, to_port: 443, ip_ranges: [cidr_ip: '0.0.0.0/0'] },
102
103
  { ip_protocol: 'tcp', from_port: 0, to_port: 65535, user_id_group_pairs: [{ group_name: tmp_name }] }, # allow all machines in the security group talk to each other openly
103
- { ip_protocol: 'udp', from_port: 0, to_port: 65535, user_id_group_pairs: [{ group_name: tmp_name }] }, # allow all machines in the security group talk to each other openly
104
104
  { ip_protocol: 'icmp', from_port: -1, to_port: -1, ip_ranges: [cidr_ip: '0.0.0.0/0'] }
105
105
  ]
106
106
  )
@@ -383,14 +383,12 @@ class OpenStudioAwsWrapper
383
383
  defaults = {
384
384
  user_id: 'unknown_user',
385
385
  tags: [],
386
- ebs_volume_size: nil,
387
- user_data_file: 'server_script.sh.template'
386
+ ebs_volume_size: nil
388
387
  }
389
388
  launch_options = defaults.merge(launch_options)
390
389
 
391
390
  # replace the server_script.sh.template with the keys to add
392
-
393
- user_data = File.read(File.join(File.expand_path(File.dirname(__FILE__)), launch_options[:user_data_file]))
391
+ user_data = File.read(File.expand_path(File.dirname(__FILE__)) + '/server_script.sh.template')
394
392
  user_data.gsub!(/SERVER_HOSTNAME/, 'openstudio.server')
395
393
  user_data.gsub!(/WORKER_PRIVATE_KEY_TEMPLATE/, worker_keys.private_key.gsub("\n", '\\n'))
396
394
  user_data.gsub!(/WORKER_PUBLIC_KEY_TEMPLATE/, worker_keys.ssh_public_key)
@@ -410,12 +408,11 @@ class OpenStudioAwsWrapper
410
408
  user_id: 'unknown_user',
411
409
  tags: [],
412
410
  ebs_volume_size: nil,
413
- availability_zone: @server.data.availability_zone,
414
- user_data_file: 'worker_script.sh.template'
411
+ availability_zone: @server.data.availability_zone
415
412
  }
416
413
  launch_options = defaults.merge(launch_options)
417
414
 
418
- user_data = File.read(File.join(File.expand_path(File.dirname(__FILE__)), launch_options[:user_data_file]))
415
+ user_data = File.read(File.expand_path(File.dirname(__FILE__)) + '/worker_script.sh.template')
419
416
  user_data.gsub!(/SERVER_IP/, @server.data.private_ip_address)
420
417
  user_data.gsub!(/SERVER_HOSTNAME/, 'openstudio.server')
421
418
  user_data.gsub!(/WORKER_PUBLIC_KEY_TEMPLATE/, worker_keys.ssh_public_key)
@@ -476,48 +473,25 @@ class OpenStudioAwsWrapper
476
473
  end
477
474
 
478
475
  # blocking method that executes required commands for creating and provisioning a docker swarm cluster
479
- def configure_swarm_cluster(save_directory)
480
- logger.info('waiting for server user_data to complete')
481
- @server.wait_command('while ! [ -e /home/ubuntu/user_data_done ]; do sleep 5; done && echo "true"')
476
+ def configure_swarm_cluster
482
477
  logger.info('Running the configuration script for the server.')
483
- @server.wait_command('echo $(env) &> /home/ubuntu/env.log && echo "true"')
484
- @server.wait_command('cp /home/ubuntu/server_provision.sh /home/ubuntu/server_provision.sh.bak && echo "true"')
485
- @server.wait_command('sudo /home/ubuntu/server_provision.sh &> /home/ubuntu/server_provision.log && echo "true"')
478
+ @server.wait_command('sudo /home/ubuntu/server_provision.sh && echo "true"')
486
479
  logger.info('Downloading the swarm join command.')
487
- swarm_file = File.join(save_directory, 'worker_swarm_join.sh')
480
+ swarm_file = File.join(@work_dir, 'worker_swarm_join.sh')
488
481
  @server.download_file('/home/ubuntu/swarmjoin.sh', swarm_file)
489
- logger.info('waiting for worker user_data to complete')
490
- @workers.each { |worker| worker.wait_command('while ! [ -e /home/ubuntu/user_data_done ]; do sleep 5; done && echo "true"') }
491
482
  logger.info('Running the configuration script for the worker(s).')
492
- @workers.each { |worker| worker.wait_command('sudo /home/ubuntu/worker_provision.sh &> /home/ubuntu/worker_provision.log && echo "true"') }
483
+ @workers.each { |worker| worker.wait_command('sudo /home/ubuntu/worker_provision.sh && echo "true"') }
493
484
  logger.info('Successfully re-sized storage devices for all nodes. Joining server nodes to the swarm.')
494
- worker_join_cmd = "#{File.read(swarm_file).strip} && echo \"true\""
485
+ worker_join_cmd = "#{File.read('worker_swarm_join.sh').strip} && echo \"true\""
495
486
  @workers.each { |worker| worker.wait_command(worker_join_cmd) }
496
- logger.info('All worker nodes have been added to the swarm. Setting environment variables and starting the cluster')
487
+ logger.info('All worker nodes have been added to the swarm. Starting the server cluster.')
488
+ @server.shell_command('docker stack deploy --compose-file docker-compose.yml osserver-stack')
489
+ sleep 10
490
+ logger.info('The OpenStudio Server stack has been started. Scaling worker nodes.')
497
491
  total_procs = @server.procs
498
492
  @workers.each { |worker| total_procs += worker.procs }
499
- max_requests = ((total_procs + 10) * 1.2).round
500
- mongo_cores = (total_procs / 64.0).ceil
501
- web_cores = (total_procs / 32.0).ceil
502
- max_pool = 16 * web_cores
503
- rez_mem = 512 * max_pool
504
- total_procs = total_procs - mongo_cores - web_cores + 2
505
- @server.shell_command("echo 'MAX_REQUESTS=#{max_requests}' >> /home/ubuntu/.env && echo \"true\"")
506
- @server.shell_command("echo 'MONGO_CORES=#{mongo_cores}' >> /home/ubuntu/.env && echo \"true\"")
507
- @server.shell_command("echo 'WEB_CORES=#{web_cores}' >> /home/ubuntu/.env && echo \"true\"")
508
- @server.shell_command("echo 'MAX_POOL=#{max_pool}' >> /home/ubuntu/.env && echo \"true\"")
509
- @server.shell_command("echo 'REZ_MEM=#{rez_mem}M' >> /home/ubuntu/.env && echo \"true\"")
510
- @server.shell_command("echo 'OS_SERVER_NUMBER_OF_WORKERS=#{total_procs}' >> /home/ubuntu/.env && echo \"true\"")
511
- @server.shell_command("echo '' >> /home/ubuntu/.env && echo \"true\"")
512
- @server.shell_command("docker stack deploy --compose-file docker-compose.yml osserver && echo \"true\"")
513
- sleep 10
514
- logger.info('The OpenStudio Server stack has been started. Waiting for the server to become available.')
515
- @server.wait_command("while ( nc -zv #{@server.ip} 80 3>&1 1>&2- 2>&3- ) | awk -F \":\" '$3 != \" Connection refused\" {exit 1}'; do sleep 5; done && echo \"true\"")
516
- logger.info('The OpenStudio Server stack has become available. Scaling the worker nodes.')
517
- @server.wait_command("docker service scale osserver_worker=#{total_procs} && echo \"true\"")
518
- logger.info('Waiting up to two minutes for the osserver_worker service to scale.')
519
- @server.wait_command("timeout 120 bash -c -- 'while [ $( docker service ls -f name=osserver_worker --format=\"{{.Replicas}}\" ) != \"#{total_procs}/#{total_procs}\" ]; do sleep 5; done'; echo \"true\"")
520
- logger.info('The OpenStudio Server stack is booted and ready for analysis submissions.')
493
+ @server.wait_command("docker service scale osserver-stack_worker=#{total_procs} && echo \"true\"")
494
+ logger.info('The OpenStudio Server stack has been configured.')
521
495
  end
522
496
 
523
497
  # method to query the amazon api to find the server (if it exists), based on the group id
@@ -14,11 +14,12 @@ describe OpenStudioAmis do
14
14
  end
15
15
 
16
16
  it 'should return specific amis if passed a version' do
17
- a = OpenStudioAmis.new(1, openstudio_version: '1.13.2')
17
+ a = OpenStudioAmis.new(1, openstudio_version: '1.2.1')
18
18
  amis = a.get_amis
19
19
 
20
- expect(amis[:server]).to eq('ami-e7a1bbf0')
21
- expect(amis[:worker]).to eq('ami-e0a1bbf7')
20
+ expect(amis[:server]).to eq('ami-89744be0')
21
+ expect(amis[:worker]).to eq('ami-37744b5e')
22
+ expect(amis[:cc2worker]).to eq('ami-51744b38')
22
23
  end
23
24
 
24
25
  it 'should list all amis' do
@@ -29,11 +30,66 @@ describe OpenStudioAmis do
29
30
  end
30
31
 
31
32
  context 'version 2' do
33
+ it 'should return openstudio server version 1.8.0 correctly' do
34
+ a = OpenStudioAmis.new(2, openstudio_server_version: '1.8.0')
35
+
36
+ amis = a.get_amis
37
+
38
+ expect(amis[:server]).to eq('ami-3c0fbf54')
39
+ expect(amis[:worker]).to eq('ami-040ebe6c')
40
+ expect(amis[:cc2worker]).to eq('ami-040ebe6c')
41
+ end
42
+ end
43
+
44
+ context 'version 2' do
45
+ it 'should return openstudio version 1.7.1 when stable is passed to 1.7.5' do
46
+ a = OpenStudioAmis.new(2, openstudio_version: '1.7.5', stable: true)
47
+
48
+ amis = a.get_amis
49
+
50
+ expect(amis[:server]).to eq('ami-845a54ec')
51
+ expect(amis[:worker]).to eq('ami-3a5a5452')
52
+ end
53
+
54
+ it 'should return openstudio version 1.7.1 stable & default versions correctly' do
55
+ a = OpenStudioAmis.new(2, openstudio_version: '1.7.1')
56
+
57
+ amis = a.get_amis
58
+
59
+ expect(amis[:server]).to eq('ami-845a54ec')
60
+ expect(amis[:worker]).to eq('ami-3a5a5452')
61
+ end
62
+
63
+ it 'should return openstudio version 1.7.0 default version correctly' do
64
+ a = OpenStudioAmis.new(2, openstudio_version: '1.7.0')
65
+
66
+ amis = a.get_amis
67
+
68
+ expect(amis[:server]).to eq('ami-725b701a')
69
+ expect(amis[:worker]).to eq('ami-4a446f22')
70
+ end
71
+
72
+ it 'should return openstudio version 1.7.0 stable version correctly' do
73
+ a = OpenStudioAmis.new(2, openstudio_version: '1.7.0', stable: true)
74
+
75
+ amis = a.get_amis
76
+
77
+ expect(amis[:server]).to eq('ami-c06b40a8')
78
+ expect(amis[:worker]).to eq('ami-9a97bff2')
79
+ end
32
80
 
33
81
  it 'should fail when trying to find a stable version for older releases' do
34
82
  a = OpenStudioAmis.new(2, openstudio_version: '1.5.0', stable: true)
35
83
 
36
84
  expect { a.get_amis }.to raise_error(/Could not find a stable version for openstudio version 1.5.0/)
37
85
  end
86
+
87
+ it 'should return latest version when passing in a future version' do
88
+ a = OpenStudioAmis.new(2, openstudio_version: '4.8.15', stable: true)
89
+
90
+ a = a.get_amis
91
+
92
+ expect(a).not_to be nil
93
+ end
38
94
  end
39
95
  end
@@ -25,6 +25,17 @@ describe OpenStudio::Aws::Aws do
25
25
 
26
26
  expect(aws.default_amis).not_to be_nil
27
27
  end
28
+
29
+ it 'should find the cc2 instances' do
30
+ options = {
31
+ ami_lookup_version: 2,
32
+ openstudio_server_version: '1.5.0'
33
+ }
34
+ aws = OpenStudio::Aws::Aws.new(options)
35
+
36
+ expect(aws.determine_image_type('cc2.2xlarge')).to eq 'ami-e582948c'
37
+ expect(aws.determine_image_type('c3.2xlarge')).to eq 'ami-918294f8'
38
+ end
28
39
  end
29
40
 
30
41
  context 'should error' do
@@ -38,14 +49,14 @@ describe OpenStudio::Aws::Aws do
38
49
  end
39
50
 
40
51
  context 'version testing' do
41
- it 'version 2: should find the right AMIs Server 1.21.15' do
52
+ it 'version 2: should find the right AMIs Server 1.3.1' do
42
53
  options = {
43
54
  ami_lookup_version: 2,
44
- openstudio_server_version: '1.21.15'
55
+ openstudio_server_version: '1.3.1'
45
56
  }
46
57
  aws = OpenStudio::Aws::Aws.new(options)
47
- expect(aws.default_amis[:worker]).to eq('ami-ccb35ada')
48
- expect(aws.default_amis[:server]).to eq('ami-54b45d42')
58
+ expect(aws.default_amis[:worker]).to eq('ami-39bb8750')
59
+ expect(aws.default_amis[:server]).to eq('ami-a9bb87c0')
49
60
  end
50
61
  end
51
62
 
@@ -73,9 +73,9 @@ describe OpenStudioAwsWrapper do
73
73
  context 'version 2' do
74
74
  it 'should create a new json' do
75
75
  resp = @aws.os_aws.create_new_ami_json(2)
76
- expect(resp[:openstudio_server]['1.21.4'.to_sym][:amis][:server]).to eq('ami-e7a1bbf0')
77
- expect(resp[:openstudio_server]['1.21.4'.to_sym][:openstudio_version_sha]).to eq('6103d54380')
78
- expect(resp[:openstudio_server]['1.21.4'.to_sym][:tested]).to eq(false)
76
+ expect(resp[:openstudio_server]['1.8.0'.to_sym][:amis][:server]).to eq('ami-3c0fbf54')
77
+ expect(resp[:openstudio_server]['1.3.1'.to_sym][:openstudio_version_sha]).to eq('7a955d780b')
78
+ expect(resp[:openstudio_server]['1.3.5'.to_sym][:tested]).to eq(false)
79
79
  end
80
80
  end
81
81
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.pre.rc10
4
+ version: 0.5.0.rc0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Long
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-08 00:00:00.000000000 Z
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
@@ -56,42 +56,42 @@ dependencies:
56
56
  name: semantic
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.4'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sshkey
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.7'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.7'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '10.4'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '10.4'
97
97
  description: Custom classes for configuring clusters for OpenStudio & EnergyPlus analyses
@@ -101,10 +101,10 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - ".gitignore"
105
- - ".gitmodules"
106
- - ".rubocop.yml"
107
- - ".travis.yml"
104
+ - .gitignore
105
+ - .gitmodules
106
+ - .rubocop.yml
107
+ - .travis.yml
108
108
  - CHANGELOG.md
109
109
  - Gemfile
110
110
  - License.txt
@@ -123,9 +123,7 @@ files:
123
123
  - lib/openstudio/lib/openstudio_aws_logger.rb
124
124
  - lib/openstudio/lib/openstudio_aws_wrapper.rb
125
125
  - lib/openstudio/lib/openstudio_cloud_watch.rb
126
- - lib/openstudio/lib/server_script.sh.docker.template
127
126
  - lib/openstudio/lib/server_script.sh.template
128
- - lib/openstudio/lib/worker_script.sh.docker.template
129
127
  - lib/openstudio/lib/worker_script.sh.template
130
128
  - openstudio-aws.gemspec
131
129
  - spec/aws_instances/aws_spec_api.rb
@@ -146,17 +144,17 @@ require_paths:
146
144
  - lib
147
145
  required_ruby_version: !ruby/object:Gem::Requirement
148
146
  requirements:
149
- - - ">="
147
+ - - '>='
150
148
  - !ruby/object:Gem::Version
151
149
  version: 2.0.0
152
150
  required_rubygems_version: !ruby/object:Gem::Requirement
153
151
  requirements:
154
- - - ">="
152
+ - - '>='
155
153
  - !ruby/object:Gem::Version
156
154
  version: 1.3.6
157
155
  requirements: []
158
156
  rubyforge_project:
159
- rubygems_version: 2.6.10
157
+ rubygems_version: 2.6.7
160
158
  signing_key:
161
159
  specification_version: 4
162
160
  summary: Start AWS EC2 instances for running distributed OpenStudio-based analyses
@@ -1,48 +0,0 @@
1
- #!/bin/bash
2
-
3
- # AWS Server Bootstrap File
4
- # This script is used to configure the AWS boxes for OpenStudio-server
5
-
6
- ENTRY="127.0.0.1 SERVER_HOSTNAME"
7
- FILE=/etc/hosts
8
- if grep -q "$ENTRY" $FILE; then
9
- echo "Hosts '$SERVER_HOSTNAME' entry already exists"
10
- else
11
- sudo sh -c "echo $ENTRY >> /etc/hosts"
12
- fi
13
-
14
- WORKER_PRIVATE_KEY="WORKER_PRIVATE_KEY_TEMPLATE"
15
- WORKER_PUBLIC_KEY="WORKER_PUBLIC_KEY_TEMPLATE"
16
-
17
- USER=ubuntu
18
-
19
- mkdir -p /home/$USER/.ssh && chmod 700 /home/$USER/.ssh
20
- echo -e $WORKER_PRIVATE_KEY > /home/$USER/.ssh/id_rsa
21
- echo -e $WORKER_PUBLIC_KEY > /home/$USER/.ssh/id_rsa.pub
22
- chmod 600 /home/$USER/.ssh/id_rsa
23
- chmod 644 /home/$USER/.ssh/id_rsa.pub
24
- chown ubuntu.ubuntu /home/$USER/.ssh/id_rsa
25
- chown ubuntu.ubuntu /home/$USER/.ssh/id_rsa.pub
26
-
27
- # Only allow localhost (and localhosts IP) to connect ot itself with this key. The IP is used for R cluster
28
- ENTRY="from=\"localhost,127.0.0.1\" $WORKER_PUBLIC_KEY"
29
- FILE=/home/$USER/.ssh/authorized_keys
30
- if grep -q "$ENTRY" $FILE; then
31
- echo "Key already exists in file"
32
- else
33
- echo $ENTRY >> $FILE
34
- fi
35
- chmod 644 /home/$USER/.ssh/authorized_keys
36
-
37
- # SSH config
38
- echo -e "Host *\n\tStrictHostKeyChecking no" > /home/$USER/.ssh/config
39
- chmod 644 /home/$USER/.ssh/config && chown ubuntu.ubuntu /home/$USER/.ssh/config
40
-
41
- # ec2 instance information
42
- curl -o /usr/local/bin/ec2-metadata http://s3.amazonaws.com/ec2metadata/ec2-metadata
43
- chmod 775 /usr/local/bin/ec2-metadata
44
- mkdir -p /etc/openstudio-server
45
- ec2-metadata -a -i -t -h -o -z -p -v > /etc/openstudio-server/instance.yml
46
-
47
- #file flag the user_data has completed
48
- cat /dev/null > /home/ubuntu/user_data_done
@@ -1,39 +0,0 @@
1
- #!/bin/bash
2
-
3
- # AWS Worker Bootstrap File
4
- # File used to configure worker nodes on AWS
5
-
6
- # Change Host File Entries
7
- ENTRY="SERVER_IP SERVER_HOSTNAME"
8
- FILE=/etc/hosts
9
- if grep -q "$ENTRY" $FILE; then
10
- echo "entry already exists"
11
- else
12
- sh -c "echo $ENTRY >> $FILE"
13
- fi
14
-
15
- WORKER_PUBLIC_KEY="WORKER_PUBLIC_KEY_TEMPLATE"
16
-
17
- # add the public key to authorized keys
18
- USER=ubuntu
19
-
20
- mkdir -p /home/$USER/.ssh && chmod 700 /home/$USER/.ssh
21
-
22
- # Only access from the server node
23
- ENTRY="from=\"SERVER_HOSTNAME\" $WORKER_PUBLIC_KEY"
24
- FILE=/home/$USER/.ssh/authorized_keys
25
- if grep -q "$ENTRY" $FILE; then
26
- echo "Key already exists in file"
27
- else
28
- echo $ENTRY >> $FILE
29
- fi
30
- chmod 644 /home/$USER/.ssh/authorized_keys
31
-
32
- # ec2 instance information
33
- curl -o /usr/local/bin/ec2-metadata http://s3.amazonaws.com/ec2metadata/ec2-metadata
34
- chmod 775 /usr/local/bin/ec2-metadata
35
- mkdir -p /etc/openstudio-server
36
- ec2-metadata -a -i -t -h -o -z -p -v > /etc/openstudio-server/instance.yml
37
-
38
- #file flag the user_data has completed
39
- cat /dev/null > /home/ubuntu/user_data_done