openstudio-aws 0.4.2 → 0.5.0.pre.pre0
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/License.txt +31 -64
- data/lib/openstudio/aws/aws.rb +44 -4
- data/lib/openstudio/aws/config.rb +35 -0
- data/lib/openstudio/aws/version.rb +1 -1
- data/lib/openstudio/lib/ami_list.rb +53 -15
- data/lib/openstudio/lib/openstudio_aws_instance.rb +32 -16
- data/lib/openstudio/lib/openstudio_aws_logger.rb +31 -15
- data/lib/openstudio/lib/openstudio_aws_wrapper.rb +51 -17
- data/lib/openstudio/lib/openstudio_cloud_watch.rb +31 -15
- data/lib/openstudio-aws.rb +35 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02181d3f2def3716419b1b134b4cf3cb34f4030a
|
|
4
|
+
data.tar.gz: f06aedc7ad6f263ca8d07138d733b31fde873d17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d3a75e5a5d5b4ed74e541b077d34db8e60d80fd03f63da235fee95170a261b8a12f538a7cd2a5d31a49d56b07e4ef6f3704ace0c33a1a12819aedb42ab112f5
|
|
7
|
+
data.tar.gz: ae65f633a5fc6141966585d8202f3cf6a8177bbdc26d441dbb0e275a2d2d43893f3de9dfdaefed2db633a9d9fd0e232f17870e50fed6c31ba946aa7c273b8284
|
data/License.txt
CHANGED
|
@@ -1,65 +1,32 @@
|
|
|
1
|
-
Copyright (c) 2008-
|
|
1
|
+
OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
|
|
2
2
|
All rights reserved.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
TORTIOUS CLAIM THAT ARISES OUT OF OR IN CONNECTION WITH THE ACCESS, USE OR
|
|
34
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
35
|
-
|
|
36
|
-
YOU AGREE TO INDEMNIFY DOE/NREL/ALLIANCE, AND ITS SUBSIDIARIES,
|
|
37
|
-
AFFILIATES, OFFICERS, AGENTS, AND EMPLOYEES AGAINST ANY CLAIM OR DEMAND,
|
|
38
|
-
INCLUDING REASONABLE ATTORNEYS' FEES, RELATED TO YOUR USE OF THESE DATA.
|
|
39
|
-
|
|
40
|
-
DOE/NREL/Alliance is not obligated to provide the user with any support,
|
|
41
|
-
consulting, training or assistance of any kind with regard to the use of
|
|
42
|
-
these Data or to provide the user with any updates, revisions or new
|
|
43
|
-
versions of these Data.
|
|
44
|
-
|
|
45
|
-
The names DOE/NREL/Alliance may not be used in any advertising or
|
|
46
|
-
publicity to endorse or promote any products or commercial entities unless
|
|
47
|
-
specific written permission is obtained from DOE/NREL/Alliance.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
OPEN SOURCE LICENSE
|
|
51
|
-
|
|
52
|
-
This library is free software; you can redistribute it and/or
|
|
53
|
-
modify it under the terms of the GNU Lesser General Public
|
|
54
|
-
License as published by the Free Software Foundation; either
|
|
55
|
-
version 2.1 of the License, or (at your option) any later version.
|
|
56
|
-
|
|
57
|
-
This library is distributed in the hope that it will be useful,
|
|
58
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
59
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
60
|
-
Lesser General Public License for more details here.
|
|
61
|
-
|
|
62
|
-
You should have received a copy of the GNU Lesser General Public
|
|
63
|
-
License along with this library; if not, write to the Free Software
|
|
64
|
-
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
65
|
-
|
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
|
4
|
+
modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
(1) Redistributions of source code must retain the above copyright notice,
|
|
7
|
+
this list of conditions and the following disclaimer.
|
|
8
|
+
|
|
9
|
+
(2) Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
and/or other materials provided with the distribution.
|
|
12
|
+
|
|
13
|
+
(3) Neither the name of the copyright holder nor the names of any contributors
|
|
14
|
+
may be used to endorse or promote products derived from this software without
|
|
15
|
+
specific prior written permission from the respective party.
|
|
16
|
+
|
|
17
|
+
(4) Other than as required in clauses (1) and (2), distributions in any form
|
|
18
|
+
of modifications or other derivative works may not use the "OpenStudio"
|
|
19
|
+
trademark, "OS", "os", or any other confusingly similar designation without
|
|
20
|
+
specific prior written permission from Alliance for Sustainable Energy, LLC.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
23
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
24
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
25
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
|
26
|
+
GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
27
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
28
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
29
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
30
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
31
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
32
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/lib/openstudio/aws/aws.rb
CHANGED
|
@@ -1,10 +1,45 @@
|
|
|
1
|
+
# *******************************************************************************
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
|
6
|
+
#
|
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
# this list of conditions and the following disclaimer.
|
|
9
|
+
#
|
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
# and/or other materials provided with the distribution.
|
|
13
|
+
#
|
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
|
16
|
+
# specific prior written permission from the respective party.
|
|
17
|
+
#
|
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
|
22
|
+
#
|
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
# *******************************************************************************
|
|
35
|
+
|
|
1
36
|
# This class is a wrapper around the command line version that is in the OpenStudio repository.
|
|
2
37
|
module OpenStudio
|
|
3
38
|
module Aws
|
|
4
39
|
VALID_OPTIONS = [
|
|
5
40
|
:proxy, :credentials, :ami_lookup_version, :openstudio_version,
|
|
6
41
|
:openstudio_server_version, :region, :ssl_verify_peer, :host, :url, :stable,
|
|
7
|
-
:save_directory
|
|
42
|
+
:save_directory, :subnet_id
|
|
8
43
|
]
|
|
9
44
|
|
|
10
45
|
class Aws
|
|
@@ -76,6 +111,8 @@ module OpenStudio
|
|
|
76
111
|
@os_aws = OpenStudioAwsWrapper.new(options)
|
|
77
112
|
@os_cloudwatch = OpenStudioCloudWatch.new(options)
|
|
78
113
|
|
|
114
|
+
@dockerized = options[:ami_lookup_version] == 3 ? true : false
|
|
115
|
+
|
|
79
116
|
# this will grab the default version of openstudio ami versions
|
|
80
117
|
# get the arugments for the AMI lookup
|
|
81
118
|
ami_options = {}
|
|
@@ -108,7 +145,8 @@ module OpenStudio
|
|
|
108
145
|
ebs_volume_id: nil,
|
|
109
146
|
aws_key_pair_name: nil,
|
|
110
147
|
private_key_file_name: nil, # required if using an existing "aws_key_pair_name"
|
|
111
|
-
tags: []
|
|
148
|
+
tags: [],
|
|
149
|
+
vpc_id: nil
|
|
112
150
|
}
|
|
113
151
|
options = defaults.merge(options)
|
|
114
152
|
|
|
@@ -125,7 +163,8 @@ module OpenStudio
|
|
|
125
163
|
|
|
126
164
|
if options[:security_groups].empty?
|
|
127
165
|
# if the user has not specified any security groups, then create one called: 'openstudio-server-sg-v1'
|
|
128
|
-
@os_aws.create_or_retrieve_default_security_group
|
|
166
|
+
@os_aws.create_or_retrieve_default_security_group(tmp_name = 'openstudio-server-sg-v2.1',
|
|
167
|
+
vpc_id=options[:vpc_id])
|
|
129
168
|
else
|
|
130
169
|
@os_aws.security_groups = options[:security_groups]
|
|
131
170
|
end
|
|
@@ -207,7 +246,8 @@ module OpenStudio
|
|
|
207
246
|
|
|
208
247
|
logger.info 'Waiting for server/worker configurations'
|
|
209
248
|
|
|
210
|
-
@os_aws.configure_server_and_workers
|
|
249
|
+
return @os_aws.configure_server_and_workers unless @dockerized
|
|
250
|
+
@os_aws.configure_swarm_cluster if @dockerized
|
|
211
251
|
end
|
|
212
252
|
|
|
213
253
|
# Write out to the terminal the connection information for the servers and workers
|
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
# *******************************************************************************
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
|
6
|
+
#
|
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
# this list of conditions and the following disclaimer.
|
|
9
|
+
#
|
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
# and/or other materials provided with the distribution.
|
|
13
|
+
#
|
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
|
16
|
+
# specific prior written permission from the respective party.
|
|
17
|
+
#
|
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
|
22
|
+
#
|
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
# *******************************************************************************
|
|
35
|
+
|
|
1
36
|
module OpenStudio
|
|
2
37
|
module Aws
|
|
3
38
|
class Config
|
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# *******************************************************************************
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
|
4
6
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# License as published by the Free Software Foundation; either
|
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
# this list of conditions and the following disclaimer.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# Lesser General Public License for more details.
|
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
# and/or other materials provided with the distribution.
|
|
14
13
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
|
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
|
16
|
+
# specific prior written permission from the respective party.
|
|
17
|
+
#
|
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
|
22
|
+
#
|
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
# *******************************************************************************
|
|
19
35
|
|
|
20
36
|
# Class for managing the AMI ids based on the openstudio version and the openstudio-server version
|
|
21
37
|
|
|
@@ -160,6 +176,28 @@ class OpenStudioAmis
|
|
|
160
176
|
amis
|
|
161
177
|
end
|
|
162
178
|
|
|
179
|
+
# Return the required docker AMI base box
|
|
180
|
+
def get_ami_version_3
|
|
181
|
+
json = list
|
|
182
|
+
amis = {}
|
|
183
|
+
if @options[:openstudio_version].to_sym == :default && @options[:openstudio_server_version].to_sym == :default
|
|
184
|
+
# grab the most recent openstudio server version - this is not recommended
|
|
185
|
+
key, value = json[:openstudio_server].first
|
|
186
|
+
amis[:server] = value[:ami]
|
|
187
|
+
amis[:worker] = value[:ami]
|
|
188
|
+
elsif @options[:openstudio_server_version] != 'default'
|
|
189
|
+
value = json[:openstudio_server][@options[:openstudio_server_version].to_sym]
|
|
190
|
+
amis[:server] = value[:ami]
|
|
191
|
+
amis[:worker] = value[:ami]
|
|
192
|
+
elsif @options[:openstudio_version] != 'default'
|
|
193
|
+
fail 'Currently the openstudio_version lookup is not supported in v3.'
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
logger.info "AMI IDs are #{amis}" if amis
|
|
197
|
+
|
|
198
|
+
amis
|
|
199
|
+
end
|
|
200
|
+
|
|
163
201
|
private
|
|
164
202
|
|
|
165
203
|
# fetch the URL with redirects
|
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# *******************************************************************************
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
|
4
6
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# License as published by the Free Software Foundation; either
|
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
# this list of conditions and the following disclaimer.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# Lesser General Public License for more details.
|
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
# and/or other materials provided with the distribution.
|
|
14
13
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
|
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
|
16
|
+
# specific prior written permission from the respective party.
|
|
17
|
+
#
|
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
|
22
|
+
#
|
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
# *******************************************************************************
|
|
19
35
|
|
|
20
36
|
class OpenStudioAwsInstance
|
|
21
37
|
include Logging
|
|
@@ -79,7 +95,7 @@ class OpenStudioAwsInstance
|
|
|
79
95
|
volume_id: resp[:volume_id],
|
|
80
96
|
instance_id: instance_id,
|
|
81
97
|
# required
|
|
82
|
-
device: '/dev/
|
|
98
|
+
device: '/dev/sdm'
|
|
83
99
|
)
|
|
84
100
|
|
|
85
101
|
# Wait for the volume to attach
|
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# *******************************************************************************
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
|
4
6
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# License as published by the Free Software Foundation; either
|
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
# this list of conditions and the following disclaimer.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# Lesser General Public License for more details.
|
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
# and/or other materials provided with the distribution.
|
|
14
13
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
|
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
|
16
|
+
# specific prior written permission from the respective party.
|
|
17
|
+
#
|
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
|
22
|
+
#
|
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
# *******************************************************************************
|
|
19
35
|
|
|
20
36
|
require 'logger'
|
|
21
37
|
|
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# *******************************************************************************
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
|
4
6
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# License as published by the Free Software Foundation; either
|
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
# this list of conditions and the following disclaimer.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# Lesser General Public License for more details.
|
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
# and/or other materials provided with the distribution.
|
|
14
13
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
|
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
|
16
|
+
# specific prior written permission from the respective party.
|
|
17
|
+
#
|
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
|
22
|
+
#
|
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
# *******************************************************************************
|
|
19
35
|
|
|
20
36
|
require_relative 'openstudio_aws_logger'
|
|
21
37
|
|
|
@@ -65,14 +81,21 @@ class OpenStudioAwsWrapper
|
|
|
65
81
|
@aws = Aws::EC2::Client.new(options[:credentials])
|
|
66
82
|
end
|
|
67
83
|
|
|
68
|
-
def create_or_retrieve_default_security_group(tmp_name = 'openstudio-server-sg-v2.1')
|
|
84
|
+
def create_or_retrieve_default_security_group(tmp_name = 'openstudio-server-sg-v2.1', vpc_id = nil)
|
|
69
85
|
group = @aws.describe_security_groups(filters: [{ name: 'group-name', values: [tmp_name] }])
|
|
70
86
|
logger.info "Length of the security group is: #{group.data.security_groups.length}"
|
|
71
87
|
if group.data.security_groups.length == 0
|
|
72
88
|
logger.info 'security group not found --- will create a new one'
|
|
73
|
-
|
|
89
|
+
if vpc_id
|
|
90
|
+
r = @aws.create_security_group(group_name: tmp_name, description: "group dynamically created by #{__FILE__}",
|
|
91
|
+
vpc_id: vpc_id)
|
|
92
|
+
else
|
|
93
|
+
r = @aws.create_security_group(group_name: tmp_name, description: "group dynamically created by #{__FILE__}")
|
|
94
|
+
end
|
|
95
|
+
group_id = r[:group_id]
|
|
74
96
|
@aws.authorize_security_group_ingress(
|
|
75
97
|
group_name: tmp_name,
|
|
98
|
+
group_id: group_id,
|
|
76
99
|
ip_permissions: [
|
|
77
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
|
|
78
101
|
{ ip_protocol: 'tcp', from_port: 80, to_port: 80, ip_ranges: [cidr_ip: '0.0.0.0/0'] },
|
|
@@ -449,6 +472,17 @@ class OpenStudioAwsWrapper
|
|
|
449
472
|
true
|
|
450
473
|
end
|
|
451
474
|
|
|
475
|
+
# blocking method that executes required commands for creating and provisioning a docker swarm cluster
|
|
476
|
+
def configure_swarm_cluster
|
|
477
|
+
logger.info('Waiting for the server storage device to be configured.')
|
|
478
|
+
@server.wait_command('[ -e /home/ubuntu/server_provision.sh ] && echo "true"')
|
|
479
|
+
logger.info('Waiting for the worker storage device(s) to be configured.')
|
|
480
|
+
@workers.each { |worker| worker.wait_command('[ -e /home/ubuntu/server_provision.sh ] && echo "true"') }
|
|
481
|
+
logger.info('Successfully re-sized and configured storage devices for all nodes.')
|
|
482
|
+
puts 'Successfully re-sized and configured storage devices for all nodes.'
|
|
483
|
+
|
|
484
|
+
end
|
|
485
|
+
|
|
452
486
|
# method to query the amazon api to find the server (if it exists), based on the group id
|
|
453
487
|
# if it is found, then it will set the @server instance variable. The security groups are assigned from the
|
|
454
488
|
# server node information on AWS if the security groups have not been initialized yet.
|
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# *******************************************************************************
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
|
4
6
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
# License as published by the Free Software Foundation; either
|
|
8
|
-
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
# this list of conditions and the following disclaimer.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# Lesser General Public License for more details.
|
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
# and/or other materials provided with the distribution.
|
|
14
13
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
|
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
|
16
|
+
# specific prior written permission from the respective party.
|
|
17
|
+
#
|
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
|
22
|
+
#
|
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
# *******************************************************************************
|
|
19
35
|
|
|
20
36
|
require_relative 'openstudio_aws_logger'
|
|
21
37
|
|
data/lib/openstudio-aws.rb
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
# *******************************************************************************
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
|
6
|
+
#
|
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
# this list of conditions and the following disclaimer.
|
|
9
|
+
#
|
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
# and/or other materials provided with the distribution.
|
|
13
|
+
#
|
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
|
16
|
+
# specific prior written permission from the respective party.
|
|
17
|
+
#
|
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
|
22
|
+
#
|
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
24
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
25
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
26
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
|
|
27
|
+
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
28
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
30
|
+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
31
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
32
|
+
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
33
|
+
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
# *******************************************************************************
|
|
35
|
+
|
|
1
36
|
require 'json'
|
|
2
37
|
require 'net/scp'
|
|
3
38
|
require 'net/http'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openstudio-aws
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0.pre.pre0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nicholas Long
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: net-scp
|
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
154
154
|
version: 1.3.6
|
|
155
155
|
requirements: []
|
|
156
156
|
rubyforge_project:
|
|
157
|
-
rubygems_version: 2.
|
|
157
|
+
rubygems_version: 2.6.7
|
|
158
158
|
signing_key:
|
|
159
159
|
specification_version: 4
|
|
160
160
|
summary: Start AWS EC2 instances for running distributed OpenStudio-based analyses
|