-
Notifications
You must be signed in to change notification settings - Fork 35
/
java-web-single-instance.yml
310 lines (307 loc) · 9.71 KB
/
java-web-single-instance.yml
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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建VPC、交换机、安全组,部署ECS实例,安装JDK和Tomcat,配置自动访问验证。
en: Create a Virtual Private Cloud (VPC), configure subnets (switches), set up security
groups, deploy Elastic Compute Service (ECS) instances, install Java Development
Kit (JDK) and Apache Tomcat, and configure automatic access authentication.
Parameters:
VpcCidrBlock:
Type: String
Label:
en: VPC CIDR Block
zh-cn: 专有网络网段
Description:
en: 'The IP address range of the VPC in the CIDR Block form; <br>You can use
the following IP address ranges and their subnets: <br><font color=''green''>[10.0.0.0/8]</font><br><font
color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>'
zh-cn: VPC的IP地址范围;<br>您可以使用以下IP地址范围及其子网:<br><font color='green'>[10.0.0.0/8]</font><br><font
color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0/16]</font>
Default: 192.168.0.0/16
VSwitchCidrBlock:
Type: String
Label:
en: VSwitch CIDR Block
zh-cn: 交换机网段
Description:
en: CIDR Block of created VSwitch,It must belong to itself VPC CIDR Block.
zh-cn: 创建的虚拟交换机的子网,它必须属于自己的VPC网段内
Default: 192.168.1.0/24
ImageId:
Type: String
Label:
en: Image ID
zh-cn: ECS镜像ID
Description:
en: Image ID, represents the image resource to startup one ECS instance, <font><a
href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><b>View
image resources</b></font color='blue'></a>
zh-cn: 镜像ID,ECS实例的镜像资源, <font><a href='https://help.aliyun.com/document_detail/112977.html'
target='_blank'><b>查看镜像资源</b></font color='blue'></a>
Default: centos_7
InstanceType:
Type: String
Label:
en: Instance Type
zh-cn: ECS实例规格
Description:
en: The ECS instance type,go to the product console to ensure the current instance
is available, <font><a href='https://www.alibabacloud.com/help/doc-detail/25378.html'
target='_blank'><b>View instance types</b></font color='blue'></a>
zh-cn: ECS实例类型,进入产品控制台确保当前实例可用, <font><a href='https://help.aliyun.com/document_detail/25378.html'
target='_blank'><b>查看实例类型</b></font color='blue'></a>
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
InstanceSystemDiskCategory:
Type: String
Label:
en: Instance System Disk Category
zh-cn: ECS系统盘规格
Description:
en: '<font color=''blue''><b>Optional values:</b></font><br>[cloud_efficiency:
<font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD
Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud:
<font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local
SSD Cloud Disk</font>]'
zh-cn: '<font color=''blue''><b>可选值:</b></font><br>[cloud_efficiency: <font
color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd:
<font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]<br>[ephemeral_ssd:
<font color=''green''>本地SSD盘</font>]'
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
ZoneId: ${ZoneId}
AllowedValues:
- cloud_efficiency
- cloud_ssd
- cloud
- cloud_essd
- ephemeral_ssd
InstancePassword:
Type: String
Label:
en: Instance Password
zh-cn: ECS实例密码
Description:
en: The 8-30 long login password of instance, consists of the uppercase, lowercase
letter and number. <br> special characters include()'~!@#$%^&*_-+=|{}[]:;'<>,.?/.
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三个;<br>特殊字符包括:()'~!@#$%^&*_-+=|{}[]:;'<>,.?/
ConstraintDescription:
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers,
special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
AllowedPattern: '[a-zA-Z0-9-\(\)\`\~\!@\#\$%\^&\*-+=\|\{\}\[\]\:\;\‘\,\.\?\/]*'
MinLength: 8
MaxLength: 30
NoEcho: true
ZoneId:
Type: String
Label:
en: Zone ID
zh-cn: 可用区ID
Description:
en: The available zone ID, you should confirm the zone support ECS、VPC、VSwitch
or not.
zh-cn: 可用区ID,需确认所选可用区下是否支持ECS、VPC、VSwitch等资源。
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName: Java_Web_VPC
Metadata:
ALIYUN::ROS::Designer:
id: 250f56b2-b142-4ea9-a904-cbfa9494251a
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
SecurityGroupEgress:
- DestCidrIp: 0.0.0.0/0
IpProtocol: all
NicType: internet
PortRange: -1/-1
Priority: 1
SecurityGroupIngress:
- IpProtocol: all
NicType: internet
PortRange: -1/-1
Priority: 1
SourceCidrIp: 0.0.0.0/0
Metadata:
ALIYUN::ROS::Designer:
id: 60f8935f-0471-46cc-afad-d9623a401a3a
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
CidrBlock:
Ref: VSwitchCidrBlock
Metadata:
ALIYUN::ROS::Designer:
id: a9eb9316-8735-4296-ab82-0654fcbcb208
WebServer:
Type: ALIYUN::ECS::Instance
Properties:
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
InstanceName: Java_Web_Instance
InstanceType:
Ref: InstanceType
InternetMaxBandwidthOut: 80
Password:
Ref: InstancePassword
SystemDiskCategory:
Ref: InstanceSystemDiskCategory
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- WebServerConditionHandle
- CurlCli
- Fn::Join:
- ''
- - '#!/bin/bash
'
- 'cd /root
'
- "yum -y install java \n"
- "yum -y install tomcat tomcat-webapps tomcat-admin-webapps \n"
- "systemctl start tomcat.service \n"
- 'sleep 3
'
- "netstat -ntlp | grep 8080 >> /tmp/access.log \n"
- "if [[ $? -eq 0 ]]; \n"
- "then \n"
- " ros-notify \n"
- "fi \n"
Metadata:
ALIYUN::ROS::Designer:
id: 97357d84-b2fa-4f0a-afbe-305e7d73afe2
WebServerConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: 06beb6ea-35d9-4322-9f50-320467b5e4e8
WebServerGroupWaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: WebServerConditionHandle
Timeout: 3600
DependsOn: WebServer
Metadata:
ALIYUN::ROS::Designer:
id: ac2472d0-703d-4738-9534-8efef03e7fb0
Outputs:
WebsiteURL:
Description: URL for newly created Apache Tomcat
Value:
Fn::Join:
- ''
- - http://
- Fn::GetAtt:
- WebServer
- PublicIp
- :8080
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcCidrBlock
- VSwitchCidrBlock
Label:
default: VPC
- Parameters:
- ImageId
- InstanceType
- InstanceSystemDiskCategory
- InstancePassword
Label:
default: ECS
TemplateTags:
- acs:example:网站:部署JavaWeb开发测试环境
ALIYUN::ROS::Designer:
06beb6ea-35d9-4322-9f50-320467b5e4e8:
position:
x: 263
y: 261
size:
height: 60
width: 60
z: 0
250f56b2-b142-4ea9-a904-cbfa9494251a:
embeds:
- a9eb9316-8735-4296-ab82-0654fcbcb208
- 60f8935f-0471-46cc-afad-d9623a401a3a
position:
x: 388
y: 44
size:
height: 310
width: 316
z: 0
4b377b4f-c42b-4745-b5b4-b645da227564:
source:
id: ac2472d0-703d-4738-9534-8efef03e7fb0
target:
id: 06beb6ea-35d9-4322-9f50-320467b5e4e8
z: 1
60f8935f-0471-46cc-afad-d9623a401a3a:
position:
x: 613
y: 239
size:
height: 60
width: 60
z: 1
771578ba-c74b-4453-ad66-6d35cffd8fd7:
source:
id: 97357d84-b2fa-4f0a-afbe-305e7d73afe2
target:
id: 60f8935f-0471-46cc-afad-d9623a401a3a
z: 1
97357d84-b2fa-4f0a-afbe-305e7d73afe2:
position:
x: 449
y: 114
size:
height: 60
width: 60
z: 2
a9eb9316-8735-4296-ab82-0654fcbcb208:
embeds:
- 97357d84-b2fa-4f0a-afbe-305e7d73afe2
position:
x: 411
y: 74
size:
height: 153
width: 132
z: 1
ac2472d0-703d-4738-9534-8efef03e7fb0:
position:
x: 263
y: 77
size:
height: 60
width: 60
z: 0