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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee277ee5ecc9e6ead701e87564ff672259a9b9f7
4
- data.tar.gz: 5207ddd5fe07df5d5fd16c8cec4f9778459374d7
3
+ metadata.gz: 02181d3f2def3716419b1b134b4cf3cb34f4030a
4
+ data.tar.gz: f06aedc7ad6f263ca8d07138d733b31fde873d17
5
5
  SHA512:
6
- metadata.gz: e999dca4f2155bad9947d78de1b98e415b414fe215299ff052bd9548e46f79faa773d9ca2378a7d67178b48890730bbd4f9ce2b1bdc2bb4244a4bd0ddd3c3660
7
- data.tar.gz: ebf959577bd453ec645412d41094bd17a322154528f5f1f543f3a1f9b06a67855db2a361a2ec0225f4da4fe44e3c3f4cb9321a59eae63af6240cc4576c4c7165
6
+ metadata.gz: 8d3a75e5a5d5b4ed74e541b077d34db8e60d80fd03f63da235fee95170a261b8a12f538a7cd2a5d31a49d56b07e4ef6f3704ace0c33a1a12819aedb42ab112f5
7
+ data.tar.gz: ae65f633a5fc6141966585d8202f3cf6a8177bbdc26d441dbb0e275a2d2d43893f3de9dfdaefed2db633a9d9fd0e232f17870e50fed6c31ba946aa7c273b8284
data/License.txt CHANGED
@@ -1,65 +1,32 @@
1
- Copyright (c) 2008-2013, Alliance for Sustainable Energy.
1
+ OpenStudio(R), Copyright (c) 2008-2016, Alliance for Sustainable Energy, LLC.
2
2
  All rights reserved.
3
-
4
- NOTICE
5
-
6
- This computer software (Software) is code in development prepared by the
7
- Alliance for Sustainable Energy, (hereinafter the "Contractor"), under
8
- Contract DE-AC36-08GO28308 (Contract) with the Department of Energy (DOE).
9
- The United States Government has been granted for itself and others acting
10
- on its behalf a paid-up, non-exclusive, irrevocable, worldwide license in
11
- the Software to reproduce, prepare derivative works, and perform publicly
12
- and display publicly. Beginning five (5) years after the date permission
13
- to assert copyright is obtained from the DOE, and subject to any
14
- subsequent five (5) year renewals, the United States Government is granted
15
- for itself and others acting on its behalf a paid-up, non-exclusive,
16
- irrevocable, worldwide license in the Software to reproduce, prepare
17
- derivative works, distribute copies to the public, perform publicly and
18
- display publicly, and to permit others to do so. If the Contractor ceases
19
- to make this computer software available, it may be obtained from DOE's
20
- Office of Scientific and Technical Information's Energy Science and
21
- Technology Software Center (ESTSC) at P.O. Box 1020, Oak Ridge, TN 37831-
22
- 1020.
23
-
24
- DISCLAIMER
25
-
26
- THIS SOFTWARE IS PROVIDED BY THE CONTRACTOR "AS IS" AND ANY EXPRESS OR
27
- IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
29
- NO EVENT SHALL THE CONTRACTOR OR THE U.S. GOVERNMENT BE LIABLE FOR ANY
30
- SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER,
31
- INCLUDING BUT NOT LIMITED TO CLAIMS ASSOCIATED WITH THE LOSS OF DATA OR
32
- PROFITS, WHICH MAY RESULT FROM AN ACTION IN CONTRACT, NEGLIGENCE OR OTHER
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.
@@ -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,5 +1,5 @@
1
1
  module OpenStudio
2
2
  module Aws
3
- VERSION = '0.4.2'
3
+ VERSION = '0.5.0-pre0'
4
4
  end
5
5
  end
@@ -1,21 +1,37 @@
1
- ######################################################################
2
- # Copyright (c) 2008-2015, Alliance for Sustainable Energy.
3
- # All rights reserved.
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
- # This library is free software; you can redistribute it and/or
6
- # modify it under the terms of the GNU Lesser General Public
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
- # This library is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with this library; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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
- # Copyright (c) 2008-2015, Alliance for Sustainable Energy.
3
- # All rights reserved.
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
- # This library is free software; you can redistribute it and/or
6
- # modify it under the terms of the GNU Lesser General Public
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
- # This library is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with this library; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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/sdh'
98
+ device: '/dev/sdm'
83
99
  )
84
100
 
85
101
  # Wait for the volume to attach
@@ -1,21 +1,37 @@
1
- ######################################################################
2
- # Copyright (c) 2008-2015, Alliance for Sustainable Energy.
3
- # All rights reserved.
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
- # This library is free software; you can redistribute it and/or
6
- # modify it under the terms of the GNU Lesser General Public
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
- # This library is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with this library; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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
- # Copyright (c) 2008-2015, Alliance for Sustainable Energy.
3
- # All rights reserved.
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
- # This library is free software; you can redistribute it and/or
6
- # modify it under the terms of the GNU Lesser General Public
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
- # This library is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with this library; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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
- @aws.create_security_group(group_name: tmp_name, description: "group dynamically created by #{__FILE__}")
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
- # Copyright (c) 2008-2015, Alliance for Sustainable Energy.
3
- # All rights reserved.
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
- # This library is free software; you can redistribute it and/or
6
- # modify it under the terms of the GNU Lesser General Public
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
- # This library is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with this library; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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
 
@@ -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.2
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: 2016-05-06 00:00:00.000000000 Z
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.0.14.1
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