Skip to content

Instantly share code, notes, and snippets.

@d-sea
Last active January 2, 2016 16:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d-sea/8328203 to your computer and use it in GitHub Desktop.
Save d-sea/8328203 to your computer and use it in GitHub Desktop.
[SmartWP](http://www.shakesoul.net/smartwp) - Chef recipe for base setup : site-cookbooks/swp_setup/recipes/default.rb
#
# Cookbook Name:: swp_setup
# Recipe:: default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
######### create SWAP for micro instance of AWS EC2 ##########
bash 'create swapfile' do
user 'root'
code <<-EOC
dd if=/dev/zero of=/swap.img bs=1M count=2048 &&
chmod 600 /swap.img
mkswap /swap.img
EOC
only_if { "test ! -f /swap.img -a `cat /proc/swaps | wc -l` -eq 1" }
end
mount '/dev/null' do # swap file entry for fstab
action :enable # cannot mount; only add to fstab
device '/swap.img'
fstype 'swap'
end
bash 'activate swap' do
code 'swapon -ae'
only_if "test `cat /proc/swaps | wc -l` -eq 1"
end
############## nginx ##############
package "nginx" do
action :install
end
############## php ##############
package "php" do
action :install
end
package "php-fpm" do
action :install
end
package "php-mbstring" do
action :install
end
package "php-mysql" do
action :install
end
package "php-xml" do
action :install
end
package "php-gd" do
action :install
end
############## mysql ##############
package "mysql" do
action :install
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment