{
"Description": "Deploys the WordPress site and the phpMyAdmin app",
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"ZoneId": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
"Description": {
"en": "Make sure that the available regions support the creation of RDS, SLB, and ECS resource specifications;
View region and zone info.",
"zh-cn": "确保可用区域支持RDS、SLB和ECS资源规格的创建;
查看可用区信息."
},
"Label": "Zone Id",
"Default": "cn-hangzhou-i"
},
"DBInstanceNetType": {
"Type": "String",
"Description": {
"en": "Database instance net type, default is Intranet.Internet for public access, Intranet for private access.",
"zh-cn": "数据库实例网络类型,Internet用于公共访问,Intranet用于私有访问。"
},
"AllowedValues": [
"Intranet",
"Internet"
],
"Label": "Network type",
"Default": "Intranet"
},
"TotalDataDisk": {
"Type": "String",
"Description": {
"en": "The number of disks mounted in instance.",
"zh-cn": "实例挂载的磁盘数量。"
},
"Label": "Total Data Disk",
"Default": "1"
},
"DBInstanceClass": {
"Type": "String",
"Description": {
"en": "Select the instance specification based on the type of database engine and the available area support;
See detail: Instance specification sheet.",
"zh-cn": "根据数据库引擎类型和可用区域支持选择实例规格;
详见: 实例规格表."
},
"Label": "Instance Type",
"Default": "rds.mysql.s1.small"
},
"MasterDBPassword": {
"NoEcho": true,
"Type": "String",
"Description": {
"en": "Large/lowercase letters, Numbers and special characters take up three kinds, 8-32 bits.",
"zh-cn": "大/小写字母、数字和特殊字符占3种,8-32位。"
},
"AllowedPattern": "[a-zA-Z0-9-\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\_\\+-=]*",
"Label": "User Password",
"MinLength": 8,
"ConstraintDescription": "Large/lowercase letters, Numbers and special characters take up three kinds, and the length is 8-32 bits. Special characters included: !@#$%^&*()_+-=",
"MaxLength": 32
},
"JumpboxDataDiskType": {
"Type": "String",
"Description": {
"en": "The disk category, default is cloud_efficiency.",
"zh-cn": "磁盘类型, 默认为cloud_efficiency。"
},
"AllowedValues": [
"cloud_efficiency",
"cloud_ssd"
],
"Label": "Disk Category",
"Default": "cloud_efficiency"
},
"MasterUserName": {
"Type": "String",
"Description": {
"en": "A maximum of 16 characters, consisting of lowercase letters, Numbers, underscores, letters beginning, letters or Numbers ending.",
"zh-cn": "最多16个字符,包括小写字母、数字、下划线、字母开头、字母或数字结尾。"
},
"Label": "User Name",
"MinLength": 1,
"MaxLength": 16,
"Default": "dbname"
},
"DBInstanceEngineAndVersion": {
"Type": "String",
"Description": {
"en": "Database instance engine type, default is 'Mysql'.",
"zh-cn": "数据库引擎类型, 默认Mysql。"
},
"AllowedValues": [
"MySQL-5.6",
"SQLServer-2008r2",
"PostgreSQL-9.4"
],
"Label": "Engine",
"Default": "MySQL-5.6"
},
"JumpboxImageId": {
"Type": "String",
"Description": {
"en": "Image Id,See detail:Find the mirror",
"zh-cn": "镜像Id,详见: 查找镜像"
},
"Label": "Image Id",
"Default": "centos_7_04_64_20G_alibase_201701015.vhd"
},
"OSSBucketMountPoint": {
"Type": "String",
"Description": {
"en": "OSS bucket mount point, Application file mount point.",
"zh-cn": "OSS存储挂载点,应用程序文件挂载点。"
},
"Label": "Bucket Mount Point",
"Default": "/ossbucket"
},
"JumpboxPassword": {
"NoEcho": true,
"Type": "String",
"Description": {
"en": "Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three;
special characters include: ()'~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"zh-cn": "长度8-30,必须包含大写字母、小写字母、数字、特殊符号3个;
特殊字符包括:()` ~!@#$%^&*_-+=|{}[];` <>,.?/"
},
"AllowedPattern": "[a-zA-Z0-9-\\(\\)\\`\\~\\!@\\#\\$%\\^&\\*-+=\\|\\{\\}\\[\\]\\:\\;\\‘\\,\\.\\?\\/]*",
"Label": "Instance Password",
"ConstraintDescription": "Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three;
special characters include: ()'~!@#$%^&*_-+=|{}[]:;'<>,.?/",
"MinLength": 8,
"MaxLength": 30
},
"MountPoint": {
"Type": "String",
"Description": {
"en": "The mount point of data disk.",
"zh-cn": "数据盘挂载点"
},
"Label": "Data Disk Mount Point",
"Default": "/data"
},
"BucketName": {
"Type": "String",
"Description": {
"en": "3 to 63 characters, not beginning and ending with a hyphen (-), can contain lowercase letters, Numbers and hyphens (-);
Note: need whole network uniqueness, already existing can not be created.",
"zh-cn": "3到63个字符,不以连字符(-)开头和结尾,可以包含小写字母、数字和连字符(-);
备注:需要保证整个网络的唯一性,已经存在的无法创建"
},
"AllowedPattern": "^[a-z0-9]+[a-z0-9\\-]*[a-z0-9]+$",
"Label": "Bucket Name",
"ConstraintDescription": "3 to 63 characters, not beginning and ending with a hyphen (-), can contain lowercase letters, Numbers and hyphens (-)",
"MinLength": 3,
"MaxLength": 63,
"Default": "application-wordpress-oss"
},
"JumpboxInstanceType": {
"Type": "String",
"Description": {
"en": "Please confirm the inventory of this specification under the available area;
See detail:Instance specification family",
"zh-cn": "请在可用区域下确认此规格的库存;详见: 实例规格族"
},
"Label": "Instance Type",
"Default": "ecs.c5.large"
},
"DBInstanceStorage": {
"Type": "Number",
"Description": {
"en": "Incrementing in every 5G, unit: GB",
"zh-cn": "每5GB进行递增,单位:GB"
},
"Label": "Instance Storage",
"MinValue": 5,
"ConstraintDescription": "[5, 2000] Incrementing in every 5G, unit: GB",
"MaxValue": 2000,
"Default": 10
},
"DBName": {
"Type": "String",
"Description": {
"en": "Consists of lowercase letters, Numbers and special characters (-_).",
"zh-cn": "由小写字母、数字和特殊字符(-_)组成。"
},
"AllowedPattern": "^[a-z]+[a-z0-9\\-\\_]*[a-z0-9]+$",
"Label": "Database (DB) name",
"MinLength": 1,
"ConstraintDescription": "Consists of lowercase letters, Numbers and special characters (-_), beginning with letters, ending with letters or Numbers, up to 64 characters,",
"MaxLength": 63,
"Default": "dbname"
},
"JumpboxDataDiskSize": {
"Type": "Number",
"Description": {
"en": "Jumpbox data disk size, Disk unit: GB,default is '100', 20~32768.",
"zh-cn": "堡垒机数据盘大小,磁盘单位: GB, 范围:20-32768。"
},
"Label": "Data Disk Size",
"MinValue": 20,
"MaxValue": 32768,
"Default": 100
},
"Spec": {
"Type": "String",
"Description": {
"en": "NAT gateway specification.",
"zh-cn": "NAT网关规格。"
},
"AllowedValues": [
"Small",
"Middle",
"Large"
],
"Label": "NAT Gateway Specification",
"Default": "Small"
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"BucketName",
"OSSBucketMountPoint"
],
"Label": {
"default": "OSS"
}
},
{
"Parameters": [
"Spec"
],
"Label": {
"default": "VPC"
}
},
{
"Parameters": [
"ZoneId",
"JumpboxInstanceType",
"JumpboxImageId",
"JumpboxDataDiskType",
"JumpboxDataDiskSize",
"MountPoint",
"JumpboxPassword"
],
"Label": {
"default": "ECS"
}
},
{
"Parameters": [
"DBInstanceClass",
"DBInstanceEngineAndVersion",
"DBInstanceNetType",
"DBInstanceStorage",
"DBName",
"MasterUserName",
"MasterDBPassword"
],
"Label": {
"default": "RDS"
}
}
],
"TemplateTags": [
"Deploys the WordPress site and the phpMyAdmin app"
]
}
},
"Resources": {
"NewElasticIP": {
"Type": "ALIYUN::VPC::EIP",
"Properties": {
"InternetChargeType": "PayByTraffic"
}
},
"WebScalingConfiguration": {
"DependsOn": [
"OssBucket",
"RamAK"
],
"Type": "ALIYUN::ESS::ScalingConfiguration",
"Properties": {
"DiskMappings": [
{
"Category": {
"Ref": "JumpboxDataDiskType"
},
"Device": "/dev/xvdb",
"Size": 100
}
],
"UserData": {
"Fn::Join": [
"",
[
"#!/bin/sh\n",
"i=1\n",
"total=",
{
"Ref": "TotalDataDisk"
},
"\n",
"mountpoint=",
{
"Ref": "MountPoint"
},
"\n",
"while [ $i -le $total ]\n",
"do\n",
" j=`echo $i|awk '{printf \"%c\", 97+$i}'`\n",
"fdisk -S 56 /dev/vd$j <> $logs\n",
" mkfs.ext4 /dev/vd${j}1\n",
" if [ $? -eq 0 ];then\n",
" echo \"/dev/vd${j}1 is formated!\" >> $logs\n",
" fi\n",
" touch ~/test_ftab\n",
" mkdir $mountpoint\n",
"cat << ALIYUN > ~/test_ftab\n",
"/dev/vd${j}1 $mountpoint ext4 defaults 0 0\n",
"ALIYUN\n",
" cat ~/test_ftab >> /etc/fstab\n",
" mount -a\n",
" chmod -R 777 $mountpoint\n",
" rm -rf ~/test_ftab\n",
" echo \"/dev/vd${j}1 is mounted!\" >> $logs\n",
" let i+=1\n",
"ossbucket=",
{
"Ref": "BucketName"
},
"\n",
"ossbucketaccesskey=",
{
"Fn::GetAtt": [
"RamAK",
"AccessKeyId"
]
},
"\n",
"ossbucketsecret=",
{
"Fn::GetAtt": [
"RamAK",
"AccessKeySecret"
]
},
"\n",
"ossbucketmountpoint=",
{
"Ref": "OSSBucketMountPoint"
},
"\n",
"ossbucketendpoint=",
{
"Fn::Join": [
"",
[
"oss-",
{
"Ref": "ALIYUN::Region"
},
"-internal.aliyuncs.com"
]
]
},
"\n",
"DatabaseUser=",
{
"Ref": "MasterUserName"
},
"\n",
"DatabasePwd=",
{
"Ref": "MasterDBPassword"
},
"\n",
"DatabaseName=",
{
"Ref": "DBName"
},
"\n",
"DatabaseHost=",
{
"Fn::GetAtt": [
"Database",
"InnerConnectionString"
]
},
"\n",
"wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo\n",
"yum makecache\n",
"yum install -y curl httpd mysql-server php56 php56-php-mysql \n",
"rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm \n",
"rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm \n",
"yum install -y php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-imap.x86_64 php56w-ldap.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-odbc.x86_64 php56w-process.x86_64 php56w-xml.x86_64 php56w-xmlrpc.x86_64 \n",
"chkconfig httpd on\n",
"service httpd stop\n",
"DocumentRoot='/var/www/html'\n",
"sed -i \"s%$DocumentRoot%$ossbucketmountpoint%\" /etc/httpd/conf/httpd.conf\n",
"Directory='/var/www'\n",
"sed -i \"s%$Directory%$ossbucketmountpoint%\" /etc/httpd/conf/httpd.conf\n",
"wget https://github.com/aliyun/ossfs/releases/download/v1.80.3/ossfs_1.80.3_centos6.5_x86_64.rpm\n",
"yum install -y ossfs_1.80.3_centos6.5_x86_64.rpm\n",
"echo $ossbucket:$ossbucketaccesskey:$ossbucketsecret >> /etc/passwd-ossfs\n",
"chmod 600 /etc/passwd-ossfs\n",
"mkdir $ossbucketmountpoint\n",
"chmod -R 755 $ossbucketmountpoint\n",
"echo #This script will automount the ossbucket\n",
"echo umount $ossbucketmountpoint >> /usr/local/bin/ossfs-automount.sh\n",
"echo #Mounting OSS Bucket\n",
"echo ossfs $ossbucket $ossbucketmountpoint -ourl=http://$ossbucketendpoint -o allow_other -o mp_umask=0022 -ouid=48 -ogid=48 >> /usr/local/bin/ossfs-automount.sh\n",
"chmod 755 /usr/local/bin/ossfs-automount.sh\n",
"echo /usr/local/bin/ossfs-automount.sh >> /etc/rc.d/rc.local\n",
"chmod +x /etc/rc.d/rc.local\n",
"/usr/local/bin/./ossfs-automount.sh\n",
"chmod -R 755 /wwwroot/*\n",
"service httpd start\n",
"done\n"
]
]
},
"SystemDisk_Category": {
"Ref": "JumpboxDataDiskType"
},
"ScalingGroupId": {
"Ref": "WebScalingGroup"
},
"SecurityGroupId": {
"Ref": "SecurityGroupDefault"
},
"ImageId": {
"Ref": "JumpboxImageId"
},
"InstanceType": {
"Ref": "JumpboxInstanceType"
}
}
},
"ElasticIPAssociation": {
"Type": "ALIYUN::VPC::EIPAssociation",
"Properties": {
"InstanceId": {
"Ref": "Jumpbox"
},
"AllocationId": {
"Ref": "NewElasticIP"
}
}
},
"RamUser": {
"Type": "ALIYUN::RAM::User",
"Properties": {
"UserName": {
"Fn::Join": [
"-",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"Policies": [
{
"PolicyName": {
"Fn::Join": [
"-",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"PolicyDocument": {
"Version": "1",
"Statement": [
{
"Action": [
"oss:*"
],
"Resource": [
"*"
],
"Effect": "Allow"
}
]
}
}
]
}
},
"ScalingGroupEnable": {
"Type": "ALIYUN::ESS::ScalingGroupEnable",
"DependsOn": "Jumpbox",
"Properties": {
"ScalingGroupId": {
"Fn::GetAtt": [
"WebScalingGroup",
"ScalingGroupId"
]
},
"ScalingConfigurationId": {
"Fn::GetAtt": [
"WebScalingConfiguration",
"ScalingConfigurationId"
]
}
}
},
"OssBucket": {
"Type": "ALIYUN::OSS::Bucket",
"Properties": {
"BucketName": {
"Ref": "BucketName"
}
}
},
"SecurityGroupDefault": {
"Type": "ALIYUN::ECS::SecurityGroup",
"Properties": {
"VpcId": {
"Ref": "EcsVpc"
},
"SecurityGroupName": "WordPress-PhpMyAdmin",
"SecurityGroupIngress": [
{
"PortRange": "22/22",
"Priority": 1,
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp",
"NicType": "internet"
},
{
"PortRange": "80/80",
"Priority": 1,
"SourceCidrIp": "0.0.0.0/0",
"IpProtocol": "tcp",
"NicType": "internet"
}
],
"SecurityGroupEgress": [
{
"PortRange": "-1/-1",
"Priority": 1,
"IpProtocol": "all",
"DestCidrIp": "0.0.0.0/0",
"NicType": "internet"
},
{
"PortRange": "-1/-1",
"Priority": 1,
"IpProtocol": "all",
"DestCidrIp": "0.0.0.0/0",
"NicType": "intranet"
}
]
}
},
"NatGateway": {
"Type": "ALIYUN::ECS::NatGateway",
"DependsOn": "VSwitch1",
"Properties": {
"Description": "NAT_Gateway_OSSFS",
"VpcId": {
"Ref": "EcsVpc"
},
"NatGatewayName": {
"Fn::Join": [
"-",
[
"StackId",
{
"Ref": "ALIYUN::StackId"
}
]
]
},
"VSwitchId": {
"Ref": "VSwitch1"
},
"Spec": {
"Ref": "Spec"
}
}
},
"SNatTableEntry": {
"Type": "ALIYUN::ECS::SNatEntry",
"DependsOn": "EIPBind",
"Properties": {
"SourceVSwitchId": {
"Fn::GetAtt": [
"VSwitch1",
"VSwitchId"
]
},
"SNatTableId": {
"Fn::GetAtt": [
"NatGateway",
"SNatTableId"
]
},
"SNatIp": {
"Fn::GetAtt": [
"NatEip",
"EipAddress"
]
}
}
},
"WebScalingGroup": {
"Type": "ALIYUN::ESS::ScalingGroup",
"DependsOn": "Database",
"Properties": {
"MinSize": 2,
"VpcId": {
"Ref": "EcsVpc"
},
"VSwitchId": {
"Ref": "VSwitch1"
},
"LoadBalancerIds": [
{
"Ref": "CreateLoadBalancer"
}
],
"DBInstanceIds": [
{
"Ref": "Database"
}
],
"MaxSize": 2
}
},
"NatEip": {
"Type": "ALIYUN::VPC::EIP",
"Properties": {
"InternetChargeType": "PayByTraffic"
}
},
"EIPBind": {
"Type": "ALIYUN::VPC::EIPAssociation",
"Properties": {
"InstanceId": {
"Ref": "NatGateway"
},
"AllocationId": {
"Ref": "NatEip"
}
}
},
"CreateListener": {
"Type": "ALIYUN::SLB::Listener",
"Properties": {
"Persistence": {
"StickySession": "off",
"PersistenceTimeout": 1,
"XForwardedFor": "on",
"StickySessionType": "insert"
},
"ListenerPort": "80",
"Scheduler": "wrr",
"Bandwidth": 1,
"HealthCheck": {
"UnhealthyThreshold": 3,
"Timeout": 5,
"HealthyThreshold": 3,
"Interval": 2
},
"LoadBalancerId": {
"Ref": "CreateLoadBalancer"
},
"Protocol": "tcp",
"BackendServerPort": 80
}
},
"CreateLoadBalancer": {
"Type": "ALIYUN::SLB::LoadBalancer",
"Properties": {
"LoadBalancerName": "PublicLoadBalancer",
"AddressType": "internet",
"MasterZoneId": {
"Ref": "ZoneId"
},
"InternetChargeType": "paybytraffic"
}
},
"EcsVpc": {
"Type": "ALIYUN::ECS::VPC",
"Properties": {
"CidrBlock": "192.168.0.0/16",
"VpcName": "WordPress-PhpMyAdmin"
}
},
"Jumpbox": {
"Type": "ALIYUN::ECS::Instance",
"DependsOn": [
"OssBucket",
"RamAK",
"Database"
],
"Properties": {
"VpcId": {
"Ref": "EcsVpc"
},
"UserData": {
"Fn::Join": [
"",
[
"#!/bin/sh\n",
"logs=/var/log/mount_logs\n",
"#wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm\n",
"#rpm -ivh mysql-community-release-el7-5.noarch.rpm\n",
"#yum install mysql-community-client -y\n",
"ApacheIndexReplace='Options Indexes FollowSymLinks'\n",
"mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup\n",
"wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo\n",
"yum makecache\n",
"yum install -y unzip zip \n",
"yum install -y curl httpd mysql-server php56 php56-php-mysql \n",
"rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm \n",
"rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm \n",
"yum install -y php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-imap.x86_64 php56w-ldap.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-odbc.x86_64 php56w-process.x86_64 php56w-xml.x86_64 php56w-xmlrpc.x86_64 \n",
"chkconfig httpd on\n",
"i=1\n",
"total=",
{
"Ref": "TotalDataDisk"
},
"\n",
"mountpoint=",
{
"Ref": "MountPoint"
},
"\n",
"while [ $i -le $total ]\n",
"do\n",
" j=`echo $i|awk '{printf \"%c\", 97+$i}'`\n",
"fdisk -S 56 /dev/vd$j <> $logs\n",
" mkfs.ext4 /dev/vd${j}1\n",
" if [ $? -eq 0 ];then\n",
" echo \"/dev/vd${j}1 is formated!\" >> $logs\n",
" fi\n",
" touch ~/test_ftab\n",
" mkdir $mountpoint\n",
"cat << ALIYUN > ~/test_ftab\n",
"/dev/vd${j}1 $mountpoint ext4 defaults 0 0\n",
"ALIYUN\n",
" cat ~/test_ftab >> /etc/fstab\n",
" mount -a\n",
" chmod -R 777 $mountpoint\n",
" rm -rf ~/test_ftab\n",
" echo \"/dev/vd${j}1 is mounted!\" >> $logs\n",
" let i+=1\n",
"ossbucket=",
{
"Ref": "BucketName"
},
"\n",
"ossbucketaccesskey=",
{
"Fn::GetAtt": [
"RamAK",
"AccessKeyId"
]
},
"\n",
"ossbucketsecret=",
{
"Fn::GetAtt": [
"RamAK",
"AccessKeySecret"
]
},
"\n",
"ossbucketmountpoint=",
{
"Ref": "OSSBucketMountPoint"
},
"\n",
"ossbucketendpoint=",
{
"Fn::Join": [
"",
[
"oss-",
{
"Ref": "ALIYUN::Region"
},
"-internal.aliyuncs.com"
]
]
},
"\n",
"DatabaseUser=",
{
"Ref": "MasterUserName"
},
"\n",
"DatabasePwd=",
{
"Ref": "MasterDBPassword"
},
"\n",
"DatabaseName=",
{
"Ref": "DBName"
},
"\n",
"DatabaseHost=",
{
"Fn::GetAtt": [
"Database",
"InnerConnectionString"
]
},
"\n",
"ApacheIndex='Options Indexes FollowSymLinks'\n",
"ApacheIndexReplace='Options Indexes FollowSymLinks'\n",
"#yum install -y php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc\n",
"yum install -y phpmyadmin\n",
"sed -i \"s%localhost%$DatabaseHost%\" /etc/phpMyAdmin/config.inc.php\n",
"sed -i \"s%Deny,Allow%Allow,Deny%\" /etc/httpd/conf.d/phpMyAdmin.conf\n",
"sed -i \"s%Deny from All%Allow from All%\" /etc/httpd/conf.d/phpMyAdmin.conf\n",
"sed -i \"//a Require all Granted\" /etc/httpd/conf.d/phpMyAdmin.conf\n",
"chkconfig httpd on\n",
"service httpd stop\n",
"wget https://github.com/aliyun/ossfs/releases/download/v1.80.3/ossfs_1.80.3_centos6.5_x86_64.rpm\n",
"yum install -y ossfs_1.80.3_centos6.5_x86_64.rpm\n",
"echo $ossbucket:$ossbucketaccesskey:$ossbucketsecret >> /etc/passwd-ossfs\n",
"chmod 600 /etc/passwd-ossfs\n",
"mkdir $ossbucketmountpoint\n",
"chmod -R 755 $ossbucketmountpoint\n",
"echo #This script will automount the ossbucket\n",
"echo umount $ossbucketmountpoint >> /usr/local/bin/ossfs-automount.sh\n",
"echo #Mounting OSS Bucket\n",
"echo ossfs $ossbucket $ossbucketmountpoint -ourl=http://$ossbucketendpoint -o allow_other -o mp_umask=0022 -ouid=48 -ogid=48 >> /usr/local/bin/ossfs-automount.sh\n",
"chmod 755 /usr/local/bin/ossfs-automount.sh\n",
"echo /usr/local/bin/ossfs-automount.sh >> /etc/rc.d/rc.local\n",
"chmod +x /etc/rc.d/rc.local\n",
"/usr/local/bin/./ossfs-automount.sh\n",
"#wget http://wordpress.org/latest.tar.gz\n",
"#tar -xzvf latest.tar.gz\n",
"wget https://ros-userdata-resources.oss-cn-beijing.aliyuncs.com/WordPress/WordPress.zip \n",
"unzip WordPress.zip \n",
"mv WordPress-master wordpress \n",
"sed -i \"s%database_name_here%$DatabaseName%\" wordpress/wp-config-sample.php\n",
"sed -i \"s%username_here%$DatabaseUser%\" wordpress/wp-config-sample.php\n",
"sed -i \"s%password_here%${DatabasePwd:-$DatabasePwdDef}%\" wordpress/wp-config-sample.php\n",
"sed -i \"s%localhost%$DatabaseHost%\" wordpress/wp-config-sample.php\n",
"mv wordpress/wp-config-sample.php wordpress/wp-config.php\n",
"cp -a wordpress/* $ossbucketmountpoint\n",
"#chmod -R 755 /wwwroot/*\n",
"mv wordpress backup-worpress \n",
"#sed -i \"s%/var/www/html%$ossbucketmountpoint%\" /etc/httpd/conf/httpd.conf\n",
"#sed -i \"s%/var/www%$ossbucketmountpoint%\" /etc/httpd/conf/httpd.conf\n",
"sed -i \"s%$ApacheIndex%$ApacheIndexReplace%\" /etc/httpd/conf/httpd.conf\n",
"chown apache:apache -R /var/www/html\n",
"service httpd start\n",
"done\n"
]
]
},
"SecurityGroupId": {
"Ref": "SecurityGroupDefault"
},
"VSwitchId": {
"Ref": "VSwitch1"
},
"ImageId": {
"Ref": "JumpboxImageId"
},
"AllocatePublicIP": false,
"InstanceType": {
"Ref": "JumpboxInstanceType"
},
"Password": {
"Ref": "JumpboxPassword"
}
}
},
"JumpboxDataDiskAttachment": {
"Type": "ALIYUN::ECS::DiskAttachment",
"Properties": {
"InstanceId": {
"Ref": "Jumpbox"
},
"Device": "/dev/xvdb",
"DiskId": {
"Fn::GetAtt": [
"JumpboxDataDisk",
"DiskId"
]
}
}
},
"Database": {
"Type": "ALIYUN::RDS::DBInstance",
"Properties": {
"MasterUserPassword": {
"Ref": "MasterDBPassword"
},
"EngineVersion": {
"Fn::Select": [
"1",
{
"Fn::Split": [
"-",
{
"Ref": "DBInstanceEngineAndVersion"
}
]
}
]
},
"VpcId": {
"Ref": "EcsVpc"
},
"DBInstanceNetType": {
"Ref": "DBInstanceNetType"
},
"DBInstanceClass": {
"Ref": "DBInstanceClass"
},
"SecurityIPList": "0.0.0.0/0",
"DBInstanceStorage": {
"Ref": "DBInstanceStorage"
},
"VSwitchId": {
"Ref": "VSwitch1"
},
"MasterUsername": {
"Ref": "MasterUserName"
},
"DBMappings": [
{
"CharacterSetName": "utf8",
"DBName": {
"Ref": "DBName"
}
}
],
"Engine": {
"Fn::Select": [
"0",
{
"Fn::Split": [
"-",
{
"Ref": "DBInstanceEngineAndVersion"
}
]
}
]
}
}
},
"RamAK": {
"Type": "ALIYUN::RAM::AccessKey",
"Properties": {
"UserName": {
"Fn::GetAtt": [
"RamUser",
"UserName"
]
}
},
"DependOn": [
"RamUser"
]
},
"JumpboxDataDisk": {
"Type": "ALIYUN::ECS::Disk",
"Properties": {
"ZoneId": {
"Ref": "ZoneId"
},
"Size": {
"Ref": "JumpboxDataDiskSize"
},
"DiskCategory": {
"Ref": "JumpboxDataDiskType"
}
}
},
"VSwitch1": {
"Type": "ALIYUN::ECS::VSwitch",
"Properties": {
"VpcId": {
"Ref": "EcsVpc"
},
"ZoneId": {
"Ref": "ZoneId"
},
"CidrBlock": "192.168.1.0/24",
"VSwitchName": "VSwitch1-x"
}
}
},
"Outputs": {
"VRouterId": {
"Description": "Router id of created VPC.",
"Value": {
"Fn::GetAtt": [
"EcsVpc",
"VRouterId"
]
}
},
"LoadBalancerIpAddress": {
"Description": "The ip address of the load balancer.",
"Value": {
"Fn::GetAtt": [
"CreateLoadBalancer",
"IpAddress"
]
}
},
"RouteTableId": {
"Description": "The router table id of created VPC.",
"Value": {
"Fn::GetAtt": [
"EcsVpc",
"RouteTableId"
]
}
},
"VpcId": {
"Description": "Id of created VPC.",
"Value": {
"Fn::GetAtt": [
"EcsVpc",
"VpcId"
]
}
},
"DBInstanceId": {
"Description": "The instance id of created database instance.",
"Value": {
"Fn::GetAtt": [
"Database",
"DBInstanceId"
]
}
},
"SecurityGroupId": {
"Description": "Generated security group id for security group.",
"Value": {
"Fn::GetAtt": [
"SecurityGroupDefault",
"SecurityGroupId"
]
}
},
"VSwitchId": {
"Description": "Id of created VSwitch.",
"Value": {
"Fn::GetAtt": [
"VSwitch1",
"VSwitchId"
]
}
},
"JumpboxEipAddress": {
"Description": "IP address of created EIP.",
"Value": {
"Fn::GetAtt": [
"NewElasticIP",
"EipAddress"
]
}
},
"InnerConnectString": {
"Description": "DB instance connection url by Intranet.",
"Value": {
"Fn::GetAtt": [
"Database",
"InnerConnectionString"
]
}
},
"JumpboxInstanceId": {
"Description": "The instance id of created ecs instance",
"Value": {
"Fn::GetAtt": [
"Jumpbox",
"InstanceId"
]
}
},
"PhpAdminUrl": {
"Description": "Phpadmin url.",
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"NewElasticIP",
"EipAddress"
]
},
"/phpmyadmin",
"/index.php"
]
]
}
},
"PublicPort": {
"Description": "Internet port of created DB instance.",
"Value": {
"Fn::GetAtt": [
"Database",
"PublicPort"
]
}
}
}
}