jellyfish-fog 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/README.md +60 -0
- data/Rakefile +18 -0
- data/config/initializers/fog.rb +3 -0
- data/config/initializers/product_types.rb +6 -0
- data/config/initializers/provisioners.rb +4 -0
- data/config/product_questions/azure_infrastructure.json +40 -0
- data/config/product_questions/database.json +53 -0
- data/config/product_questions/infrastructure.json +29 -0
- data/config/product_questions/storage.json +31 -0
- data/config/provisioners.json +6 -0
- data/lib/jellyfish-fog.rb +2 -0
- data/lib/jellyfish_fog/databases.rb +47 -0
- data/lib/jellyfish_fog/engine.rb +11 -0
- data/lib/jellyfish_fog/infrastructure.rb +66 -0
- data/lib/jellyfish_fog/provisioner.rb +49 -0
- data/lib/jellyfish_fog/storage.rb +36 -0
- data/lib/jellyfish_fog/version.rb +5 -0
- data/lib/jellyfish_fog.rb +30 -0
- data/lib/tasks/jellyfish_fog_tasks.rake +4 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 51697c13a12bd6849e4218a93f4073ace7245eae
|
4
|
+
data.tar.gz: 67fe55debcb3528b59779f94478b5658c1c5c5ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d1618d6a4031bc55f150d2dc4bf1f5d7147d1e0a1b275b0a505d633afd8768d4ee643c7962166a7daf7a12661a37568353900f32f136393476e1a87321609425
|
7
|
+
data.tar.gz: 781bc2a5a49eb943776a9b8538e69885aa93a28360f7196fbca0c91b0a1976b25438d64993cf16a8d6eb75f3de2bb9a907a96f1426c833b10dd96a9127c2dee4
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2015 Booz Allen Hamilton
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Jellyfish Fog
|
2
|
+
|
3
|
+
[![Code Climate](https://codeclimate.com/repos/555a0675695680378e0027e6/badges/43ed237afc55c67eb2ef/gpa.svg)](https://codeclimate.com/repos/555a0675695680378e0027e6/feed)
|
4
|
+
[![Test Coverage](https://codeclimate.com/repos/555a0675695680378e0027e6/badges/43ed237afc55c67eb2ef/coverage.svg)](https://codeclimate.com/repos/555a0675695680378e0027e6/coverage)
|
5
|
+
|
6
|
+
Adds infrastructure, database, and storage product types to [Project Jellyfish API](https://github.com/projectjellyfish/api), and enables their provisioning on cloud service providers ([AWS](http://aws.amazon.com), [Azure](http://azure.microsoft.com/en-us), [DigitalOcean](https://www.digitalocean.com) and [VMWare](https://www.vmware.com/products/vrealize-suite)) via the [Fog](http://fog.io) gem.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
### Setup Gemfile
|
11
|
+
|
12
|
+
Include `jellyfish-fog` from GitHub in parent Gemfile:
|
13
|
+
```
|
14
|
+
gem 'jellyfish-fog', git: 'git://github.com/projectjellyfish/jellyfish-fog.git
|
15
|
+
```
|
16
|
+
|
17
|
+
Or include it locally:
|
18
|
+
```
|
19
|
+
gem 'jellyfish-fog', path: '../jellyfish-fog'
|
20
|
+
```
|
21
|
+
|
22
|
+
And run `bundle install`.
|
23
|
+
|
24
|
+
### Setup Env Vars
|
25
|
+
|
26
|
+
Add the following keys which can be set using the `.env` file or explicitly by the hosted environment (e.g. Heroku):
|
27
|
+
|
28
|
+
```
|
29
|
+
# GENERAL
|
30
|
+
JELLYFISH_MOCK_FOG = true
|
31
|
+
|
32
|
+
# AWS SPECIFIC
|
33
|
+
JELLYFISH_AWS_ACCESS_KEY_ID = key
|
34
|
+
JELLYFISH_AWS_SECRET_ACCESS_KEY_ID = secret
|
35
|
+
|
36
|
+
# AZURE SPECIFIC
|
37
|
+
JELLYFISH_AZURE_SUB_ID = azure_subscription_id
|
38
|
+
JELLYFISH_AZURE_PEM_PATH = azure_certificate.pem
|
39
|
+
JELLYFISH_AZURE_API_URL = https://management.core.windows.net
|
40
|
+
|
41
|
+
```
|
42
|
+
|
43
|
+
|
44
|
+
**Key Descriptions**:
|
45
|
+
- If `JELLYFISH_MOCK_FOG` is not set to `false`, Fog will simulate provisioning and retirement rather than actually interacting with the cloud service providers. All keys are required in mock mode, but they can specify dummy data.
|
46
|
+
|
47
|
+
- `JELLYFISH_AWS_ACCESS_KEY_ID` and `JELLYFISH_AWS_SECRET_ACCESS_KEY_ID` are the public and private keys used by Fog to authenticate to AWS when provisioning and retiring assets.
|
48
|
+
|
49
|
+
- `JELLYFISH_AZURE_SUB_ID` is the Azure subscription id used for provisioning
|
50
|
+
|
51
|
+
- `JELLYFISH_AZURE_PEM_PATH` is location of the client certificate pem file usd to authenticate with Azure. See [here](http://azure.microsoft.com/en-us/documentation/articles/cloud-services-python-how-to-use-service-management) for how to generate.
|
52
|
+
|
53
|
+
- `JELLYFISH_AZURE_API_URL` is the API endpoint used for Azure provisioning
|
54
|
+
|
55
|
+
## License
|
56
|
+
|
57
|
+
See [LICENSE](https://github.com/projectjellyfish/jellyfish-fog/blob/master/LICENSE)
|
58
|
+
|
59
|
+
|
60
|
+
Copyright 2015 Booz Allen Hamilton
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
8
|
+
load 'rails/tasks/engine.rake'
|
9
|
+
|
10
|
+
Bundler::GemHelper.install_tasks
|
11
|
+
|
12
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each { |f| load f }
|
13
|
+
|
14
|
+
require 'rspec/core'
|
15
|
+
require 'rspec/core/rake_task'
|
16
|
+
desc 'Run all specs in spec directory'
|
17
|
+
RSpec::Core::RakeTask.new(:spec)
|
18
|
+
task default: :spec
|
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"title": "Azure Fog Infrastructure",
|
4
|
+
"description": "Azure Fog Infrastructure",
|
5
|
+
"required" : ["image", "location", "vm_name", "vm_user", "password", "storage_account_name"],
|
6
|
+
"properties" : {
|
7
|
+
"image" :{
|
8
|
+
"title": "Image ID",
|
9
|
+
"type": "string",
|
10
|
+
"default": "jellyfish-20150519-359159-os-2015-05-19"
|
11
|
+
},
|
12
|
+
"location" : {
|
13
|
+
"title": "Location",
|
14
|
+
"type": "string",
|
15
|
+
"default": "West US"
|
16
|
+
},
|
17
|
+
"vm_name" :{
|
18
|
+
"title": "VM Name",
|
19
|
+
"type": "string",
|
20
|
+
"default": "fog-server"
|
21
|
+
},
|
22
|
+
"vm_user" :{
|
23
|
+
"title": "VM User",
|
24
|
+
"type": "string",
|
25
|
+
"default": "foguser"
|
26
|
+
},
|
27
|
+
|
28
|
+
"password" :{
|
29
|
+
"title": "Password}",
|
30
|
+
"type": "string",
|
31
|
+
"default": "ComplexPassword!123"
|
32
|
+
},
|
33
|
+
"storage_account_name" :{
|
34
|
+
"title": "Storage Account Name",
|
35
|
+
"type": "string",
|
36
|
+
"default": "fogstorage"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"title": "AWS Fog Databases",
|
4
|
+
"description": "AWS Fog Databases",
|
5
|
+
"required": ["DBInstanceClass", "Engine", "AllocatedStorage"],
|
6
|
+
"properties": {
|
7
|
+
"DBInstanceClass": {
|
8
|
+
"title": "DB Instance Size",
|
9
|
+
"type": "string",
|
10
|
+
"enum": [
|
11
|
+
"db.m3.medium",
|
12
|
+
"db.m3.large",
|
13
|
+
"db.m3.xlarge"
|
14
|
+
],
|
15
|
+
"default": "db.m3.medium"
|
16
|
+
},
|
17
|
+
"Engine": {
|
18
|
+
"title": "DB Engine",
|
19
|
+
"type": "string",
|
20
|
+
"enum": [
|
21
|
+
"aurora",
|
22
|
+
"mysql",
|
23
|
+
"postgresql",
|
24
|
+
"sqlserver"
|
25
|
+
]
|
26
|
+
},
|
27
|
+
"AllocatedStorage": {
|
28
|
+
"title": "Disk Size",
|
29
|
+
"type": "string",
|
30
|
+
"default": "40"
|
31
|
+
},
|
32
|
+
"StorageType": {
|
33
|
+
"title": "Storage Type",
|
34
|
+
"type": "string",
|
35
|
+
"enum": [
|
36
|
+
"ssd",
|
37
|
+
"standard",
|
38
|
+
"gp2",
|
39
|
+
"io1"
|
40
|
+
],
|
41
|
+
"default": "ssd"
|
42
|
+
},
|
43
|
+
"availability": {
|
44
|
+
"title": "Storage Redundancy",
|
45
|
+
"type": "string",
|
46
|
+
"enum": [
|
47
|
+
"normal",
|
48
|
+
"reduced"
|
49
|
+
],
|
50
|
+
"default": "normal"
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"title": "AWS Fog Infrastructure",
|
4
|
+
"description": "AWS Fog Infrastructure",
|
5
|
+
"required": ["ami_id", "instance_size", "disk_size"],
|
6
|
+
"properties": {
|
7
|
+
"ami_id": {
|
8
|
+
"title": "AMI ID",
|
9
|
+
"type": "string",
|
10
|
+
"default": "ami-1ccae774"
|
11
|
+
},
|
12
|
+
"instance_size": {
|
13
|
+
"title": "Instance Size",
|
14
|
+
"type": "string",
|
15
|
+
"enum": [
|
16
|
+
"t2.micro",
|
17
|
+
"m3.medium",
|
18
|
+
"m3.large"
|
19
|
+
],
|
20
|
+
"default": "m3.medium"
|
21
|
+
},
|
22
|
+
"disk_size": {
|
23
|
+
"title": "Disk Size",
|
24
|
+
"type": "string",
|
25
|
+
"default": "40"
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"type": "object",
|
3
|
+
"title": "AWS Fog Storage",
|
4
|
+
"description": "AWS Fog Storage",
|
5
|
+
"required": ["availability", "region"],
|
6
|
+
"properties": {
|
7
|
+
"availability": {
|
8
|
+
"title": "Storage Redundancy",
|
9
|
+
"type": "string",
|
10
|
+
"enum": [
|
11
|
+
"normal",
|
12
|
+
"reduced"
|
13
|
+
],
|
14
|
+
"default": "normal"
|
15
|
+
},
|
16
|
+
"region": {
|
17
|
+
"title": "DB Engine",
|
18
|
+
"type": "string",
|
19
|
+
"enum": [
|
20
|
+
"",
|
21
|
+
"us-west-1",
|
22
|
+
"us-west-2",
|
23
|
+
"EU",
|
24
|
+
"ap-northeast-1",
|
25
|
+
"ap-southeast-1",
|
26
|
+
"ap-southeast-2"
|
27
|
+
],
|
28
|
+
"default": ""
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'bcrypt'
|
2
|
+
|
3
|
+
module Jellyfish
|
4
|
+
module Fog
|
5
|
+
module AWS
|
6
|
+
class Databases < Jellyfish::Provisioner
|
7
|
+
def provision
|
8
|
+
@password = SecureRandom.hex(5)
|
9
|
+
db_instance_id = "id-#{@order_item.uuid[0..9]}"
|
10
|
+
handle_errors do
|
11
|
+
db = connection.create_db_instance(db_instance_id, details)
|
12
|
+
@order_item.payload_response = db.to_json
|
13
|
+
@order_item.provision_status = 'ok'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def retire
|
18
|
+
connection.delete_db_instance(identifier, snapshot, false)
|
19
|
+
@order_item.provision_status = 'retired'
|
20
|
+
rescue Excon::Errors::BadRequest, Excon::Errors::Forbidden => e
|
21
|
+
raise e, 'Bad request. Check for valid credentials and proper permissions.', e.backtrace
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def details
|
27
|
+
@order_item.answers.merge(
|
28
|
+
'MasterUserPassword' => @password,
|
29
|
+
'MasterUsername' => 'admin'
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def connection
|
34
|
+
::Fog::AWS::RDS.new(Jellyfish::Fog.aws_settings)
|
35
|
+
end
|
36
|
+
|
37
|
+
def identifier
|
38
|
+
@order_item.payload_response['data']['body']['CreateDBInstanceResult']['DBInstance']['DBInstanceIdentifier']
|
39
|
+
end
|
40
|
+
|
41
|
+
def snapshot
|
42
|
+
"snapshot-#{@order_item.uuid[0..5]}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Jellyfish
|
2
|
+
module Fog
|
3
|
+
module AWS
|
4
|
+
class Infrastructure < Jellyfish::Provisioner
|
5
|
+
def provision
|
6
|
+
server = nil
|
7
|
+
|
8
|
+
handle_errors do
|
9
|
+
server = connection.servers.create(details).tap { |s| s.wait_for { ready? } }
|
10
|
+
end
|
11
|
+
|
12
|
+
@order_item.provision_status = 'ok'
|
13
|
+
@order_item.payload_response = server.to_json
|
14
|
+
end
|
15
|
+
|
16
|
+
def retire
|
17
|
+
handle_errors do
|
18
|
+
connection.servers.delete(server_identifier)
|
19
|
+
end
|
20
|
+
@order_item.provision_status = 'retired'
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def connection
|
26
|
+
::Fog::Compute.new(Jellyfish::Fog.aws_settings.merge(provider: 'AWS'))
|
27
|
+
end
|
28
|
+
|
29
|
+
def server_identifier
|
30
|
+
@order_item.payload_response['id']
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
module Azure
|
35
|
+
class Infrastructure < Jellyfish::Provisioner
|
36
|
+
def provision
|
37
|
+
server = nil
|
38
|
+
|
39
|
+
handle_errors do
|
40
|
+
server = connection.servers.create(details)
|
41
|
+
end
|
42
|
+
|
43
|
+
order_item.provision_status = :ok
|
44
|
+
order_item.payload_response = server.attributes
|
45
|
+
end
|
46
|
+
|
47
|
+
def retire
|
48
|
+
handle_errors do
|
49
|
+
connection.delete_virtual_machine(server_attributes[:vm_name], server_attributes[:cloud_service_name])
|
50
|
+
end
|
51
|
+
order_item.provision_status = :retired
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def connection
|
57
|
+
::Fog::Compute.new(Jellyfish::Fog::Azure.settings)
|
58
|
+
end
|
59
|
+
|
60
|
+
def server_attributes
|
61
|
+
order_item.payload_response
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Jellyfish
|
2
|
+
class Provisioner
|
3
|
+
attr_reader :order_item
|
4
|
+
|
5
|
+
def self.provision(order_item_id)
|
6
|
+
perform(order_item_id, :critical_error) { |order_item| new(order_item).provision }
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.retire(order_item_id)
|
10
|
+
perform(order_item_id, :warning_retirement_error) { |order_item| new(order_item).retire }
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(order_item)
|
14
|
+
@order_item = order_item
|
15
|
+
end
|
16
|
+
|
17
|
+
def details
|
18
|
+
order_item.answers
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.perform(order_item_id, error_method)
|
22
|
+
order_item = OrderItem.find(order_item_id)
|
23
|
+
yield order_item
|
24
|
+
rescue => e
|
25
|
+
send(error_method, order_item, e.message)
|
26
|
+
raise
|
27
|
+
ensure
|
28
|
+
order_item.save!
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.warning_retirement_error(order_item, message)
|
32
|
+
order_item.provision_status = :warning
|
33
|
+
order_item.status_msg = "Retirement failed: #{message}"[0..254]
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.critical_error(order_item, message)
|
37
|
+
order_item.provision_status = :critical
|
38
|
+
order_item.status_msg = message
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def handle_errors
|
44
|
+
yield
|
45
|
+
rescue Excon::Errors::BadRequest, Excon::Errors::Forbidden => e
|
46
|
+
raise e, 'Bad request. Check for valid credentials and proper permissions.', e.backtrace
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Jellyfish
|
2
|
+
module Fog
|
3
|
+
module AWS
|
4
|
+
class Storage < Jellyfish::Provisioner
|
5
|
+
def provision
|
6
|
+
instance_name = "id-#{order_item.uuid[0..9]}"
|
7
|
+
begin
|
8
|
+
storage = connection.directories.create(key: instance_name, public: true)
|
9
|
+
rescue Excon::Errors::BadRequest, Excon::Errors::Forbidden => e
|
10
|
+
raise e, 'Bad request. Check for valid credentials and proper permissions.', e.backtrace
|
11
|
+
end
|
12
|
+
|
13
|
+
order_item.payload_response = storage.to_json
|
14
|
+
order_item.provision_status = 'ok'
|
15
|
+
end
|
16
|
+
|
17
|
+
def retire
|
18
|
+
connection.delete_bucket(storage_key)
|
19
|
+
order_item.provision_status = 'retired'
|
20
|
+
rescue Excon::Errors::BadRequest, Excon::Errors::Forbidden => e
|
21
|
+
raise e, 'Bad request. Check for valid credentials and proper permissions.', e.backtrace
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def connection
|
27
|
+
::Fog::Storage.new(Jellyfish::Fog.aws_settings.merge(provider: 'AWS'))
|
28
|
+
end
|
29
|
+
|
30
|
+
def storage_key
|
31
|
+
order_item.payload_response['key']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'azure'
|
2
|
+
require 'fog'
|
3
|
+
require 'fog/azure'
|
4
|
+
require 'bcrypt'
|
5
|
+
require 'jellyfish_fog/engine'
|
6
|
+
require 'jellyfish_fog/provisioner'
|
7
|
+
require 'jellyfish_fog/infrastructure'
|
8
|
+
require 'jellyfish_fog/databases'
|
9
|
+
require 'jellyfish_fog/storage'
|
10
|
+
|
11
|
+
module Jellyfish
|
12
|
+
module Fog
|
13
|
+
module Azure
|
14
|
+
def self.settings
|
15
|
+
{
|
16
|
+
provider: 'Azure',
|
17
|
+
azure_sub_id: ENV.fetch('JELLYFISH_AZURE_SUB_ID'),
|
18
|
+
azure_pem: ENV.fetch('JELLYFISH_AZURE_PEM_PATH'),
|
19
|
+
azure_api_url: ENV.fetch('JELLYFISH_AZURE_API_URL')
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
def self.aws_settings
|
24
|
+
{
|
25
|
+
aws_access_key_id: ENV.fetch('JELLYFISH_AWS_ACCESS_KEY_ID'),
|
26
|
+
aws_secret_access_key: ENV.fetch('JELLYFISH_AWS_SECRET_ACCESS_KEY')
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jellyfish-fog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mafernando
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dotenv-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pg
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: azure
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.6.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.6.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: fog
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: fog-azure
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: bcrypt
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: A module that adds Fog support to Jellyfish API
|
112
|
+
email:
|
113
|
+
- fernando_michael@bah.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- LICENSE
|
119
|
+
- README.md
|
120
|
+
- Rakefile
|
121
|
+
- config/initializers/fog.rb
|
122
|
+
- config/initializers/product_types.rb
|
123
|
+
- config/initializers/provisioners.rb
|
124
|
+
- config/product_questions/azure_infrastructure.json
|
125
|
+
- config/product_questions/database.json
|
126
|
+
- config/product_questions/infrastructure.json
|
127
|
+
- config/product_questions/storage.json
|
128
|
+
- config/provisioners.json
|
129
|
+
- lib/jellyfish-fog.rb
|
130
|
+
- lib/jellyfish_fog.rb
|
131
|
+
- lib/jellyfish_fog/databases.rb
|
132
|
+
- lib/jellyfish_fog/engine.rb
|
133
|
+
- lib/jellyfish_fog/infrastructure.rb
|
134
|
+
- lib/jellyfish_fog/provisioner.rb
|
135
|
+
- lib/jellyfish_fog/storage.rb
|
136
|
+
- lib/jellyfish_fog/version.rb
|
137
|
+
- lib/tasks/jellyfish_fog_tasks.rake
|
138
|
+
homepage: http://www.projectjellyfish.org/
|
139
|
+
licenses:
|
140
|
+
- APACHE
|
141
|
+
metadata: {}
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.4.5
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: Jellyfish Fog Module
|
162
|
+
test_files: []
|