-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78745e7
commit 0f9f149
Showing
2 changed files
with
271 additions
and
3 deletions.
There are no files selected for viewing
268 changes: 268 additions & 0 deletions
268
...nts/solution/high-availability-architecture/serverless-high-availability-architecture.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,268 @@ | ||
ROSTemplateFormatVersion: '2015-09-01' | ||
Description: | ||
en: Serverless high availability architecture. | ||
zh-cn: Serverless高可用架构。 | ||
Parameters: | ||
CommonName: | ||
Type: String | ||
Default: serverless | ||
ZoneId1: | ||
Type: String | ||
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId' | ||
AssociationPropertyMetadata: | ||
ExclusiveTo: | ||
- ZoneId2 | ||
Label: | ||
en: Availability Zone | ||
zh-cn: 可用区1 | ||
ZoneId2: | ||
Type: String | ||
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId' | ||
AssociationPropertyMetadata: | ||
ExclusiveTo: | ||
- ZoneId1 | ||
Label: | ||
en: Availability Zone | ||
zh-cn: 可用区2 | ||
DBUserName: | ||
Type: String | ||
ConstraintDescription: | ||
en: >- | ||
Consist of 2 to 32 characters of lowercase letters, underline. | ||
Must begin with a letter and be end with an alphanumeric character | ||
zh-cn: >- | ||
由 2 到 32 个小写字母组成,支持小写字母、数字和下划线,以小写字母开头。 | ||
Label: | ||
zh-cn: RDS数据库账号 | ||
en: RDS DB Username | ||
Default: applets | ||
AllowedPattern: '^[a-z][a-z0-9_]{0,31}$' | ||
DBPassword: | ||
NoEcho: true | ||
Type: String | ||
Description: | ||
en: >- | ||
RDS user password, Length 8-30, must contain three(Capital letters, | ||
lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special | ||
symbol in) | ||
zh-cn: >- | ||
数据库账号密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ | ||
中的特殊符号) | ||
Label: | ||
en: RDS Instance Password | ||
zh-cn: RDS数据库密码 | ||
ConstraintDescription: | ||
en: >- | ||
Length 8-30, must contain three(Capital letters, lowercase letters, | ||
numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in) | ||
zh-cn: '长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/ 中的特殊符号)' | ||
AssociationProperty: 'ALIYUN::ECS::Instance::Password' | ||
Resources: | ||
Vpc: | ||
Type: 'ALIYUN::ECS::VPC' | ||
Properties: | ||
CidrBlock: 192.168.0.0/16 | ||
VpcName: | ||
Fn::Sub: ${CommonName}-vpc | ||
VSwitch1: | ||
Type: 'ALIYUN::ECS::VSwitch' | ||
Properties: | ||
VpcId: | ||
Ref: Vpc | ||
CidrBlock: 192.168.1.0/24 | ||
ZoneId: | ||
Ref: ZoneId1 | ||
VSwitchName: | ||
Fn::Sub: ${CommonName}-vsw | ||
VSwitch2: | ||
Type: 'ALIYUN::ECS::VSwitch' | ||
Properties: | ||
VpcId: | ||
Ref: Vpc | ||
CidrBlock: 192.168.2.0/24 | ||
ZoneId: | ||
Ref: ZoneId2 | ||
VSwitchName: | ||
Fn::Sub: ${CommonName}-vsw | ||
SecurityGroup: | ||
Type: 'ALIYUN::ECS::SecurityGroup' | ||
Properties: | ||
VpcId: | ||
Ref: Vpc | ||
SecurityGroupName: | ||
Fn::Sub: ${CommonName}-sg | ||
SecurityGroupIngress: | ||
- PortRange: 22/22 | ||
SourceCidrIp: 0.0.0.0/0 | ||
IpProtocol: tcp | ||
- PortRange: 443/443 | ||
SourceCidrIp: 0.0.0.0/0 | ||
IpProtocol: tcp | ||
- PortRange: 80/80 | ||
SourceCidrIp: 0.0.0.0/0 | ||
IpProtocol: tcp | ||
PolarDBCluster: | ||
Type: 'ALIYUN::POLARDB::DBCluster' | ||
Properties: | ||
VpcId: | ||
Ref: Vpc | ||
DBType: MySQL | ||
ClusterNetworkType: VPC | ||
ZoneId: | ||
Ref: ZoneId1 | ||
SecurityGroupIds: | ||
- Ref: SecurityGroup | ||
DBVersion: '8.0' | ||
DBMinorVersion: '8.0.2' | ||
DBNodeClass: polar.mysql.sl.small | ||
VSwitchId: | ||
Ref: VSwitch1 | ||
CreationCategory: Normal | ||
ScaleRoNumMin: 1 | ||
ScaleRoNumMax: 4 | ||
ScaleMin: 1 | ||
ScaleMax: 16 | ||
ProxyType: GENERAL | ||
PayType: Postpaid | ||
ServerlessType: AgileServerless | ||
PolarDBDatabase: | ||
Type: 'ALIYUN::POLARDB::DBInstance' | ||
Properties: | ||
DBClusterId: | ||
Ref: PolarDBCluster | ||
CharacterSetName: utf8mb4 | ||
DBName: applets | ||
DBDescription: serverless demo | ||
PolarDBAccount: | ||
Type: 'ALIYUN::POLARDB::Account' | ||
Properties: | ||
DBClusterId: | ||
Ref: PolarDBCluster | ||
AccountName: | ||
Ref: DBUserName | ||
AccountType: Normal | ||
AccountPassword: | ||
Ref: DBPassword | ||
AccountPrivilege: ReadWrite | ||
DBName: | ||
Ref: PolarDBDatabase | ||
Alb: | ||
Type: 'ALIYUN::ALB::LoadBalancer' | ||
Properties: | ||
LoadBalancerName: | ||
Fn::Sub: ${CommonName}-alb | ||
LoadBalancerEdition: Basic | ||
VpcId: | ||
Ref: Vpc | ||
LoadBalancerBillingConfig: | ||
PayType: PostPay | ||
AddressType: Internet | ||
ZoneMappings: | ||
- ZoneId: | ||
Ref: ZoneId1 | ||
VSwitchId: | ||
Ref: VSwitch1 | ||
- ZoneId: | ||
Ref: ZoneId2 | ||
VSwitchId: | ||
Ref: VSwitch2 | ||
SaeNamespace: | ||
Type: 'ALIYUN::SAE::Namespace' | ||
Properties: | ||
NamespaceName: serverless-demo | ||
NamespaceId: | ||
Fn::Sub: | ||
- '${Region}:serverless${Suffix}' | ||
- Region: | ||
Ref: ALIYUN::Region | ||
Suffix: | ||
Fn::Jq: | ||
- First | ||
- .StackId[:5] | ||
- StackId: | ||
Ref: ALIYUN::StackId | ||
SaeApp: | ||
Type: 'ALIYUN::SAE::Application' | ||
DependsOn: SaeNamespace | ||
Properties: | ||
AppName: | ||
Fn::Sub: | ||
- 'serverless-demo-${Suffix}' | ||
- Suffix: | ||
Fn::Jq: | ||
- First | ||
- .StackId[:5] | ||
- StackId: | ||
Ref: ALIYUN::StackId | ||
AppDescription: serverless-demo | ||
VpcId: | ||
Ref: Vpc | ||
SecurityGroupId: | ||
Ref: SecurityGroup | ||
VSwitchId: | ||
Fn::Sub: '${VSwitch1},${VSwitch2}' | ||
Replicas: 2 | ||
NamespaceId: | ||
Ref: SaeNamespace | ||
Cpu: 2000 | ||
Memory: 4096 | ||
PackageType: FatJar | ||
PackageVersion: '1718956564756' | ||
Jdk: Open JDK 8 | ||
PackageUrl: https://help-static-aliyun-doc.aliyuncs.com/demos/sae-demo-0.0.1-SNAPSHOT.jar | ||
Timezone: Asia/Shanghai | ||
JarStartArgs: '$JAVA_HOME/bin/java $Options -jar $CATALINA_OPTS "$package_path" $args' | ||
Envs: | ||
Fn::Sub: >- | ||
[{"name":"APPLETS_RDS_ENDPOINT","value":"${PolarDBCluster.PrimaryConnectionString}"}, | ||
{"name":"APPLETS_RDS_USER","value":"${DBUserName}"}, | ||
{"name":"APPLETS_RDS_PASSWORD","value":"${DBPassword}"}, | ||
{"name":"APPLETS_RDS_DB_NAME","value":"applets"}] | ||
WaitApp: | ||
Type: 'ALIYUN::ROS::Sleep' | ||
DependsOn: SaeApp | ||
Properties: | ||
CreateDuration: 180 | ||
SaeIngress: | ||
Type: 'ALIYUN::SAE::Ingress' | ||
DependsOn: WaitApp | ||
Properties: | ||
NamespaceId: | ||
Ref: SaeNamespace | ||
Description: serverless-demo-router | ||
LoadBalanceType: alb | ||
SlbId: | ||
Ref: Alb | ||
ListenerProtocol: HTTP | ||
ListenerPort: 80 | ||
Rules: | ||
- Domain: example.com | ||
Path: / | ||
AppId: | ||
Ref: SaeApp | ||
ContainerPort: 80 | ||
BackendProtocol: http | ||
DefaultRule: | ||
AppId: | ||
Ref: SaeApp | ||
ContainerPort: 80 | ||
BackendProtocol: http | ||
Outputs: | ||
WebUrl: | ||
Description: | ||
zh-cn: Web 访问地址。 | ||
en: The Addresses of Web. | ||
Value: | ||
'Fn::Sub': 'http://${Alb.DNSName}' | ||
Metadata: | ||
ALIYUN::ROS::Interface: | ||
ParameterGroups: | ||
- Parameters: | ||
- DBUserName | ||
- DBPassword | ||
- ZoneId1 | ||
- ZoneId2 | ||
TemplateTags: | ||
- acs:technical-solution:high-availability-architecture:Serverless高可用架构-tech_solu_129 | ||
Hidden: | ||
- CommonName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters