-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJKE-RDS-Production1.yaml
324 lines (302 loc) · 12.6 KB
/
JKE-RDS-Production1.yaml
1
2
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
heat_template_version: 2013-05-23
description: >
Created 10/24/17 by admin. For Cloud admin@Amazon
parameters:
flavor:
type: string
description: 'Flavor to be used for compute instance'
key_name:
type: string
description: 'For most clouds, the name of the key-pair to be used for the compute instance; for VMware clouds, the contents of the public SSH key for the compute instance'
availability_zone1:
type: string
description: 'Name of availability zone in which to create the instance'
default: 'nova'
network-id__for__vpc-cf3dafa9:
type: string
description: 'Generated to reference ''vpc-cf3dafa9'' network.'
default: 'vpc-cf3dafa9'
subnet_id_subnet-11b2fa3c:
type: string
description: 'Generated to reference subnet ''subnet-11b2fa3c''.'
default: 'subnet-11b2fa3c'
availability_zone2:
type: string
description: 'Name of availability zone in which to create the instance'
default: 'nova'
ucd_server_url:
type: string
description: 'The server URL for agent communication to UrbanCode Deploy. Do *not* add a trailing slash.'
default: 'https://glamdring.local:8443'
ucd_user:
type: string
description: 'The user credential for the UrbanCode Deploy server.'
default: 'PasswordIsAuthToken'
ucd_password:
type: string
description: 'The user credential for the UrbanCode Deploy server.'
hidden: true
ucd_relay_url:
type: string
description: 'The server URL for an agent relay - leave as ''None'' to enable agents to communicate with server directly.'
default: 'None'
availability_zone:
type: string
description: 'Name of the availability zone in which to create the instance'
db_master_password:
type: string
description: 'Generated'
label: Db Master Password
default: 'password'
hidden: true
db_master_username:
type: string
description: 'Generated'
label: Db Master Username
default: 'admin'
db_port:
type: string
description: 'Generated'
label: Db Port
default: '3306'
db_name:
type: string
description: 'Generated'
label: Db Name
default: 'JKEDB'
db_password:
type: string
description: 'Generated'
label: Db Password
default: 'password'
hidden: true
db_user:
type: string
description: 'Generated'
label: Db User
default: 'jke_user'
parameter_groups:
- { label: 'Agent Parameters', parameters: [ucd_password, ucd_relay_url, ucd_server_url, ucd_user] }
- { label: 'Database Credentials', parameters: [db_master_password, db_master_username, db_name, db_password, db_port, db_user] }
- { label: 'Image Parameters', parameters: [flavor, key_name] }
- { label: 'Network Parameters', parameters: [availability_zone1, availability_zone2, network-id__for__vpc-cf3dafa9, subnet_id_subnet-11b2fa3c] }
resources:
## REFERENCE {"vpc-cf3dafa9":{"type": "OS::Neutron::Net", "properties": {"network_id": "vpc-cf3dafa9", "external":"false", "subnets": [{"cidr":"172.31.48.0\/20","availability_zone":"us-east-1b","name":"subnet-11b2fa3c","id":"subnet-11b2fa3c"},{"cidr":"172.31.16.0\/20","availability_zone":"us-east-1d","name":"subnet-7066202b","id":"subnet-7066202b"},{"cidr":"172.31.0.0\/20","availability_zone":"us-east-1c","name":"subnet-6cd5ec25","id":"subnet-6cd5ec25"},{"cidr":"172.31.80.0\/20","availability_zone":"us-east-1f","name":"subnet-b40e61b8","id":"subnet-b40e61b8"},{"cidr":"172.31.32.0\/20","availability_zone":"us-east-1e","name":"subnet-2072fd1c","id":"subnet-2072fd1c"},{"cidr":"172.31.64.0\/20","availability_zone":"us-east-1a","name":"subnet-ea770e8f","id":"subnet-ea770e8f"}] }}}
jke-application:
type: OS::Nova::Server
properties:
user_data: { get_resource: jke-application_mime }
user_data_format: RAW
networks:
- port: { get_resource: jke-application__to__vpc-cf3dafa9__port }
name: jke-application
image: "ami-1a0a540d" # RHEL-6.8_HVM-20161026-x86_64-1-Hourly2-GP2
flavor: { get_param: flavor }
key_name: { get_param: key_name }
availability_zone: { get_param: availability_zone1 }
metadata:
"__os_type__" : "Linux"
jke_war:
depends_on: jke_db
type: IBM::UrbanCode::SoftwareDeploy::UCD
properties:
apply_config: { get_resource: jke_war_sw_config }
server: jke-application
version: LATEST
agent_timeout: "360"
jke_war_sw_config:
type: IBM::UrbanCode::SoftwareConfig::UCD
properties:
name: "jke.war"
component_process: deploy_rds
component_process_timeout: "300"
ucd_server_url: { get_param: ucd_server_url } # these should come from resource_tree
ucd_username: { get_param: ucd_user }
ucd_password: { get_param: ucd_password }
application: { get_attr: [resource_tree, application_name] }
environment_name: { get_attr: [resource_tree, environment_name] }
inputs: # component's environment property definitions
JKE_DB_PORT : {get_attr: [rds-prod-instance, endpoint_port]}
JKE_DB_HOST : {get_attr: [rds-prod-instance, endpoint_address]}
jke-application_mime:
type: OS::Heat::MultipartMime
properties:
parts:
- config: { get_resource: ucd_agent_install_linux }
subtype: "x-shellscript"
WebSphere_Liberty_Profile:
type: IBM::UrbanCode::SoftwareDeploy::UCD
properties:
apply_config: { get_resource: WebSphere_Liberty_Profile_sw_config }
server: jke-application
version: LATEST
agent_timeout: '750'
WebSphere_Liberty_Profile_sw_config:
type: IBM::UrbanCode::SoftwareConfig::UCD
properties:
name: "WebSphere Liberty Profile"
component_process: "deploy"
component_process_timeout: "300"
ucd_server_url: { get_param: ucd_server_url } # these should come from resource_tree
ucd_username: { get_param: ucd_user }
ucd_password: { get_param: ucd_password }
application: { get_attr: [resource_tree, application_name] }
environment_name: { get_attr: [resource_tree, environment_name] }
jke-application__to__vpc-cf3dafa9__port:
type: OS::Neutron::Port
properties:
security_groups:
- sg-05b62679
- sg-8695b3f9 # sg-05b62679(default) sg-8695b3f9(launch-wizard-4)
network_id: { get_param: network-id__for__vpc-cf3dafa9 }
replacement_policy: AUTO #TODO remove this if using HEAT version Icehouse!
fixed_ips:
- subnet: { get_param: subnet_id_subnet-11b2fa3c }
jke-database:
type: OS::Nova::Server
properties:
user_data: { get_resource: jke-database_mime }
user_data_format: RAW
networks:
- port: { get_resource: jke-database__to__vpc-cf3dafa9__port }
name: jke-database
image: "ami-1a0a540d" # RHEL-6.8_HVM-20161026-x86_64-1-Hourly2-GP2
flavor: { get_param: flavor }
key_name: { get_param: key_name }
availability_zone: { get_param: availability_zone2 }
metadata:
"__os_type__" : "Linux"
jke_db:
depends_on: [WebSphere_Liberty_Profile, MySQL_Server]
type: IBM::UrbanCode::SoftwareDeploy::UCD
properties:
apply_config: { get_resource: jke_db_sw_config }
server: jke-database
version: LATEST
agent_timeout: "360"
jke_db_sw_config:
type: IBM::UrbanCode::SoftwareConfig::UCD
properties:
name: "jke.db"
component_process: deploy_rds
component_process_timeout: "300"
ucd_server_url: { get_param: ucd_server_url } # these should come from resource_tree
ucd_username: { get_param: ucd_user }
ucd_password: { get_param: ucd_password }
application: { get_attr: [resource_tree, application_name] }
environment_name: { get_attr: [resource_tree, environment_name] }
inputs: # component's environment property definitions
db_admin_password: { get_param: db_master_password } # Generated
db_admin_user: { get_param: db_master_username } # Generated
db_endpoint_address : {get_attr: [rds-prod-instance, endpoint_address]}
db_port: {get_attr: [rds-prod-instance, endpoint_port]}
db_name: { get_param: db_name }
db_password: { get_param: db_password }
db_user: { get_param: db_user }
jke-database_mime:
type: OS::Heat::MultipartMime
properties:
parts:
- config: { get_resource: ucd_agent_install_linux }
subtype: "x-shellscript"
MySQL_Server:
type: IBM::UrbanCode::SoftwareDeploy::UCD
properties:
apply_config: { get_resource: MySQL_Server_sw_config }
server: jke-database
version: LATEST
agent_timeout: '750'
rds-prod-instance:
type: IBM::RDS::Instance
properties:
name: rds-prod-instance
db_instance_class: db.t2.micro
engine: mysql
engine_version: 5.6.35
availability_zone: { get_param: availability_zone }
vpc_security_group_ids: [ sg-05b62679 ]
allocated_storage: 5
master_username: { get_param: db_master_username }
master_password: { get_param: db_master_password }
subnet_group:
parameter_group:
MySQL_Server_sw_config:
type: IBM::UrbanCode::SoftwareConfig::UCD
properties:
name: "MySQL Server"
component_process: "deploy"
component_process_timeout: '900'
ucd_server_url: { get_param: ucd_server_url } # these should come from resource_tree
ucd_username: { get_param: ucd_user }
ucd_password: { get_param: ucd_password }
application: { get_attr: [resource_tree, application_name] }
environment_name: { get_attr: [resource_tree, environment_name] }
jke-database__to__vpc-cf3dafa9__port:
type: OS::Neutron::Port
properties:
security_groups:
- sg-05b62679
- sg-8695b3f9 # sg-05b62679(default) sg-8695b3f9(launch-wizard-4)
network_id: { get_param: network-id__for__vpc-cf3dafa9 }
replacement_policy: AUTO #TODO remove this if using HEAT version Icehouse!
fixed_ips:
- subnet: { get_param: subnet_id_subnet-11b2fa3c }
resource_tree:
type: IBM::UrbanCode::ResourceTree
properties:
urbancode_deploy_url: { get_param: ucd_server_url }
username: { get_param: ucd_user }
password: { get_param: ucd_password }
team_mappings:
application: JKE
base_resource_group:
ucd_agent_install_linux:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
template: |
#!/usr/bin/env bash
#ifconfig eth0 mtu 1454 ## Optionally patch the MTU
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/root/bin
arch=`uname -ms | awk '{print tolower($0)}' | tr " " "-" `
agent_archive=ibm-ucd-agent-$arch.tgz
if [ "_ucd_relay_url_" != "None" ]; then
proxy_args="--proxy _ucd_relay_url_:20080"
ucd_remote_host=_ucd_relay_url_
agent_args="-r -d"
ucd_jms_port=7916
else
proxy_args=
agent_args=
ucd_remote_host=_ucd_server_url_
ucd_jms_port=7918
fi
if ps -ef | grep -v grep | grep -q air-monitor.jar ; then
exit 0
elif [ -d /opt/ibm ]; then
exit 0
fi
if command -V apt-get && ! command -V curl; then apt-get -y install curl; fi
if command -V yum && ! command -V curl; then yum -y install curl; fi
curl $proxy_args -Lk --retry 10 --retry-delay 10 --retry-max-time 120 -o /tmp/$agent_archive -u _ucd_user_:_ucd_password_ "_ucd_server_url_/cli/version/downloadArtifacts?component=ucd-agent-$arch&version=_agent_version_&singleFilePath=$agent_archive"
tar xfz /tmp/$agent_archive -C /tmp
/tmp/ibm-ucd-agent-install/install-agent-with-options.sh -t "_agent_team_" -p $ucd_jms_port -s $ucd_remote_host $agent_args -x start -v -n _agent_name_
params:
_agent_name_:
str_replace:
template: |
"_application_name_._environment_name_"
params:
_application_name_: { get_attr: [resource_tree, application_name ] }
_environment_name_: { get_param: "OS::stack_name" }
_ucd_server_url_: { get_param: ucd_server_url }
_ucd_relay_url_: { get_param: ucd_relay_url }
_ucd_user_ : { get_param: ucd_user }
_ucd_password_ : { get_param: ucd_password }
_agent_version_ : 7.1
_agent_team_ : ""
outputs:
blueprint_url:
description: Blueprint Origin URL
value: https://lorien.local:8443/landscaper/view/projects?open=admin_d033ba0f_9d80_4201_807b_7203e0594bff-OrionContent/JKE/JKE-RDS-Production3.yml