forj 0.0.48 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/bin/forj +59 -17
- data/lib/appinit.rb +2 -0
- data/lib/build_tmpl/bootstrap_build.sh +145 -0
- data/lib/build_tmpl/write-mime-multipart.py +128 -0
- data/lib/connection.rb +6 -8
- data/lib/defaults.yaml +130 -46
- data/lib/down.rb +1 -3
- data/{spec/yaml_parse_spec.rb → lib/forj/ForjCli.rb} +22 -0
- data/lib/forj/ForjCore.rb +111 -0
- data/lib/forj/process/ForjProcess.rb +623 -0
- data/lib/forj-account.rb +3 -380
- data/lib/forj-config.rb +6 -6
- data/lib/lib-forj/lib/core/core.rb +1687 -0
- data/lib/lib-forj/lib/core/definition.rb +441 -0
- data/lib/lib-forj/lib/core/definition_internal.rb +306 -0
- data/lib/lib-forj/lib/core_process/CloudProcess.rb +311 -0
- data/lib/lib-forj/lib/core_process/global_process.rb +403 -0
- data/lib/lib-forj/lib/core_process/network_process.rb +606 -0
- data/lib/lib-forj/lib/lib-forj.rb +37 -0
- data/lib/lib-forj/lib/providers/hpcloud/Hpcloud.rb +406 -0
- data/lib/lib-forj/lib/providers/hpcloud/compute.rb +108 -0
- data/lib/lib-forj/lib/providers/hpcloud/network.rb +107 -0
- data/lib/lib-forj/lib/providers/hpcloud/security_groups.rb +67 -0
- data/lib/lib-forj/lib/providers/templates/compute.rb +42 -0
- data/lib/lib-forj/lib/providers/templates/core.rb +61 -0
- data/lib/{yaml_parse.rb → lib-forj/lib/providers/templates/network.rb} +14 -26
- data/lib/log.rb +12 -1
- data/lib/repositories.rb +0 -6
- data/lib/ssh.rb +18 -15
- metadata +35 -6
- data/lib/boot.rb +0 -263
- data/lib/setup.rb +0 -45
data/lib/defaults.yaml
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
:ports: [22, 80, 443, 3000, 3131-3135, 4505-4506, 5000, 5666, 8000, 8080-8081, 8083, 8125, 8139-8140, 8773-8776, 9292, 29418, 35357]
|
32
32
|
|
33
33
|
# Private key file path. Those files (private/public key) will be added to ~/.forj/keypairs/ as respectively 'keypair_name' and 'keypair_name'.pub
|
34
|
-
:
|
34
|
+
:keypair_files: ~/.ssh/forj-id_rsa
|
35
35
|
:keypair_name: forj
|
36
36
|
|
37
37
|
# Network: If network doesn't exist, forj cli will try to create it, and attach it a router.
|
@@ -43,6 +43,8 @@
|
|
43
43
|
:box_name: maestro
|
44
44
|
|
45
45
|
:provider_name: hpcloud
|
46
|
+
|
47
|
+
:maestro_bootstrap_dir: build/maestro/bootstrap
|
46
48
|
:description:
|
47
49
|
# Description of build.sh environment variable defined by forj cli for build.sh. (~/.forj/infra/build/<Account>.build.env)
|
48
50
|
:FORJ_HPC: "HPCloud cli Account used to build your Maestro box"
|
@@ -63,6 +65,14 @@
|
|
63
65
|
# It defines the account file structure. section/key=value
|
64
66
|
# All data can be predefined by default value (config.yaml/defaults.yaml) except
|
65
67
|
# those identified by :account_exclusive: true
|
68
|
+
:setup:
|
69
|
+
:ask_step:
|
70
|
+
- :desc: "Provider configuration:"
|
71
|
+
- :desc: "Maestro Cloud compute configuration:"
|
72
|
+
- :desc: "Maestro and blueprint configuration:"
|
73
|
+
:add:
|
74
|
+
- :keypair_files
|
75
|
+
- :desc: "DNS Configuration for Maestro:"
|
66
76
|
:sections:
|
67
77
|
# This section define updatable data available from config.yaml. But will never be added in an account file.
|
68
78
|
# Used by forj set/get functions
|
@@ -89,71 +99,119 @@
|
|
89
99
|
:desc: "Generic service identification for compute"
|
90
100
|
:account_exclusive: true
|
91
101
|
:account: true
|
102
|
+
:ask_step: 0
|
92
103
|
:network:
|
93
104
|
:desc: "Generic service identification for network"
|
94
105
|
:account_exclusive: true
|
95
106
|
:account: true
|
107
|
+
:ask_step: 0
|
96
108
|
|
97
109
|
# Defines ssh keys credentials
|
98
110
|
:credentials:
|
111
|
+
:keypair_files:
|
112
|
+
:explanation: |-
|
113
|
+
A keypair is a combination of SSH public and private key files. Usually, generated in your '$HOME/.ssh/' directory.
|
114
|
+
The private key is used to identify yourself to access your box via ssh.
|
115
|
+
The public key is used to configure your server to authorize you to access the box with your private key.
|
116
|
+
This keypair files will be copied to '$HOME/.forj/keypairs/ under <keypair_name> files for 'forj' needs.
|
117
|
+
|
118
|
+
If the keypair does exists locally, it will be created for you.
|
119
|
+
:desc: "Base keypair file name"
|
120
|
+
:default_value: "~/.ssh/id_rsa-forj"
|
121
|
+
:validate_function: :forj_check_keypairs_files
|
122
|
+
:account: true
|
123
|
+
:ask_step: 2
|
124
|
+
:after: :keypair_name
|
125
|
+
:post_step_function: :forj_setup_keypairs_files
|
99
126
|
:keypair_path:
|
100
|
-
:desc:
|
127
|
+
:desc: "Forj internal copy of private and public key pair files "
|
101
128
|
:keypair_name:
|
102
|
-
:desc:
|
129
|
+
:desc: "keypair name defined in your cloud to access your server. By default we named it 'forj'. If it doesn't exist, it will be created."
|
130
|
+
:validate: !ruby/regexp /^\w?\w*$/
|
131
|
+
:default_value: "forj"
|
132
|
+
:account: true
|
133
|
+
:ask_step: 2
|
103
134
|
:auth_uri:
|
104
|
-
:desc:
|
105
|
-
:account_exclusive:
|
106
|
-
:account:
|
107
|
-
:required:
|
108
|
-
:ask_sort:
|
135
|
+
:desc: "Generic service auth url"
|
136
|
+
:account_exclusive: true
|
137
|
+
:account: true
|
138
|
+
:required: true
|
139
|
+
:ask_sort: 0
|
109
140
|
:account_id:
|
110
|
-
:desc:
|
111
|
-
:account_exclusive:
|
112
|
-
:account:
|
113
|
-
:required:
|
141
|
+
:desc: "Generic Cloud Account name."
|
142
|
+
:account_exclusive: true
|
143
|
+
:account: true
|
144
|
+
:required: true
|
114
145
|
:account_key:
|
115
|
-
:desc:
|
116
|
-
:account_exclusive:
|
117
|
-
:account:
|
118
|
-
:required:
|
146
|
+
:desc: "Generic cloud account key"
|
147
|
+
:account_exclusive: true
|
148
|
+
:account: true
|
149
|
+
:required: true
|
119
150
|
:tenant:
|
120
|
-
:
|
121
|
-
|
122
|
-
|
123
|
-
|
151
|
+
:explanation: |-
|
152
|
+
|
153
|
+
Maestro is currently configured to access your cloud Compute service with fog openstack.
|
154
|
+
Fog openstack is compatible with hpcloud services
|
155
|
+
|
156
|
+
It requires the openstack project name to use, user and password.
|
157
|
+
|
158
|
+
:desc: "Openstack Tenant name"
|
159
|
+
:account_exclusive: true
|
160
|
+
:account: true
|
161
|
+
:required: true
|
162
|
+
:ask_step: 1
|
124
163
|
:os_user:
|
125
|
-
:desc:
|
126
|
-
:account_exclusive:
|
127
|
-
:account:
|
128
|
-
:required:
|
129
|
-
:validate:
|
164
|
+
:desc: "Openstack compute cloud User name"
|
165
|
+
:account_exclusive: true
|
166
|
+
:account: true
|
167
|
+
:required: true
|
168
|
+
:validate: !ruby/regexp /\w+/
|
169
|
+
:ask_step: 1
|
130
170
|
:os_enckey:
|
131
|
-
:desc:
|
132
|
-
:account_exclusive:
|
133
|
-
:encrypted:
|
134
|
-
:account:
|
135
|
-
:required:
|
171
|
+
:desc: "Openstack compute cloud password"
|
172
|
+
:account_exclusive: true
|
173
|
+
:encrypted: true
|
174
|
+
:account: true
|
175
|
+
:required: true
|
176
|
+
:ask_step: 1
|
136
177
|
|
137
178
|
# Defines DNS services for maestro
|
138
179
|
:dns:
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
180
|
+
:domain_name:
|
181
|
+
:desc: "Domain name added to each hosts."
|
182
|
+
:account_exclusive: true
|
183
|
+
:account: true
|
184
|
+
:post_step_function: :forj_DNS_settings
|
185
|
+
:ask_step: 3
|
186
|
+
:dns_service:
|
187
|
+
:desc: "DNS service region name Maestro will use."
|
188
|
+
:account_exclusive: true
|
189
|
+
:account: true
|
190
|
+
:pre_step_function: :forj_DNS_settings?
|
191
|
+
:ask_step: 3
|
192
|
+
:dns_tenant_id:
|
193
|
+
:desc: "DNS Tenant ID Maestro will use"
|
194
|
+
:account_exclusive: true
|
195
|
+
:account: true
|
196
|
+
:pre_step_function: :forj_DNS_settings?
|
197
|
+
:ask_step: 3
|
148
198
|
|
149
199
|
:maestro:
|
150
200
|
:tenant_name:
|
151
|
-
:desc:
|
201
|
+
:desc: "Tenant name required by fog/openstack on gardener"
|
152
202
|
:network_name:
|
153
|
-
:desc:
|
154
|
-
:default:
|
203
|
+
:desc: "Network name to attach to each forge boxes. By default we use 'forj'. If it doesn't exist, it will be created."
|
204
|
+
:default: network
|
205
|
+
:account: true
|
206
|
+
:validate: !ruby/regexp /^\w?\w*$/
|
207
|
+
:default_value: "forj"
|
208
|
+
:ask_step: 2
|
155
209
|
:security_group:
|
156
|
-
:desc:
|
210
|
+
:desc: "Security group name to configure and attach to each forge boxes."
|
211
|
+
:account: true
|
212
|
+
:validate: !ruby/regexp /^\w?\w*$/
|
213
|
+
:default_value: "forj"
|
214
|
+
:ask_step: 2
|
157
215
|
:maestro_repo:
|
158
216
|
:desc: "To use a different Maestro repository already cloned."
|
159
217
|
:infra_repo:
|
@@ -164,12 +222,38 @@
|
|
164
222
|
:desc: "forj cli use 'build.sh' to create Maestro. See build_config option on build.sh to get more information. By default 'box'"
|
165
223
|
:bp_flavor:
|
166
224
|
:desc: "Blueprint nodes default flavor. Usually, blueprint node are smaller than Maestro."
|
225
|
+
:account: true
|
226
|
+
:list_values:
|
227
|
+
:query_type: :query_call # Will execute a query on flavor, query_params is empty for all.
|
228
|
+
:object: :flavor
|
229
|
+
:value: :name
|
230
|
+
:validate: :list_strict
|
231
|
+
:ask_step: 2
|
167
232
|
:flavor_name:
|
168
233
|
:desc: "Maestro Flavor name. This flavor is for Maestro only. Your blueprint layout defines each node flavors on needs."
|
169
234
|
:default: :flavor
|
235
|
+
:account: true
|
236
|
+
:list_values:
|
237
|
+
:query_type: :query_call # Will execute a query on flavor, query_params is empty for all.
|
238
|
+
:object: :flavor
|
239
|
+
:value: :name
|
240
|
+
:validate: :list_strict
|
241
|
+
:ask_step: 2
|
170
242
|
:image_name:
|
171
|
-
:desc: "
|
243
|
+
:desc: "Ubuntu image used to create Maestro and all forge boxes. By default, it is 'Ubuntu Precise 12.04.4 LTS Server 64-bit 20140414 (Rescue Image)'"
|
244
|
+
:account: true
|
245
|
+
:ask_step: 2
|
246
|
+
:list_values:
|
247
|
+
:query_type: :query_call # Will execute a query on flavor, query_params is empty for all. No filter currently working.
|
248
|
+
:object: :image
|
249
|
+
:value: :name
|
250
|
+
:validate: :list_strict
|
251
|
+
:ask_step: 2
|
172
252
|
:ports:
|
173
|
-
:desc:
|
253
|
+
:desc: "List of security group rules (1 port or range of ports) to open to the external network."
|
174
254
|
:branch:
|
175
|
-
:desc:
|
255
|
+
:desc: "Branch to use to build your forge"
|
256
|
+
:bootstrap_dirs:
|
257
|
+
:desc: "Additional bootstrap directories (separated by space) to add in the bootstrap loop."
|
258
|
+
:bootstrap_extra_dir:
|
259
|
+
:desc: "Additional bootstrap directory to add in the bootstrap loop, before :bootstrap_dirs and after maestro default bootstrap directory."
|
data/lib/down.rb
CHANGED
@@ -20,8 +20,6 @@ require 'require_relative'
|
|
20
20
|
|
21
21
|
require_relative 'network.rb'
|
22
22
|
include Network
|
23
|
-
require_relative 'yaml_parse.rb'
|
24
|
-
include YamlParse
|
25
23
|
require_relative 'security.rb'
|
26
24
|
include SecurityGroup
|
27
25
|
#require_relative 'log.rb'
|
@@ -48,7 +46,7 @@ module Down
|
|
48
46
|
#~ router = Network.get_router(oFC, 'private-ext')
|
49
47
|
#~ subnet = Network.get_subnet(oFC, name)
|
50
48
|
#~ Network.delete_router_interface(subnet.id, router)
|
51
|
-
#~
|
49
|
+
#~
|
52
50
|
#~ Network.delete_subnet(oFC, subnet.id)
|
53
51
|
#~ network = Network.get_network(oFC, name)
|
54
52
|
#~ Network.delete_network(oFC, network.name)
|
@@ -14,3 +14,25 @@
|
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
|
+
|
18
|
+
# Defines how cli will control FORJ features
|
19
|
+
# boot/down/ssh/...
|
20
|
+
|
21
|
+
# Define framework object on BaseDefinition
|
22
|
+
# See lib/core/definition.rb for function details usage.
|
23
|
+
|
24
|
+
class ForjCliProcess
|
25
|
+
def connect_to(sObjectType, hParams)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class BaseDefinition
|
30
|
+
|
31
|
+
define_obj :box_ssh,
|
32
|
+
{
|
33
|
+
:create_e => :connect_to
|
34
|
+
}
|
35
|
+
obj_needs :CloudObject, :forge
|
36
|
+
obj_needs :data, :box_name
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
# Defines how to manage Maestro and forges
|
19
|
+
# create a maestro box. Identify a forge instance, delete it,...
|
20
|
+
|
21
|
+
# Define framework object on BaseDefinition
|
22
|
+
# See lib/core/definition.rb for function details usage.
|
23
|
+
|
24
|
+
$FORJCORE_PATH = File.expand_path(File.dirname(__FILE__))
|
25
|
+
|
26
|
+
require File.join($FORJCORE_PATH, "process", "ForjProcess.rb")
|
27
|
+
|
28
|
+
class BaseDefinition
|
29
|
+
|
30
|
+
process_default :use_controller => false
|
31
|
+
|
32
|
+
# ******************* Maestro Repository object
|
33
|
+
define_obj :maestro_repository,
|
34
|
+
{
|
35
|
+
:create_e => :clone_or_use_maestro_repo
|
36
|
+
}
|
37
|
+
|
38
|
+
obj_needs :data, :maestro_url
|
39
|
+
|
40
|
+
obj_needs_optional
|
41
|
+
obj_needs :data, :maestro_repo
|
42
|
+
|
43
|
+
# ******************* Infra Repository object
|
44
|
+
define_obj :infra_repository,
|
45
|
+
{
|
46
|
+
:create_e => :create_or_use_infra
|
47
|
+
}
|
48
|
+
|
49
|
+
obj_needs :CloudObject, :maestro_repository
|
50
|
+
obj_needs :data, :infra_repo
|
51
|
+
obj_needs :data, :branch
|
52
|
+
|
53
|
+
# ******************* metadata object
|
54
|
+
define_obj :metadata,
|
55
|
+
{
|
56
|
+
:create_e => :build_metadata
|
57
|
+
}
|
58
|
+
|
59
|
+
obj_needs :data, :instance_name
|
60
|
+
obj_needs :data, :network_name
|
61
|
+
obj_needs :data, :security_group
|
62
|
+
obj_needs :data, :keypair_name
|
63
|
+
obj_needs :data, :image_name
|
64
|
+
obj_needs :data, :bp_flavor
|
65
|
+
obj_needs :data, :compute
|
66
|
+
obj_needs :data, :branch
|
67
|
+
obj_needs :data, :domain_name
|
68
|
+
obj_needs :data, :tenant_name
|
69
|
+
# sent in base64
|
70
|
+
obj_needs :data, :os_user
|
71
|
+
obj_needs :data, :os_enckey
|
72
|
+
obj_needs :data, :account_id
|
73
|
+
obj_needs :data, :account_key
|
74
|
+
obj_needs_optional
|
75
|
+
|
76
|
+
# If requested by user, ask Maestro to manage the DNS.
|
77
|
+
obj_needs :data, :dns_service
|
78
|
+
obj_needs :data, :dns_tenant_id
|
79
|
+
|
80
|
+
# If requested by user, ask Maestro to instantiate a blueprint.
|
81
|
+
obj_needs :data, :blueprint
|
82
|
+
# Add init bootstrap additional steps
|
83
|
+
obj_needs :data, :bootstrap
|
84
|
+
# Add init additional git clone steps.
|
85
|
+
obj_needs :data, :repos
|
86
|
+
|
87
|
+
# ******************* userdata object
|
88
|
+
define_obj :userdata,
|
89
|
+
{
|
90
|
+
:create_e => :build_userdata
|
91
|
+
}
|
92
|
+
|
93
|
+
obj_needs :CloudObject, :maestro_repository
|
94
|
+
obj_needs :CloudObject, :metadata
|
95
|
+
obj_needs :CloudObject, :infra_repository
|
96
|
+
|
97
|
+
# ******************* forge object
|
98
|
+
define_obj :forge,
|
99
|
+
{
|
100
|
+
:create_e => :build_forge
|
101
|
+
# :delete_e => :drop_forge
|
102
|
+
}
|
103
|
+
obj_needs :CloudObject, :metadata
|
104
|
+
obj_needs :CloudObject, :userdata
|
105
|
+
obj_needs :data, :instance_name
|
106
|
+
|
107
|
+
obj_needs_optional
|
108
|
+
obj_needs :CloudObject, :server
|
109
|
+
obj_needs :data, :blueprint
|
110
|
+
|
111
|
+
end
|