Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Custome params #42

Merged
merged 3 commits into from Jan 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions as-hvm.rb
Expand Up @@ -13,6 +13,7 @@

Mappings do
_include "include/mapping/ami_as.rb"
_include "include/mapping/amimoto_config.rb"
end

Parameters do
Expand Down
16 changes: 16 additions & 0 deletions include/mapping/amimoto_config.rb
@@ -0,0 +1,16 @@
AMIMOTOConfig(
{
"mobile-detect"=>{
"enabled"=>"true",
"disabled"=>"false"
},
"wp-multisite"=>{
"enabled"=>"true",
"disabled"=>"false"
},
"php-myadmin"=>{
"enabled"=>"true",
"disabled"=>"false"
}
}
)
3 changes: 3 additions & 0 deletions include/parameters/autoscale.rb
@@ -1,14 +1,17 @@
AutoScalingMaxSize do
Description "Max instance number of AutoScaling group"
Type "Number"
Default 2
end

AutoScalingMinSize do
Description "Min instance number of AutoScaling group"
Type "Number"
Default 2
end

AutoScalingDesiredCapacity do
Description "Desired capacity of AutoScaling group"
Type "Number"
Default 2
end
5 changes: 3 additions & 2 deletions include/parameters/cloudwatchlogs.rb
@@ -1,4 +1,5 @@
LogRetentionInDays do
Description "Log retention days"
Description "Log retention days on CloudWatch Logs"
Type "Number"
end
Default 7
end
45 changes: 45 additions & 0 deletions include/parameters/wordpress.rb
Expand Up @@ -15,3 +15,48 @@
Description "User Name for the WordPress User"
Type "String"
end

WPCoreVersion do
Description "WordPress Version"
Type "String"
Default "latest"
AllowedValues "4.5.4", "4.6.1", "latest"
ConstraintDescription "Must be a valid WordPress Version"
end

WPIsMultiSite do
Description "Nginx config exchange for Multisite WordPress"
Type "String"
Default "disabled"
AllowedValues "disabled", "enabled"
ConstraintDescription "Must be a valid configuration"
end


IsMobileDetect do
Description "If you use `is_wp_mobile()` function, please enable it."
Type "String"
Default "disabled"
AllowedValues "disabled", "enabled"
ConstraintDescription "Must be a valid configuration"
end

PHPmyAdmin do
Description "Enable phpMyAdmin"
Type "String"
Default "disabled"
AllowedValues "disabled", "enabled"
ConstraintDescription "Must be a valid configuration"
end

NginxClientMaxBodySite do
Description "Nginx Client max body size (MB)"
Type "Number"
Default 4
end

PHPMemoryLimit do
Description "PHP memory limit (MB)"
Type "Number"
Default 128
end
46 changes: 42 additions & 4 deletions include/resource/autoscale/launch_config.rb
Expand Up @@ -81,9 +81,47 @@
"tmp_json=`mktemp`\n",
"amimoto_json='/opt/local/amimoto.json'\n",
"json='{",
"\"wordpress\":{\"document_root\":\"/var/www/html\",\"jinkei_cf\": \"true\"},",
"\"nginx\" : { \"config\" : { \"user\" : \"ec2-user\" } },",
"\"php\" : { \"config\" : { \"user\" : \"ec2-user\" } },",
"\"wordpress\":{",
"\"document_root\":\"/var/www/html\",",
"\"jinkei_cf\": \"true\",",
"\"version\": \"",_{ Ref "WPCoreVersion"}, "\"",
"},",
"\"nginx\" : {",
" \"config\" : {",
" \"user\" : \"ec2-user\",",
" \"wp_multisite\": ",
_{
Fn__FindInMap [
"AMIMOTOConfig",
"wp-multisite",
_{ Ref "WPIsMultiSite" },
]
}, ",",
" \"mobile_detect_enable\": ",
_{
Fn__FindInMap [
"AMIMOTOConfig",
"mobile-detect",
_{ Ref "IsMobileDetect" },
]
}, ",",
" \"client_max_body_size\": \"", _{ Ref "NginxClientMaxBodySite"} , "M\",",
" \"phpmyadmin_enable\": ",
_{
Fn__FindInMap [
"AMIMOTOConfig",
"php-myadmin",
_{ Ref "PHPmyAdmin" },
]
},
"}",
"},",
"\"php\" : {",
" \"config\" : {",
" \"user\" : \"ec2-user\",",
" \"memory_limit\": \"", _{ Ref "PHPMemoryLimit" }, "M\"",
"} ",
"},",
"\"run_list\" : [ \"recipe[amimoto]\" ]",
"}'\n",
"[ ! -e /opt/local ] && /bin/mkdir -p /opt/local\n",
Expand All @@ -94,9 +132,9 @@
" echo $json > $tmp_json\n",
"fi\n",
"[ -f $tmp_json ] && /bin/mv -f $tmp_json $amimoto_json\n",
"/bin/sh /opt/local/provision\n",

## DIRオーナ変更
## @TODO:ここでchown実行できているか確認(FTP情報要求された時がある)
"chown -R ec2-user:nginx /var/www/html\n",
"echo '@reboot /bin/sh /opt/local/provision > /dev/null 2>&1; chown -R ec2-user /var/www/html/' | crontab\n",

Expand Down